Skip to content

Commit

Permalink
remove TODO and adjust custom Providers / Extensions (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaschmid committed Jan 14, 2018
1 parent 98e8825 commit 91253de
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ public static List<Class<?>> generateLocations(Class<?> testClass, Class<?>... e
private final Class<? extends Annotation> dataProviderAnnotationClass;
private final String dataProviderName;

// TODO refactor above ... whats a good solution?
/**
* @param testMethod for which a dataprovider should be resolved
* @param resolverClasses to use for resolving dataproviders
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tngtech.test.junit.dataprovider.custom.meta;

import static com.tngtech.junit.dataprovider.resolver.DataProviderResolverContext.generateLocations;
import static java.util.Arrays.asList;

import org.junit.jupiter.api.extension.ExtensionContext;
Expand All @@ -25,7 +26,9 @@ public void accept(DataProviderTest sourceAnnotation) {
protected DataProviderResolverContext getDataProviderResolverContext(ExtensionContext extensionContext,
DataProviderTest annotation) {
return new DataProviderResolverContext(extensionContext.getRequiredTestMethod(), asList(annotation.resolver()),
annotation.resolveStrategy(), asList(annotation.location()), DataProvider.class, annotation.value());
annotation.resolveStrategy(),
generateLocations(extensionContext.getRequiredTestClass(), annotation.location()),
DataProvider.class, annotation.value());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tngtech.test.junit.dataprovider.custom.resolver;

import static com.tngtech.junit.dataprovider.resolver.DataProviderResolverContext.generateLocations;
import static java.util.Arrays.asList;

import org.junit.jupiter.api.extension.ExtensionContext;
Expand All @@ -26,7 +27,9 @@ public void accept(CustomResolverUseDataProvider sourceAnnotation) {
protected DataProviderResolverContext getDataProviderResolverContext(ExtensionContext extensionContext,
CustomResolverUseDataProvider annotation) {
return new DataProviderResolverContext(extensionContext.getRequiredTestMethod(), asList(annotation.resolver()),
annotation.resolveStrategy(), asList(annotation.location()), DataProvider.class, annotation.value());
annotation.resolveStrategy(),
generateLocations(extensionContext.getRequiredTestClass(), annotation.location()),
DataProvider.class, annotation.value());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tngtech.test.junit.dataprovider.custom.meta;

import static com.tngtech.junit.dataprovider.resolver.DataProviderResolverContext.generateLocations;
import static java.util.Arrays.asList;

import org.junit.jupiter.api.extension.ExtensionContext;
Expand All @@ -21,7 +22,9 @@ class DataProviderTestExtension extends UseDataProviderInvocationContextProvider
protected DataProviderResolverContext getDataProviderResolverContext(ExtensionContext extensionContext,
DataProviderTest annotation) {
return new DataProviderResolverContext(extensionContext.getRequiredTestMethod(), asList(annotation.resolver()),
annotation.resolveStrategy(), asList(annotation.location()), DataProvider.class, annotation.value());
annotation.resolveStrategy(),
generateLocations(extensionContext.getRequiredTestClass(), annotation.location()), DataProvider.class,
annotation.value());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.tngtech.test.junit.dataprovider.custom.resolver;

import static com.tngtech.junit.dataprovider.resolver.DataProviderResolverContext.generateLocations;
import static java.util.Arrays.asList;

import org.junit.jupiter.api.extension.ExtensionContext;
Expand All @@ -22,7 +23,9 @@ class CustomResolverDataProviderTestExtension
protected DataProviderResolverContext getDataProviderResolverContext(ExtensionContext extensionContext,
CustomResolverDataProviderTest annotation) {
return new DataProviderResolverContext(extensionContext.getRequiredTestMethod(), asList(annotation.resolver()),
annotation.resolveStrategy(), asList(annotation.location()), DataProvider.class, annotation.value());
annotation.resolveStrategy(),
generateLocations(extensionContext.getRequiredTestClass(), annotation.location()),
DataProvider.class, annotation.value());
}

@Override
Expand Down

0 comments on commit 91253de

Please sign in to comment.