1.1 --- a/rt/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/VMTest.java Mon Apr 29 10:04:53 2013 +0200
1.2 +++ b/rt/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/VMTest.java Mon May 26 14:33:11 2014 +0200
1.3 @@ -17,6 +17,7 @@
1.4 */
1.5 package org.apidesign.bck2brwsr.vmtest;
1.6
1.7 +import java.lang.annotation.Annotation;
1.8 import java.util.ArrayList;
1.9 import java.util.Arrays;
1.10 import java.util.List;
1.11 @@ -39,6 +40,7 @@
1.12 public final class VMTest {
1.13 private final List<Class> classes = new ArrayList<>();
1.14 private final List<String> launcher = new ArrayList<>();
1.15 + private Class<? extends Annotation> annotation = BrwsrTest.class;
1.16
1.17 private VMTest() {
1.18 }
1.19 @@ -104,6 +106,24 @@
1.20 this.launcher.addAll(Arrays.asList(launcher));
1.21 return this;
1.22 }
1.23 +
1.24 + /** Specifies which annotation annotates the test methods
1.25 + * to be executed. By
1.26 + * default it is the {@link BrwsrTest} annotation. Methods in
1.27 + * {@link #withClasses(java.lang.Class[]) test classes} annotated by
1.28 + * this annotation will be executed.
1.29 + *
1.30 + * @param aClass an annotation class
1.31 + * @return this
1.32 + * @since 0.8
1.33 + */
1.34 + public final VMTest withTestAnnotation(Class<? extends Annotation> aClass) {
1.35 + if (!aClass.isAnnotation()) {
1.36 + throw new IllegalStateException();
1.37 + }
1.38 + this.annotation = aClass;
1.39 + return this;
1.40 + }
1.41
1.42 /** Assembles the provided information into the final array of tests.
1.43 * @return array of TestNG tests
1.44 @@ -112,7 +132,8 @@
1.45 public final Object[] build() {
1.46 return CompareCase.create(
1.47 launcher.toArray(new String[0]),
1.48 - classes.toArray(new Class[0])
1.49 + classes.toArray(new Class[0]),
1.50 + annotation
1.51 );
1.52 }
1.53 }