Skip to content

Commit

Permalink
Add test that checks if parent is not a package.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhafner committed Nov 27, 2023
1 parent 0c3ffcd commit d6175cc
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/test/java/edu/hm/hafner/coverage/ClassNodeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import org.junit.jupiter.api.Test;

import edu.hm.hafner.coverage.TestCase.TestCaseBuilder;
import edu.hm.hafner.util.TreeString;

import static edu.hm.hafner.coverage.assertions.Assertions.*;

Expand Down Expand Up @@ -55,5 +56,10 @@ void shouldHavePackageName() {

packageNode.addChild(classWithoutPackage);
assertThat(classWithoutPackage.getPackageName()).isEqualTo("edu.hm");

var another = new ClassNode("Class");
var file = new FileNode("a.b.c.file.txt", TreeString.valueOf("/path/to/file.txt"));
file.addChild(another);
assertThat(another.getPackageName()).isEqualTo(Node.EMPTY_NAME);
}
}

0 comments on commit d6175cc

Please sign in to comment.