@Nullable private MethodInfo createMethod(String name, MethodKind kind) { Method reflection = findMethod(name); if (reflection == null) return null; return createMethod(reflection, kind, name); }
private void buildInitializerMethods() { MethodInfo initializerMethod = createMethod(InternalIdentifiers.INITIALIZER_METHOD, MethodKind.INITIALIZER); if (initializerMethod != null) spec.setInitializerMethod(initializerMethod); MethodInfo sharedInitializerMethod = createMethod(InternalIdentifiers.SHARED_INITIALIZER_METHOD, MethodKind.SHARED_INITIALIZER); if (sharedInitializerMethod != null) spec.setSharedInitializerMethod(sharedInitializerMethod); }
private MethodInfo createJUnitFixtureMethod(Method method, MethodKind kind, Class<? extends Annotation> annotation) { MethodInfo methodInfo = createMethod(method, kind, method.getName()); methodInfo.setExcluded(isOverriddenJUnitFixtureMethod(method, annotation)); return methodInfo; }
private void buildFixtureMethods() { MethodInfo cleanupMethod = createMethod(Identifiers.CLEANUP_METHOD, MethodKind.CLEANUP); if (cleanupMethod != null) spec.addCleanupMethod(cleanupMethod); MethodInfo cleanupSpecMethod = createMethod(Identifiers.CLEANUP_SPEC_METHOD, MethodKind.CLEANUP_SPEC); if (cleanupSpecMethod != null) spec.addCleanupSpecMethod(cleanupSpecMethod); for (Method method : clazz.getDeclaredMethods()) { if (method.isAnnotationPresent(Before.class)) { spec.addSetupMethod(createJUnitFixtureMethod(method, MethodKind.SETUP, Before.class)); } if (method.isAnnotationPresent(After.class)) { spec.addCleanupMethod(createJUnitFixtureMethod(method, MethodKind.CLEANUP, After.class)); } if (method.isAnnotationPresent(BeforeClass.class)) { spec.addSetupSpecMethod(createJUnitFixtureMethod(method, MethodKind.SETUP_SPEC, BeforeClass.class)); } if (method.isAnnotationPresent(AfterClass.class)) { spec.addCleanupSpecMethod(createJUnitFixtureMethod(method, MethodKind.CLEANUP_SPEC, AfterClass.class)); } } MethodInfo setupMethod = createMethod(Identifiers.SETUP_METHOD, MethodKind.SETUP); if (setupMethod != null) spec.addSetupMethod(setupMethod); MethodInfo setupSpecMethod = createMethod(Identifiers.SETUP_SPEC_METHOD, MethodKind.SETUP_SPEC); if (setupSpecMethod != null) spec.addSetupSpecMethod(setupSpecMethod); }
MethodInfo dataProcessorMethod = createMethod(processorMethodName, MethodKind.DATA_PROCESSOR); int providerCount = 0; String providerMethodName = InternalIdentifiers.getDataProviderName(method.getName(), providerCount++); MethodInfo providerMethod = createMethod(providerMethodName, MethodKind.DATA_PROVIDER); while (providerMethod != null) { feature.addDataProvider(createDataProvider(feature, providerMethod)); providerMethodName = InternalIdentifiers.getDataProviderName(method.getName(), providerCount++); providerMethod = createMethod(providerMethodName, MethodKind.DATA_PROVIDER);