DataProviderResolverContext { public static List<Class<?>> generateLocations(Class<?> testClass, Class<?>... explicitLocations) { checkNotNull(testClass, "'testClass' must not be null"); if (explicitLocations == null || explicitLocations.length == 0) { @SuppressWarnings({ "rawtypes", "unchecked" }) List<Class<?>> result = (List) Collections.singletonList(testClass); return result; } return Arrays.asList(explicitLocations); } DataProviderResolverContext(Method testMethod,
            List<Class<? extends DataProviderMethodResolver>> resolverClasses, ResolveStrategy resolveStrategy,
            List<Class<?>> locations, Class<? extends Annotation> dataProviderAnnotationClass,
            String dataProviderName); static List<Class<?>> generateLocations(Class<?> testClass, Class<?>... explicitLocations); boolean useDataProviderNameConvention(); Method getTestMethod(); List<Class<? extends DataProviderMethodResolver>> getResolverClasses(); ResolveStrategy getResolveStrategy(); List<Class<?>> getLocations(); Class<? extends Annotation> getDataProviderAnnotationClass(); String getDataProviderName(); static final String METHOD_NAME_TO_USE_CONVENTION; }
@Test public void testGenerateLocationsShouldThrowNullPointerExceptionIfTestClassIsNull() { expectedException.expect(NullPointerException.class); expectedException.expectMessage("'testClass' must not be null"); DataProviderResolverContext.generateLocations(null); }
@Test public void testGenerateLocationsShouldReturnExplicitLocationsIfNotNull() { Class<?>[] explicitLocations = { SingleArgConverter.class, StringConverter.class }; List<Class<?>> result = DataProviderResolverContext.generateLocations(this.getClass(), explicitLocations); assertThat(result).containsExactly(explicitLocations); }
@Test public void testGenerateLocationsShouldReturnTestClassIfExplicitLocationsAreNull() { Class<?>[] explicitLocations = null; List<Class<?>> result = DataProviderResolverContext.generateLocations(this.getClass(), explicitLocations); assertThat(result).containsOnly(this.getClass()); }
@Test public void testGenerateLocationsShouldReturnTestClassIfExplicitLocationsAreEmpty() { Class<?>[] explicitLocations = {}; List<Class<?>> result = DataProviderResolverContext.generateLocations(this.getClass(), explicitLocations); assertThat(result).containsOnly(this.getClass()); }