當前位置: 首頁>>代碼示例>>Java>>正文


Java TestClass.getAnnotatedMethods方法代碼示例

本文整理匯總了Java中org.junit.runners.model.TestClass.getAnnotatedMethods方法的典型用法代碼示例。如果您正苦於以下問題:Java TestClass.getAnnotatedMethods方法的具體用法?Java TestClass.getAnnotatedMethods怎麽用?Java TestClass.getAnnotatedMethods使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.junit.runners.model.TestClass的用法示例。


在下文中一共展示了TestClass.getAnnotatedMethods方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getParameterizations

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
/**
 * Gets the parameterization
 * @return the parameterization collection
 * @throws Throwable if the annotation requirements are not met, or if there's an error in invoking
 * the class's "get parameterizations" method.
 */
private Collection<Parameterization> getParameterizations() throws Throwable
{
    TestClass cls = getTestClass();
    List<FrameworkMethod> methods = cls.getAnnotatedMethods(TestParameters.class);

    if (methods.size() != 1)
    {
        throw new Exception("class " + cls.getName() + " must have exactly 1 method annotated with "
            + TestParameters.class.getSimpleName() +"; found " + methods.size());
    }

    FrameworkMethod method = methods.get(0);
    checkParameterizationMethod(method);

    @SuppressWarnings("unchecked")
    Collection<Parameterization> ret = (Collection<Parameterization>) method.invokeExplosively(null);
    checkParameterizations(ret);
    return ret;
}
 
開發者ID:jaytaylor,項目名稱:sql-layer,代碼行數:26,代碼來源:NamedParameterizedRunner.java

示例2: explode

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
static List<Runner> explode(Class<?> cls) throws InitializationError {
  checkNotNull(cls, "cls");

  TestClass testClass = new TestClass(cls);
  List<FrameworkMethod> testMethods = testClass.getAnnotatedMethods(Test.class);

  List<FrameworkMethod> burstMethods = new ArrayList<>(testMethods.size());
  for (FrameworkMethod testMethod : testMethods) {
    Method method = testMethod.getMethod();
    for (Enum<?>[] methodArgs : Burst.explodeArguments(method)) {
      burstMethods.add(new BurstMethod(method, methodArgs));
    }
  }

  TestConstructor constructor = BurstableConstructor.findSingle(cls);
  Enum<?>[][] constructorArgsList = Burst.explodeArguments(constructor);
  List<Runner> burstRunners = new ArrayList<>(constructorArgsList.length);
  for (Enum<?>[] constructorArgs : constructorArgsList) {
    burstRunners.add(new BurstRunner(cls, constructor, constructorArgs, burstMethods));
  }

  return unmodifiableList(burstRunners);
}
 
開發者ID:square,項目名稱:burst,代碼行數:24,代碼來源:BurstJUnit4.java

示例3: getParametersMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
private FrameworkMethod getParametersMethod() throws Exception {
    TestClass testClass = getTestClass();
    List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Parameters.class);
    for (FrameworkMethod each : methods) {
        int modifiers = each.getMethod().getModifiers();
        if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
            return each;
        }
    }

    throw new Exception("No public static parameters method on class " + testClass.getName());
}
 
開發者ID:bkromhout,項目名稱:Minerva,代碼行數:13,代碼來源:ParameterizedRobolectricGradleTestRunner.java

示例4: getParametersMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
/**
 * @param testClass
 * @return
 */
protected FrameworkMethod getParametersMethod(TestClass testClass) throws Exception {
    List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Parameters.class);
    
    for (FrameworkMethod each : methods) {
        int modifiers = each.getMethod().getModifiers();
        if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
            return each;
        }

    }

    throw new Exception("No public static parameters method on class " + testClass.getName());
}
 
開發者ID:linux-china,項目名稱:unitils,代碼行數:18,代碼來源:UnitilsParameterized.java

示例5: getParametersMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
/**
 * @param testClass
 * @return the method annotated with {@link Parameters}
 * @throws Exception
 * 
 * @see Parameterized#allParameters()
 */
private static FrameworkMethod getParametersMethod(TestClass testClass) throws Exception {
	List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Parameters.class);
	for (FrameworkMethod each : methods) {
		if (each.isStatic() && each.isPublic()) {
			return each;
		}
	}

	throw new Exception("No public static parameters method on class " + testClass.getName());
}
 
開發者ID:PeterWippermann,項目名稱:parameterized-suite,代碼行數:18,代碼來源:ParameterizedUtil.java

示例6: getWorkflowsMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
public FrameworkMethod getWorkflowsMethod(TestClass testClass) throws Exception {
	List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Workflows.class);
	for (FrameworkMethod method : methods) {
		int modifiers = method.getMethod().getModifiers();
		if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
			return method;
		}
	}
	throw new Exception("No public static Workflows annotated method on class " + testClass.getName());
}
 
開發者ID:apache,項目名稱:incubator-taverna-commandline,代碼行數:11,代碼來源:WorkflowTestSuite.java

