-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring and Test for ClassPathTree
- Loading branch information
Raquel Pau
committed
Apr 13, 2018
1 parent
67ea64a
commit ce6f96c
Showing
4 changed files
with
87 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/test/java/org/walkmod/javalang/compiler/types/PathTreeTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.walkmod.javalang.compiler.types; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.io.File; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
|
||
public class PathTreeTest { | ||
|
||
private static final String ROOT_KEY = "foo2"; | ||
private static final String PACKAGE = ROOT_KEY + File.separator + "bar"; | ||
private static final String HelloClassKey = PACKAGE + File.separator + "Hello.class"; | ||
private static final String ByeClassKey = PACKAGE + File.separator + "Bye.class"; | ||
|
||
@Test | ||
public void testInsertion() { | ||
|
||
PathTree<String> tree = createTreeWithData(); | ||
|
||
Assert.assertEquals(HelloClassKey, tree.get(HelloClassKey)); | ||
Assert.assertEquals(ByeClassKey, tree.get(ByeClassKey)); | ||
|
||
} | ||
|
||
private PathTree<String> createTreeWithData() { | ||
PathTree<String> tree = new PathTree<String>(); | ||
|
||
tree.put(HelloClassKey, HelloClassKey); | ||
tree.put(ByeClassKey, ByeClassKey); | ||
return tree; | ||
} | ||
|
||
@Test | ||
public void testList() { | ||
PathTree<String> tree = createTreeWithData(); | ||
List<String> result = tree.list(ROOT_KEY); | ||
Assert.assertTrue(result.isEmpty()); | ||
|
||
result = tree.list(PACKAGE); | ||
Assert.assertTrue(result.contains(HelloClassKey)); | ||
Assert.assertTrue(result.contains(ByeClassKey)); | ||
|
||
} | ||
|
||
} |