@Ignore({"why", "just because"}) Here's the updated annotation type declaration: package sis.testing; import java.lang.annotation.*; @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Ignore { String[] value(); } If you only need to supply a single string for an annotation type member with a return type of String[], Java allows you to eliminate the array-style initialization. These annotations for the current definition of @Ignore are equivalent: @Ignore("why") @Ignore({"why"}) You will need to modify TestRunnerTest to support the change to Ignore. package sis.testing; import java.util.*; import java.lang.reflect.*; public class TestRunnerTest { public static final String IGNORE_REASON1 = "because"; public static final String IGNORE_REASON2 = "why not"; ... @TestMethod public void ignoreMethodTest() { runTests(IgnoreMethodTest.class); verifyTests(methodNameA, methodNameB); assertIgnoreReasons(); } private void assertIgnoreReasons() { Map<Method, Ignore> ignoredMethods = runner.getIgnoredMethods(); Map.Entry<Method, Ignore> entry = getSoleEntry(ignoredMethods); assert "testC".equals(entry.getKey().getName()): "unexpected ignore method: " + entry.getKey(); Ignore ignore = entry.getValue(); String[] ignoreReasons = ignore.value(); assert 2 == ignoreReasons.length; assert IGNORE_REASON1.equals(ignoreReasons[0]); assert IGNORE_REASON2.equals(ignoreReasons[1]); } ... } class SingleMethodTest { @TestMethod public void testA() {} } class MultipleMethodTest { @TestMethod public void testA() {} @TestMethod public void testB() {} } class IgnoreMethodTest { @TestMethod public void testA() {} @TestMethod public void testB() {} @Ignore({TestRunnerTest.IGNORE_REASON1, TestRunnerTest.IGNORE_REASON2}) @TestMethod public void testC() {} } |