Project

General

Profile

« Previous | Next » 

Revision fadab744

Added by Andreas Kohlbecker about 6 years ago

ref #7347 refacoring of the dataportal test suite for more flexibility

View differences:

src/main/java/eu/etaxonomy/dataportal/junit/DataPortalContextSuite.java
21 21
import org.junit.runners.model.Statement;
22 22

  
23 23
import eu.etaxonomy.dataportal.DataPortalContext;
24
import eu.etaxonomy.dataportal.DataPortalSite;
24 25

  
25 26

  
26 27
/**
......
39 40
	@Inherited
40 41
	public @interface DataPortalContexts {
41 42
		/**
42
		 * @return an array of DataPortalContext to which the annotated test
43
		 * @return an array of DataPortalSite to which the annotated test
43 44
		 *         class is applicable
44 45
		 */
45
		DataPortalContext[] value();
46
		DataPortalSite[] value();
46 47
	}
47 48

  
48 49
	private final List<Runner> runners = new ArrayList<Runner>();
......
67 68

  
68 69
		@Override
69 70
		protected String getName() {
70
			return String.format("%s@%s", getTestClass().getName(), context.name());
71
			return String.format("%s@%s", getTestClass().getName(), context.getSiteLabel());
71 72
		}
72 73

  
73 74
		@Override
74 75
		protected String testName(final FrameworkMethod method) {
75
			return String.format("%s@%s", method.getName(), context.name());
76
			return String.format("%s@%s", method.getName(), context.getSiteLabel());
76 77

  
77 78
		}
78 79

  
......
102 103
	public DataPortalContextSuite(Class<?> klass) throws InitializationError {
103 104
		super(klass, Collections.<Runner>emptyList());
104 105
		DataPortalContexts dataPortalContextsAnotation = getTestClass().getJavaClass().getAnnotation(DataPortalContexts.class);
105
		for (DataPortalContext cntxt : dataPortalContextsAnotation.value()) {
106
			runners.add(new TestClassRunnerWithDataPortalContext(klass, cntxt));
106
		for (DataPortalSite dataPortalSite : dataPortalContextsAnotation.value()) {
107
			runners.add(new TestClassRunnerWithDataPortalContext(klass, dataPortalSite.getContext()));
107 108
		}
108 109
	}
109 110

  

Also available in: Unified diff