示例7: getObjectsMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
public static FrameworkMethod getObjectsMethod(TestClass testClass) throws Exception {
	List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Objects.class);
	for (FrameworkMethod each : methods) {
		int modifiers = each.getMethod().getModifiers();
		if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))
			return each;
	}

	throw new Exception("No public static parameters method on class " + testClass.getName());
}
 
開發者ID:TBMCPlugins,項目名稱:ButtonChat,代碼行數:11,代碼來源:ObjectTestRunner.java

示例8: getConfigMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
private static FrameworkMethod getConfigMethod(TestClass testClass) {
  List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Config.class);
  if (methods.isEmpty()) {
    throw new IllegalStateException("@" + Config.class.getSimpleName() + " method not found");
  }
  if (methods.size() > 1) {
    throw new IllegalStateException("Too many @" + Config.class.getSimpleName() + " methods");
  }
  FrameworkMethod method = methods.get(0);
  int modifiers = method.getMethod().getModifiers();
  if (!(Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))) {
    throw new IllegalStateException("@" + Config.class.getSimpleName() + " method \"" + method.getName() + "\" must be public static");
  }
  return method;
}
 
開發者ID:liveontologies,項目名稱:elk-reasoner,代碼行數:16,代碼來源:PolySuite.java

示例9: getParametersMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
static FrameworkMethod getParametersMethod(TestClass testClass)	throws Exception 
{
	List<FrameworkMethod> methods= testClass.getAnnotatedMethods(Parameterized.Parameters.class);
	for (FrameworkMethod each : methods) {
		int modifiers= each.getMethod().getModifiers();
		if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))
			return each;
	}

	throw new Exception("No public static parameters method on class " + testClass.getName());
}
 
開發者ID:kirilluk,項目名稱:statechum,代碼行數:12,代碼來源:ParameterizedWithName.java

示例10: getParametersToStringMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
static FrameworkMethod getParametersToStringMethod(TestClass testClass)	throws Exception 
{
	List<FrameworkMethod> methods= testClass.getAnnotatedMethods(ParametersToString.class);
	for (FrameworkMethod each : methods) {
		int modifiers= each.getMethod().getModifiers();
		if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))
			return each;
	}
	throw new Exception("No public static ParametersToString method on class " + testClass.getName());
}
 
開發者ID:kirilluk,項目名稱:statechum,代碼行數:11,代碼來源:ParameterizedWithName.java

示例11: invokeAfterClass

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
private void invokeAfterClass(final Class<?> clazz) throws Throwable {
  final TestClass testClass = new TestClass(clazz);
  final List<FrameworkMethod> afters = testClass.getAnnotatedMethods(AfterClass.class);
  for (FrameworkMethod after : afters) {
    after.invokeExplosively(null);
  }
}
 
開發者ID:qx,項目名稱:FullRobolectricTestSample,代碼行數:8,代碼來源:RobolectricTestRunner.java

示例12: invokeBeforeClass

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
private void invokeBeforeClass(final Class clazz) throws Throwable {
  if (!loadedTestClasses.contains(clazz)) {
    loadedTestClasses.add(clazz);

    final TestClass testClass = new TestClass(clazz);
    final List<FrameworkMethod> befores = testClass.getAnnotatedMethods(BeforeClass.class);
    for (FrameworkMethod before : befores) {
      before.invokeExplosively(null);
    }
  }
}
 
開發者ID:qx,項目名稱:FullRobolectricTestSample,代碼行數:12,代碼來源:RobolectricTestRunner.java

示例13: getParametersMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
private FrameworkMethod getParametersMethod() throws Exception {
  TestClass testClass = getTestClass();
  List<FrameworkMethod> methods = testClass.getAnnotatedMethods(Parameters.class);
  for (FrameworkMethod each : methods) {
    int modifiers = each.getMethod().getModifiers();
    if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers)) {
      return each;
    }
  }

  throw new Exception("No public static parameters method on class " + testClass.getName());
}
 
開發者ID:qx,項目名稱:FullRobolectricTestSample,代碼行數:13,代碼來源:ParameterizedRobolectricTestRunner.java

示例14: getParametersMethod

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
private FrameworkMethod getParametersMethod(TestClass testClass)
        throws Exception {
    List<FrameworkMethod> methods= testClass
            .getAnnotatedMethods(Parameters.class);
    for (FrameworkMethod each : methods) {
        int modifiers= each.getMethod().getModifiers();
        if (Modifier.isStatic(modifiers) && Modifier.isPublic(modifiers))
            return each;
    }

    throw new Exception("No public static parameters method on class "
            + testClass.getName());
}
 
開發者ID:reprogrammer,項目名稱:checker-framework,代碼行數:14,代碼來源:CheckerParameterized.java

示例15: getAnnotatedMethods

import org.junit.runners.model.TestClass; //導入方法依賴的package包/類
static private List<FrameworkMethod> getAnnotatedMethods(TestClass testClass) {
	return testClass.getAnnotatedMethods(TestWith.class); //TODO possible indirect invocation
}
 
開發者ID:piotrturski,項目名稱:zohhak,代碼行數:4,代碼來源:RunnerDelegator.java


注:本文中的org.junit.runners.model.TestClass.getAnnotatedMethods方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。