diff --git a/src/main/java/org/smartregister/model/location/LocationHierarchyTree.java b/src/main/java/org/smartregister/model/location/LocationHierarchyTree.java index 721b596..48b8d24 100755 --- a/src/main/java/org/smartregister/model/location/LocationHierarchyTree.java +++ b/src/main/java/org/smartregister/model/location/LocationHierarchyTree.java @@ -58,12 +58,9 @@ public void addLocation(Location location) { * @param locations */ public void buildTreeFromList(List locations) { - long start = System.currentTimeMillis(); for (Location location : locations) { addLocation(location); } - logger.info(String.format("LocationHierarchyTree.buildTreeFromList took : %d ms", System.currentTimeMillis() - start)); - } public Tree getLocationsHierarchy() { diff --git a/src/main/java/org/smartregister/model/location/Tree.java b/src/main/java/org/smartregister/model/location/Tree.java index 9628993..420fdb6 100755 --- a/src/main/java/org/smartregister/model/location/Tree.java +++ b/src/main/java/org/smartregister/model/location/Tree.java @@ -32,7 +32,6 @@ import java.util.Optional; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.atomic.AtomicReference; -import java.util.logging.Logger; @DatatypeDef(name = "Tree") public class Tree extends Type implements ICompositeType { @@ -52,8 +51,6 @@ public class Tree extends Type implements ICompositeType { summary = false) private List parentChildren; - private static final Logger logger = Logger.getLogger(Tree.class.getSimpleName()); - public SingleTreeNode getTree() { return listOfNodes; } @@ -143,7 +140,7 @@ public void addNode(String id, String label, Location node, String parentId) { } } else { - logger.severe("Node with ID " + id + " already exists in tree"); + throw new IllegalArgumentException("Node with ID " + id + " already exists in tree"); } } diff --git a/src/test/java/org/smartregister/model/location/LocationHierarchyTreeTest.java b/src/test/java/org/smartregister/model/location/LocationHierarchyTreeTest.java index 4c2e3ad..960edf4 100644 --- a/src/test/java/org/smartregister/model/location/LocationHierarchyTreeTest.java +++ b/src/test/java/org/smartregister/model/location/LocationHierarchyTreeTest.java @@ -18,7 +18,6 @@ import org.hl7.fhir.r4.model.Location; import org.hl7.fhir.r4.model.Reference; import org.junit.Test; -import org.smartregister.model.location.utils.TestUtils; import java.util.ArrayList; import java.util.List; @@ -52,10 +51,9 @@ public void testAddLocationWithoutChildLocations() { @Test public void testBuildTreeFromList() { - List locationList = TestUtils.getTestLocations(); + List locationList = getLocationList(); LocationHierarchyTree locationHierarchyTree = new LocationHierarchyTree(); locationHierarchyTree.buildTreeFromList(locationList); - Tree tree = locationHierarchyTree.getLocationsHierarchy(); assertNotNull(tree); assertNotNull(tree.getTree()); diff --git a/src/test/java/org/smartregister/model/location/utils/TestUtils.java b/src/test/java/org/smartregister/model/location/utils/TestUtils.java index d5c03f0..b61f5a5 100644 --- a/src/test/java/org/smartregister/model/location/utils/TestUtils.java +++ b/src/test/java/org/smartregister/model/location/utils/TestUtils.java @@ -14,7 +14,6 @@ public static List getTestLocations() { List locationList = new ArrayList<>(); - int parentId = 1; for (Integer i = 1; i < TOTAL_LOCATIONS + 1; i++) {