Permalink
Browse files

identify Suite even before child is added

  • Loading branch information...
schaarsc committed Sep 1, 2012
1 parent 9dd0494 commit 845139bafb00a982a5732bfdbc965b1d27fef128
@@ -179,7 +179,7 @@ public boolean isSuite() {
* @return <code>true</code> if the receiver is an atomic test
*/
public boolean isTest() {
- return getChildren().isEmpty();
+ return getMethodName() != null;
}
/**
@@ -0,0 +1,19 @@
+package junit.tests.runner;
+
+import java.text.Annotation;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.junit.runner.Description;
+
+public class DescriptionTest {
+
+ @Test public void testIsSuite() {
+ Description d = Description.createSuiteDescription("SuiteName", new Annotation[0]);
+ Assert.assertTrue(d.isSuite());
+ Description m = Description.createTestDescription("TestClass", "testMethod", new Annotation[0]);
+ d.addChild(m);
+ Assert.assertTrue(d.isSuite());
+ }
+}

0 comments on commit 845139b

Please sign in to comment.