Skip to content

Commit

Permalink
identify Suite even before child is added
Browse files Browse the repository at this point in the history
  • Loading branch information
schaarsc committed Sep 1, 2012
1 parent 9dd0494 commit 845139b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/org/junit/runner/Description.java
Expand Up @@ -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;
}

/**
Expand Down
19 changes: 19 additions & 0 deletions src/test/java/junit/tests/runner/DescriptionTest.java
@@ -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.