DefaultDataProviderMethodResolver extends com.tngtech.junit.dataprovider.resolver.DefaultDataProviderMethodResolver implements DataProviderMethodResolver { protected List<TestClass> findDataProviderLocations(FrameworkMethod testMethod, Class<?>[] useDataProviderLocation) { if (useDataProviderLocation.length == 0) { return singletonList(new TestClass(testMethod.getMethod().getDeclaringClass())); } List<TestClass> result = new ArrayList<TestClass>(); for (Class<?> location : useDataProviderLocation) { result.add(new TestClass(location)); } return result; }  @Override List<FrameworkMethod> resolve(FrameworkMethod testMethod, UseDataProvider useDataProvider);  }
@Test public void testFindDataProviderLocationsShouldReturnTestClassForNotSetLocationInUseDataProviderAnnotation() { when(testMethod.getMethod()).thenReturn( getMethod("testFindDataProviderLocationsShouldReturnTestClassForNotSetLocationInUseDataProviderAnnotation")); List<TestClass> result = underTest.findDataProviderLocations(testMethod, new Class<?>[0]); assertThatResultContainsCorrectClassesExactlyInOrder(result, this.getClass()); }
@Test public void testFindDataProviderLocationsShouldReturnTestClassContainingSetLocationInUseDataProviderAnnotation() { List<TestClass> result = underTest.findDataProviderLocations(testMethod, new Class<?>[] { DataConverterTest.class }); assertThatResultContainsCorrectClassesExactlyInOrder(result, DataConverterTest.class); }
@Test public void testFindDataProviderLocationsShouldReturnTestClassesContainingSetLocationsInUseDataProviderAnnotation() { final Class<?>[] locations = new Class<?>[] { DataConverterTest.class, TestGeneratorTest.class, TestValidatorTest.class }; List<TestClass> result = underTest.findDataProviderLocations(testMethod, locations); assertThatResultContainsCorrectClassesExactlyInOrder(result, locations); }