From 4ee9e87fbc8d1b935e6f9aa46f22dc076cd704b3 Mon Sep 17 00:00:00 2001 From: himeshr Date: Mon, 28 Oct 2024 12:01:11 +0530 Subject: [PATCH] #785 | check for fetching exact lineage addressLevel when there are more than one address level with same title for a given addressLevelType in different lineages --- .../service/AddressLevelServiceIntegrationTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java index 0c4d34db7..a58f86dd4 100644 --- a/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java +++ b/avni-server-api/src/test/java/org/avni/server/service/AddressLevelServiceIntegrationTest.java @@ -61,6 +61,10 @@ public void findByAddressMap() { AddressLevel gp2AddressLevel = testLocationService.save(new AddressLevelBuilder().withUuid("gp2").title("gp2").type(grandParent).build()); AddressLevel parent2AddressLevel = testLocationService.save(new AddressLevelBuilder().withUuid("parent2").title("parent2").type(parent).parent(gp2AddressLevel).build()); AddressLevel child2AddressLevel = testLocationService.save(new AddressLevelBuilder().withUuid("child2").title("child2").type(child).parent(parent2AddressLevel).build()); +// AddressLevel gp3AddressLevel = testLocationService.save(new AddressLevelBuilder().withUuid("gp3").title("gp3").type(grandParent).build()); +// AddressLevel parent3AddressLevel = testLocationService.save(new AddressLevelBuilder().withUuid("parent3").title("parent2").type(parent).parent(gp3AddressLevel).build()); +// AddressLevel child3AddressLevel = testLocationService.save(new AddressLevelBuilder().withUuid("child3").title("child1").type(child).parent(parent3AddressLevel).build()); + Map addressLevelMap = new HashMap<>(); //valid hierarchy @@ -86,5 +90,13 @@ public void findByAddressMap() { //partial hierarchy addressLevelMap.remove(grandParent.getName()); assertEquals(Optional.empty(), addressLevelService.findByAddressMap(addressLevelMap)); + +// //valid locations in valid hierarchy and related, but with duplicate title +// addressLevelMap.put(grandParent.getName(), gp3AddressLevel.getTitle()); +// assertEquals(Optional.empty(), addressLevelService.findByAddressMap(addressLevelMap)); +// addressLevelMap.put(parent.getName(), parent3AddressLevel.getTitle()); +// assertEquals(Optional.empty(), addressLevelService.findByAddressMap(addressLevelMap)); +// addressLevelMap.put(child.getName(), child3AddressLevel.getTitle()); +// assertEquals(child3AddressLevel, addressLevelService.findByAddressMap(addressLevelMap).get()); } }