@Test
  public void test() throws JSONException {
    User u =
        new User()
            .withBaseEntity(
                new BaseEntity().withAttribute("Location", "cd4ed528-87cd-42ee-a175-5e7089521ebd"));
    when(auth.getDrishtiUser(any(Authentication.class))).thenReturn(u);
    when(controller.currentUser()).thenReturn(u);
    JSONObject to =
        new JSONObject(
            "{\"teamMemberId\":\"1\",\"identifier\":\"7869\",\"isTeamLead\":\"false\",\"person\":{\"uuid\":\"bc3245ed-ecac-4afa-842c-8f8a7a242639\",\"display\":\"Ebad Ahmed Ezam\",\"gender\":\"Male\",\"birthdateEstimated\":\"false\",\"dead\":\"false\",\"preferredName\":{\"uuid\":\"7dacabb7-ad79-4e4d-874c-c61b3fc91f02\",\"display\":\"Ebad Ahmed Ezam\",},\"voided\":\"false\"},\"uuid\":\"6bd9a982-77d4-42ee-88a5-8c511719214a\",\"location\":{\"location\":{\"uuid\":\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\",\"display\":\"Karachi\",\"name\":\"Karachi\",\"tags\":{\"locationtag\":{\"uuid\":\"2db4a766-eba2-4780-91ff-e601193a86f2\",\"display\":\"City\",\"links\":{\"link\":{\"rel\":\"self\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/locationtag/2db4a766-eba2-4780-91ff-e601193a86f2 \"}}}},\"parentLocation\":{\"uuid\":\"461f2be7-c95d-433c-b1d7-c68f272409d7\",\"display\":\"Sindh\",\"links\":{\"link\":{\"rel\":\"self\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/location/461f2be7-c95d-433c-b1d7-c68f272409d7 \"}}},\"childLocations\":{\"location\":{\"uuid\":\"60c21502-fec1-40f5-b77d-6df3f92771ce\",\"display\":\"Baldia\",\"links\":{\"link\":{\"rel\":\"self\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/location/60c21502-fec1-40f5-b77d-6df3f92771ce \"}}}},\"retired\":\"false\",\"links\":{\"link\":[{\"rel\":\"self\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/location/a529e2fc-6f0d-4e60-a5df-789fe17cca48 \"},{\"rel\":\"full\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/location/a529e2fc-6f0d-4e60-a5df-789fe17cca48?v=full \"}]},\"resourceVersion\":\"1.9\"}},\"team\":{\"display\":\"TBR3-team1\",\"teamIdentifier\":\"1234\",\"teamName\":\"TBR3-team1\",\"uuid\":\"97ba7a47-58bd-4d9f-96d6-aaaa5c7b6cf0\",\"dateCreated\":\"2015-05-08T01:46:54.000-0400\",\"location\":{\"uuid\":\"765cb701-9e61-4ead-afb9-a63c943f4f14\",\"display\":\"Korangi\",\"name\":\"Korangi\",\"tags\":{\"locationtag\":{\"uuid\":\"295bfa65-859e-4e52-9a89-63393139df1e\",\"display\":\"Town\",\"links\":{\"link\":{\"rel\":\"self\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/locationtag/295bfa65-859e-4e52-9a89-63393139df1e \"}}}},\"retired\":\"false\",\"links\":{\"link\":[{\"rel\":\"self\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/location/765cb701-9e61-4ead-afb9-a63c943f4f14 \"},{\"rel\":\"full\",\"uri\":\" NEED-TO-CONFIGURE/ws/rest/v1/location/765cb701-9e61-4ead-afb9-a63c943f4f14?v=full \"}]}}}}");

    doReturn(to).when(userservice).getTeamMember(any(String.class));
    LocationTree ltree =
        new Gson()
            .fromJson(
                "{\"locationsHierarchy\":{\"map\":{\"215caa30-1906-4210-8294-23eb7914c1dd\":{\"id\":\"215caa30-1906-4210-8294-23eb7914c1dd\",\"label\":\"3-KHA\",\"node\":{\"locationId\":\"215caa30-1906-4210-8294-23eb7914c1dd\",\"name\":\"3-KHA\",\"parentLocation\":{\"locationId\":\"1ccb61b5-022f-4735-95b4-1c57e9f7938f\",\"name\":\"Ward-3\",\"parentLocation\":{\"locationId\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"name\":\"KUPTALA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"4ccd5a33-c462-4b53-b8c1-a1ad1c3ba0cf\":{\"id\":\"4ccd5a33-c462-4b53-b8c1-a1ad1c3ba0cf\",\"label\":\"DURGAPUR\",\"node\":{\"locationId\":\"4ccd5a33-c462-4b53-b8c1-a1ad1c3ba0cf\",\"name\":\"DURGAPUR\",\"parentLocation\":{\"locationId\":\"215caa30-1906-4210-8294-23eb7914c1dd\",\"name\":\"3-KHA\",\"parentLocation\":{\"locationId\":\"1ccb61b5-022f-4735-95b4-1c57e9f7938f\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"215caa30-1906-4210-8294-23eb7914c1dd\"}},\"parent\":\"1ccb61b5-022f-4735-95b4-1c57e9f7938f\"},\"429feb8b-0b8d-4496-8e54-fdc94affed07\":{\"id\":\"429feb8b-0b8d-4496-8e54-fdc94affed07\",\"label\":\"1-KHA\",\"node\":{\"locationId\":\"429feb8b-0b8d-4496-8e54-fdc94affed07\",\"name\":\"1-KHA\",\"parentLocation\":{\"locationId\":\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\",\"name\":\"Ward-1\",\"parentLocation\":{\"locationId\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"name\":\"KUPTALA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"9047a5e3-66cf-4f83-b0b6-3cdd3d611272\":{\"id\":\"9047a5e3-66cf-4f83-b0b6-3cdd3d611272\",\"label\":\"Chapadaha Mauza\",\"node\":{\"locationId\":\"9047a5e3-66cf-4f83-b0b6-3cdd3d611272\",\"name\":\"Chapadaha Mauza\",\"parentLocation\":{\"locationId\":\"429feb8b-0b8d-4496-8e54-fdc94affed07\",\"name\":\"1-KHA\",\"parentLocation\":{\"locationId\":\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\",\"name\":\"Ward-1\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"429feb8b-0b8d-4496-8e54-fdc94affed07\"},\"a8b7d760-0e7e-4fdb-9450-b41d31d1ec34\":{\"id\":\"a8b7d760-0e7e-4fdb-9450-b41d31d1ec34\",\"label\":\"Kuptala-1-KHA\",\"node\":{\"locationId\":\"a8b7d760-0e7e-4fdb-9450-b41d31d1ec34\",\"name\":\"Kuptala-1-KHA\",\"parentLocation\":{\"locationId\":\"429feb8b-0b8d-4496-8e54-fdc94affed07\",\"name\":\"1-KHA\",\"parentLocation\":{\"locationId\":\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\",\"name\":\"Ward-1\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"429feb8b-0b8d-4496-8e54-fdc94affed07\"}},\"parent\":\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\"},\"f2f803d5-857a-42a4-a05b-142c3327b4fc\":{\"id\":\"f2f803d5-857a-42a4-a05b-142c3327b4fc\",\"label\":\"SONORAY\",\"node\":{\"locationId\":\"f2f803d5-857a-42a4-a05b-142c3327b4fc\",\"name\":\"SONORAY\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"e0d50bc5-09b2-4102-809d-687fe71d5fd0\":{\"id\":\"e0d50bc5-09b2-4102-809d-687fe71d5fd0\",\"label\":\"SARBANANDA\",\"node\":{\"locationId\":\"e0d50bc5-09b2-4102-809d-687fe71d5fd0\",\"name\":\"SARBANANDA\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\":{\"id\":\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\",\"label\":\"2-KHA\",\"node\":{\"locationId\":\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\",\"name\":\"2-KHA\",\"parentLocation\":{\"locationId\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\",\"name\":\"Ward-2\",\"parentLocation\":{\"locationId\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"name\":\"KUPTALA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"3a041478-5d39-4d42-b785-67c2ae56febb\":{\"id\":\"3a041478-5d39-4d42-b785-67c2ae56febb\",\"label\":\"Kuptala-2KHA\",\"node\":{\"locationId\":\"3a041478-5d39-4d42-b785-67c2ae56febb\",\"name\":\"Kuptala-2KHA\",\"parentLocation\":{\"locationId\":\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\",\"name\":\"2-KHA\",\"parentLocation\":{\"locationId\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\",\"name\":\"Ward-2\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\"},\"27e6d636-0683-4539-90b8-2c795318dc08\":{\"id\":\"27e6d636-0683-4539-90b8-2c795318dc08\",\"label\":\"BERADANGA\",\"node\":{\"locationId\":\"27e6d636-0683-4539-90b8-2c795318dc08\",\"name\":\"BERADANGA\",\"parentLocation\":{\"locationId\":\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\",\"name\":\"2-KHA\",\"parentLocation\":{\"locationId\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\",\"name\":\"Ward-2\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\"}},\"parent\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\"},\"5d0661b5-4868-49eb-a697-e4dc4348dfab\":{\"id\":\"5d0661b5-4868-49eb-a697-e4dc4348dfab\",\"label\":\"SHANTIRAM\",\"node\":{\"locationId\":\"5d0661b5-4868-49eb-a697-e4dc4348dfab\",\"name\":\"SHANTIRAM\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"f48a6482-2ffd-4596-8d9b-46dadc3c73df\":{\"id\":\"f48a6482-2ffd-4596-8d9b-46dadc3c73df\",\"label\":\"SRIPUR\",\"node\":{\"locationId\":\"f48a6482-2ffd-4596-8d9b-46dadc3c73df\",\"name\":\"SRIPUR\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"42423d74-a061-463b-93a1-2f773f0aae21\":{\"id\":\"42423d74-a061-463b-93a1-2f773f0aae21\",\"label\":\"1-KA\",\"node\":{\"locationId\":\"42423d74-a061-463b-93a1-2f773f0aae21\",\"name\":\"1-KA\",\"parentLocation\":{\"locationId\":\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\",\"name\":\"Ward-1\",\"parentLocation\":{\"locationId\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"name\":\"KUPTALA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"88abc9f1-d698-41e3-8e2d-0c900b16dfe6\":{\"id\":\"88abc9f1-d698-41e3-8e2d-0c900b16dfe6\",\"label\":\"Kuptala-1-KA\",\"node\":{\"locationId\":\"88abc9f1-d698-41e3-8e2d-0c900b16dfe6\",\"name\":\"Kuptala-1-KA\",\"parentLocation\":{\"locationId\":\"42423d74-a061-463b-93a1-2f773f0aae21\",\"name\":\"1-KA\",\"parentLocation\":{\"locationId\":\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\",\"name\":\"Ward-1\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"42423d74-a061-463b-93a1-2f773f0aae21\"}},\"parent\":\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\"},\"dff51374-be72-46cb-a9a3-c7989e24430c\":{\"id\":\"dff51374-be72-46cb-a9a3-c7989e24430c\",\"label\":\"DHOPADANGA\",\"node\":{\"locationId\":\"dff51374-be72-46cb-a9a3-c7989e24430c\",\"name\":\"DHOPADANGA\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"e8e88d43-e181-42f1-9de5-143149922eea\":{\"id\":\"e8e88d43-e181-42f1-9de5-143149922eea\",\"label\":\"RAMJIBAN\",\"node\":{\"locationId\":\"e8e88d43-e181-42f1-9de5-143149922eea\",\"name\":\"RAMJIBAN\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"d3367458-f5e5-4039-b1e7-f087cc5be3fa\":{\"id\":\"d3367458-f5e5-4039-b1e7-f087cc5be3fa\",\"label\":\"KANCHIBARI\",\"node\":{\"locationId\":\"d3367458-f5e5-4039-b1e7-f087cc5be3fa\",\"name\":\"KANCHIBARI\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"fa32786b-4063-4f39-b72d-a5bc0e549193\":{\"id\":\"fa32786b-4063-4f39-b72d-a5bc0e549193\",\"label\":\"3-KA\",\"node\":{\"locationId\":\"fa32786b-4063-4f39-b72d-a5bc0e549193\",\"name\":\"3-KA\",\"parentLocation\":{\"locationId\":\"1ccb61b5-022f-4735-95b4-1c57e9f7938f\",\"name\":\"Ward-3\",\"parentLocation\":{\"locationId\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"name\":\"KUPTALA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"f872c792-32ac-49e7-a386-f6b968968ef1\":{\"id\":\"f872c792-32ac-49e7-a386-f6b968968ef1\",\"label\":\"Kuptala-3-KA\",\"node\":{\"locationId\":\"f872c792-32ac-49e7-a386-f6b968968ef1\",\"name\":\"Kuptala-3-KA\",\"parentLocation\":{\"locationId\":\"fa32786b-4063-4f39-b72d-a5bc0e549193\",\"name\":\"3-KA\",\"parentLocation\":{\"locationId\":\"1ccb61b5-022f-4735-95b4-1c57e9f7938f\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"fa32786b-4063-4f39-b72d-a5bc0e549193\"}},\"parent\":\"1ccb61b5-022f-4735-95b4-1c57e9f7938f\"},\"765cb701-9e61-4ead-afb9-a63c943f4f14\":{\"id\":\"765cb701-9e61-4ead-afb9-a63c943f4f14\",\"label\":\"Korangi\",\"node\":{\"locationId\":\"765cb701-9e61-4ead-afb9-a63c943f4f14\",\"name\":\"Korangi\",\"tags\":[\"Town\"],\"voided\":false}},\"a57cef08-b47e-4b59-acd8-354279a63027\":{\"id\":\"a57cef08-b47e-4b59-acd8-354279a63027\",\"label\":\"3-KA\",\"node\":{\"locationId\":\"a57cef08-b47e-4b59-acd8-354279a63027\",\"name\":\"3-KA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"parentLocation\":{\"locationId\":\"b25f114e-22e4-4cf8-89ef-af94ea2cecc5\",\"name\":\"NALDANGA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"f30df310-0d30-4482-8dfe-667def649c20\":{\"id\":\"f30df310-0d30-4482-8dfe-667def649c20\",\"label\":\"PROTAP - MANDUAR PARA\",\"node\":{\"locationId\":\"f30df310-0d30-4482-8dfe-667def649c20\",\"name\":\"PROTAP - MANDUAR PARA\",\"parentLocation\":{\"locationId\":\"a57cef08-b47e-4b59-acd8-354279a63027\",\"name\":\"3-KA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"a57cef08-b47e-4b59-acd8-354279a63027\"},\"f6933584-9248-409d-b06a-0988c470ce45\":{\"id\":\"f6933584-9248-409d-b06a-0988c470ce45\",\"label\":\"PROTAP - FUL PARA\",\"node\":{\"locationId\":\"f6933584-9248-409d-b06a-0988c470ce45\",\"name\":\"PROTAP - FUL PARA\",\"parentLocation\":{\"locationId\":\"a57cef08-b47e-4b59-acd8-354279a63027\",\"name\":\"3-KA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"a57cef08-b47e-4b59-acd8-354279a63027\"},\"bac5a3b2-456f-4500-93a7-7a24be91909e\":{\"id\":\"bac5a3b2-456f-4500-93a7-7a24be91909e\",\"label\":\"PROTAP - KATA PROTAP\",\"node\":{\"locationId\":\"bac5a3b2-456f-4500-93a7-7a24be91909e\",\"name\":\"PROTAP - KATA PROTAP\",\"parentLocation\":{\"locationId\":\"a57cef08-b47e-4b59-acd8-354279a63027\",\"name\":\"3-KA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"a57cef08-b47e-4b59-acd8-354279a63027\"}},\"parent\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\"},\"f4e3cb47-fea1-418c-9a63-26374e424043\":{\"id\":\"f4e3cb47-fea1-418c-9a63-26374e424043\",\"label\":\"RANGPUR\",\"node\":{\"locationId\":\"f4e3cb47-fea1-418c-9a63-26374e424043\",\"name\":\"RANGPUR\",\"tags\":[\"Division\"],\"voided\":false},\"children\":{\"a556070e-cd96-49bc-b079-2a415d476a97\":{\"id\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"label\":\"GAIBANDHA\",\"node\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"parentLocation\":{\"locationId\":\"f4e3cb47-fea1-418c-9a63-26374e424043\",\"name\":\"RANGPUR\",\"voided\":false},\"tags\":[\"District\"],\"voided\":false},\"children\":{\"960ada36-be32-4867-a0aa-b7f4b835c61f\":{\"id\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"label\":\"SADULLAPUR\",\"node\":{\"locationId\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"name\":\"SADULLAPUR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"parentLocation\":{\"locationId\":\"f4e3cb47-fea1-418c-9a63-26374e424043\",\"name\":\"RANGPUR\",\"voided\":false},\"voided\":false},\"tags\":[\"Upazilla\"],\"voided\":false},\"children\":{\"bd57db27-71b9-467e-9503-ce2dec74e61b\":{\"id\":\"bd57db27-71b9-467e-9503-ce2dec74e61b\",\"label\":\"JAMALPUR\",\"node\":{\"locationId\":\"bd57db27-71b9-467e-9503-ce2dec74e61b\",\"name\":\"JAMALPUR\",\"parentLocation\":{\"locationId\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"name\":\"SADULLAPUR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\"},\"1b93c923-5ebb-4c0a-8bbb-067cc5fc5c9f\":{\"id\":\"1b93c923-5ebb-4c0a-8bbb-067cc5fc5c9f\",\"label\":\"FARIDPUR\",\"node\":{\"locationId\":\"1b93c923-5ebb-4c0a-8bbb-067cc5fc5c9f\",\"name\":\"FARIDPUR\",\"parentLocation\":{\"locationId\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"name\":\"SADULLAPUR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\"},\"a39ce1d7-d8ee-49e9-8a81-02f7949f5ff0\":{\"id\":\"a39ce1d7-d8ee-49e9-8a81-02f7949f5ff0\",\"label\":\"KUMARPARA\",\"node\":{\"locationId\":\"a39ce1d7-d8ee-49e9-8a81-02f7949f5ff0\",\"name\":\"KUMARPARA\",\"parentLocation\":{\"locationId\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"name\":\"SADULLAPUR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\"},\"07b798a0-2219-4447-8b72-2510c0526a15\":{\"id\":\"07b798a0-2219-4447-8b72-2510c0526a15\",\"label\":\"DAMODARPUR\",\"node\":{\"locationId\":\"07b798a0-2219-4447-8b72-2510c0526a15\",\"name\":\"DAMODARPUR\",\"parentLocation\":{\"locationId\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"name\":\"SADULLAPUR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\"},\"b25f114e-22e4-4cf8-89ef-af94ea2cecc5\":{\"id\":\"b25f114e-22e4-4cf8-89ef-af94ea2cecc5\",\"label\":\"NALDANGA\",\"node\":{\"locationId\":\"b25f114e-22e4-4cf8-89ef-af94ea2cecc5\",\"name\":\"NALDANGA\",\"parentLocation\":{\"locationId\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"name\":\"SADULLAPUR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\"},\"e7d39ba2-45a1-498c-bcc5-937f179d81fa\":{\"id\":\"e7d39ba2-45a1-498c-bcc5-937f179d81fa\",\"label\":\"RASULPUR\",\"node\":{\"locationId\":\"e7d39ba2-45a1-498c-bcc5-937f179d81fa\",\"name\":\"RASULPUR\",\"parentLocation\":{\"locationId\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"name\":\"SADULLAPUR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"960ada36-be32-4867-a0aa-b7f4b835c61f\"}},\"parent\":\"a556070e-cd96-49bc-b079-2a415d476a97\"},\"57b34716-c291-4ca4-a7c8-28e65ab8819a\":{\"id\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\",\"label\":\"GAIBANDHA SADAR\",\"node\":{\"locationId\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\",\"name\":\"GAIBANDHA SADAR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"parentLocation\":{\"locationId\":\"f4e3cb47-fea1-418c-9a63-26374e424043\",\"name\":\"RANGPUR\",\"voided\":false},\"voided\":false},\"tags\":[\"Upazilla\"],\"voided\":false},\"children\":{\"7491ac95-05d2-49a8-b6a9-463f357171eb\":{\"id\":\"7491ac95-05d2-49a8-b6a9-463f357171eb\",\"label\":\"LAKSHMIPUR\",\"node\":{\"locationId\":\"7491ac95-05d2-49a8-b6a9-463f357171eb\",\"name\":\"LAKSHMIPUR\",\"parentLocation\":{\"locationId\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\",\"name\":\"GAIBANDHA SADAR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\"},\"725658c6-4d94-4791-bad6-614dec63d83b\":{\"id\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"label\":\"KUPTALA\",\"node\":{\"locationId\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"name\":\"KUPTALA\",\"parentLocation\":{\"locationId\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\",\"name\":\"GAIBANDHA SADAR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\"},\"d658d99a-1941-406b-bbdc-b46a2545de92\":{\"id\":\"d658d99a-1941-406b-bbdc-b46a2545de92\",\"label\":\"MALIBARI\",\"node\":{\"locationId\":\"d658d99a-1941-406b-bbdc-b46a2545de92\",\"name\":\"MALIBARI\",\"parentLocation\":{\"locationId\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\",\"name\":\"GAIBANDHA SADAR\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"57b34716-c291-4ca4-a7c8-28e65ab8819a\"}},\"parent\":\"a556070e-cd96-49bc-b079-2a415d476a97\"}},\"parent\":\"f4e3cb47-fea1-418c-9a63-26374e424043\"}}},\"cd4ed528-87cd-42ee-a175-5e7089521ebd\":{\"id\":\"cd4ed528-87cd-42ee-a175-5e7089521ebd\",\"label\":\"Pakistan\",\"node\":{\"locationId\":\"cd4ed528-87cd-42ee-a175-5e7089521ebd\",\"name\":\"Pakistan\",\"tags\":[\"Country\"],\"voided\":false},\"children\":{\"461f2be7-c95d-433c-b1d7-c68f272409d7\":{\"id\":\"461f2be7-c95d-433c-b1d7-c68f272409d7\",\"label\":\"Sindh\",\"node\":{\"locationId\":\"461f2be7-c95d-433c-b1d7-c68f272409d7\",\"name\":\"Sindh\",\"parentLocation\":{\"locationId\":\"cd4ed528-87cd-42ee-a175-5e7089521ebd\",\"name\":\"Pakistan\",\"voided\":false},\"tags\":[\"Province\"],\"voided\":false},\"children\":{\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\":{\"id\":\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\",\"label\":\"Karachi\",\"node\":{\"locationId\":\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\",\"name\":\"Karachi\",\"parentLocation\":{\"locationId\":\"461f2be7-c95d-433c-b1d7-c68f272409d7\",\"name\":\"Sindh\",\"parentLocation\":{\"locationId\":\"cd4ed528-87cd-42ee-a175-5e7089521ebd\",\"name\":\"Pakistan\",\"voided\":false},\"voided\":false},\"tags\":[\"City\"],\"voided\":false},\"children\":{\"60c21502-fec1-40f5-b77d-6df3f92771ce\":{\"id\":\"60c21502-fec1-40f5-b77d-6df3f92771ce\",\"label\":\"Baldia\",\"node\":{\"locationId\":\"60c21502-fec1-40f5-b77d-6df3f92771ce\",\"name\":\"Baldia\",\"parentLocation\":{\"locationId\":\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\",\"name\":\"Karachi\",\"parentLocation\":{\"locationId\":\"461f2be7-c95d-433c-b1d7-c68f272409d7\",\"name\":\"Sindh\",\"voided\":false},\"voided\":false},\"tags\":[\"Town\"],\"attributes\":{\"at1\":\"atttt1\"},\"voided\":false},\"parent\":\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\"}},\"parent\":\"461f2be7-c95d-433c-b1d7-c68f272409d7\"}},\"parent\":\"cd4ed528-87cd-42ee-a175-5e7089521ebd\"}}},\"96cd1c2a-f678-4687-bd87-8f4c5eae261a\":{\"id\":\"96cd1c2a-f678-4687-bd87-8f4c5eae261a\",\"label\":\"BAMANDANGA\",\"node\":{\"locationId\":\"96cd1c2a-f678-4687-bd87-8f4c5eae261a\",\"name\":\"BAMANDANGA\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"e1f223f5-a59e-4a54-b44e-472ff2438684\":{\"id\":\"e1f223f5-a59e-4a54-b44e-472ff2438684\",\"label\":\"2-KA\",\"node\":{\"locationId\":\"e1f223f5-a59e-4a54-b44e-472ff2438684\",\"name\":\"2-KA\",\"parentLocation\":{\"locationId\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\",\"name\":\"Ward-2\",\"parentLocation\":{\"locationId\":\"725658c6-4d94-4791-bad6-614dec63d83b\",\"name\":\"KUPTALA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"fbe4c8cf-5d52-4bc3-a4ec-9dcc1f5504cd\":{\"id\":\"fbe4c8cf-5d52-4bc3-a4ec-9dcc1f5504cd\",\"label\":\"RAMPRASHAD\",\"node\":{\"locationId\":\"fbe4c8cf-5d52-4bc3-a4ec-9dcc1f5504cd\",\"name\":\"RAMPRASHAD\",\"parentLocation\":{\"locationId\":\"e1f223f5-a59e-4a54-b44e-472ff2438684\",\"name\":\"2-KA\",\"parentLocation\":{\"locationId\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\",\"name\":\"Ward-2\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"e1f223f5-a59e-4a54-b44e-472ff2438684\"},\"36fc5398-8e7a-430b-ab3b-557788b4d89f\":{\"id\":\"36fc5398-8e7a-430b-ab3b-557788b4d89f\",\"label\":\"Kuptala-2-KA\",\"node\":{\"locationId\":\"36fc5398-8e7a-430b-ab3b-557788b4d89f\",\"name\":\"Kuptala-2-KA\",\"parentLocation\":{\"locationId\":\"e1f223f5-a59e-4a54-b44e-472ff2438684\",\"name\":\"2-KA\",\"parentLocation\":{\"locationId\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\",\"name\":\"Ward-2\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"e1f223f5-a59e-4a54-b44e-472ff2438684\"}},\"parent\":\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\"},\"774bca32-01ab-4c7a-91f0-b5c51c41945a\":{\"id\":\"774bca32-01ab-4c7a-91f0-b5c51c41945a\",\"label\":\"CHHAPARHATI\",\"node\":{\"locationId\":\"774bca32-01ab-4c7a-91f0-b5c51c41945a\",\"name\":\"CHHAPARHATI\",\"parentLocation\":{\"locationId\":\"11eaac2c-12d6-4958-b548-2d6768776b10\",\"name\":\"SUNDARGANJ\",\"parentLocation\":{\"locationId\":\"a556070e-cd96-49bc-b079-2a415d476a97\",\"name\":\"GAIBANDHA\",\"voided\":false},\"voided\":false},\"tags\":[\"Union\"],\"voided\":false},\"parent\":\"11eaac2c-12d6-4958-b548-2d6768776b10\"},\"f332d8ac-e57f-49ba-8fb0-c428651697a2\":{\"id\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\",\"label\":\"3-KHA\",\"node\":{\"locationId\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\",\"name\":\"3-KHA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"parentLocation\":{\"locationId\":\"b25f114e-22e4-4cf8-89ef-af94ea2cecc5\",\"name\":\"NALDANGA\",\"voided\":false},\"voided\":false},\"tags\":[\"Unit\"],\"voided\":false},\"children\":{\"2fc43738-ace5-4961-8e8f-ab7d00e5bc63\":{\"id\":\"2fc43738-ace5-4961-8e8f-ab7d00e5bc63\",\"label\":\"DASLIA - ALL PARAS\",\"node\":{\"locationId\":\"2fc43738-ace5-4961-8e8f-ab7d00e5bc63\",\"name\":\"DASLIA - ALL PARAS\",\"parentLocation\":{\"locationId\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\",\"name\":\"3-KHA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\"},\"50d3dddd-9fba-4895-9b96-fe66d42e6fed\":{\"id\":\"50d3dddd-9fba-4895-9b96-fe66d42e6fed\",\"label\":\"PROTAP - OPADANI PARA\",\"node\":{\"locationId\":\"50d3dddd-9fba-4895-9b96-fe66d42e6fed\",\"name\":\"PROTAP - OPADANI PARA\",\"parentLocation\":{\"locationId\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\",\"name\":\"3-KHA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\"},\"80efdc06-59b7-4594-bf24-561a7eb12676\":{\"id\":\"80efdc06-59b7-4594-bf24-561a7eb12676\",\"label\":\"PROTAP - SARDAR PARA\",\"node\":{\"locationId\":\"80efdc06-59b7-4594-bf24-561a7eb12676\",\"name\":\"PROTAP - SARDAR PARA\",\"parentLocation\":{\"locationId\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\",\"name\":\"3-KHA\",\"parentLocation\":{\"locationId\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\",\"name\":\"Ward-3\",\"voided\":false},\"voided\":false},\"tags\":[\"Mauza\"],\"voided\":false},\"parent\":\"f332d8ac-e57f-49ba-8fb0-c428651697a2\"}},\"parent\":\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\"}},\"parentChildren\":{\"215caa30-1906-4210-8294-23eb7914c1dd\":[\"4ccd5a33-c462-4b53-b8c1-a1ad1c3ba0cf\"],\"318e5671-368b-4e9c-8bc1-7a6fb545c1e5\":[\"e1f223f5-a59e-4a54-b44e-472ff2438684\",\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\"],\"429feb8b-0b8d-4496-8e54-fdc94affed07\":[\"9047a5e3-66cf-4f83-b0b6-3cdd3d611272\",\"a8b7d760-0e7e-4fdb-9450-b41d31d1ec34\"],\"e8964ad4-e6f2-4aff-bb61-28c08d01af51\":[\"3a041478-5d39-4d42-b785-67c2ae56febb\",\"27e6d636-0683-4539-90b8-2c795318dc08\"],\"f6b22dad-75c4-47e6-923a-3d0a005ed8a7\":[\"a57cef08-b47e-4b59-acd8-354279a63027\",\"f332d8ac-e57f-49ba-8fb0-c428651697a2\"],\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\":[\"60c21502-fec1-40f5-b77d-6df3f92771ce\"],\"42423d74-a061-463b-93a1-2f773f0aae21\":[\"88abc9f1-d698-41e3-8e2d-0c900b16dfe6\"],\"fa32786b-4063-4f39-b72d-a5bc0e549193\":[\"f872c792-32ac-49e7-a386-f6b968968ef1\"],\"a57cef08-b47e-4b59-acd8-354279a63027\":[\"f30df310-0d30-4482-8dfe-667def649c20\",\"f6933584-9248-409d-b06a-0988c470ce45\",\"bac5a3b2-456f-4500-93a7-7a24be91909e\"],\"cd4ed528-87cd-42ee-a175-5e7089521ebd\":[\"461f2be7-c95d-433c-b1d7-c68f272409d7\"],\"f4e3cb47-fea1-418c-9a63-26374e424043\":[\"a556070e-cd96-49bc-b079-2a415d476a97\"],\"e1f223f5-a59e-4a54-b44e-472ff2438684\":[\"fbe4c8cf-5d52-4bc3-a4ec-9dcc1f5504cd\",\"36fc5398-8e7a-430b-ab3b-557788b4d89f\"],\"bfeb65bd-bff0-41bb-81a0-0220a4200bff\":[\"429feb8b-0b8d-4496-8e54-fdc94affed07\",\"42423d74-a061-463b-93a1-2f773f0aae21\"],\"11eaac2c-12d6-4958-b548-2d6768776b10\":[\"dff51374-be72-46cb-a9a3-c7989e24430c\",\"e8e88d43-e181-42f1-9de5-143149922eea\",\"d3367458-f5e5-4039-b1e7-f087cc5be3fa\",\"96cd1c2a-f678-4687-bd87-8f4c5eae261a\",\"f2f803d5-857a-42a4-a05b-142c3327b4fc\",\"e0d50bc5-09b2-4102-809d-687fe71d5fd0\",\"774bca32-01ab-4c7a-91f0-b5c51c41945a\",\"5d0661b5-4868-49eb-a697-e4dc4348dfab\",\"f48a6482-2ffd-4596-8d9b-46dadc3c73df\"],\"461f2be7-c95d-433c-b1d7-c68f272409d7\":[\"a529e2fc-6f0d-4e60-a5df-789fe17cca48\"],\"a556070e-cd96-49bc-b079-2a415d476a97\":[\"960ada36-be32-4867-a0aa-b7f4b835c61f\",\"57b34716-c291-4ca4-a7c8-28e65ab8819a\"],\"960ada36-be32-4867-a0aa-b7f4b835c61f\":[\"bd57db27-71b9-467e-9503-ce2dec74e61b\",\"1b93c923-5ebb-4c0a-8bbb-067cc5fc5c9f\",\"a39ce1d7-d8ee-49e9-8a81-02f7949f5ff0\",\"b25f114e-22e4-4cf8-89ef-af94ea2cecc5\",\"07b798a0-2219-4447-8b72-2510c0526a15\",\"e7d39ba2-45a1-498c-bcc5-937f179d81fa\"],\"57b34716-c291-4ca4-a7c8-28e65ab8819a\":[\"7491ac95-05d2-49a8-b6a9-463f357171eb\",\"725658c6-4d94-4791-bad6-614dec63d83b\",\"d658d99a-1941-406b-bbdc-b46a2545de92\"],\"f332d8ac-e57f-49ba-8fb0-c428651697a2\":[\"2fc43738-ace5-4961-8e8f-ab7d00e5bc63\",\"50d3dddd-9fba-4895-9b96-fe66d42e6fed\",\"80efdc06-59b7-4594-bf24-561a7eb12676\"],\"1ccb61b5-022f-4735-95b4-1c57e9f7938f\":[\"215caa30-1906-4210-8294-23eb7914c1dd\",\"fa32786b-4063-4f39-b72d-a5bc0e549193\"]}}}",
                LocationTree.class);
    doReturn(ltree).when(locationservice).getLocationTreeOf(any(String[].class));
    JSONObject resp = new JSONObject(controller.authenticate().getBody());
    Assert.assertTrue(
        new Gson()
            .fromJson(resp.getJSONObject("locations").toString(), LocationTree.class)
            .hasLocation("cd4ed528-87cd-42ee-a175-5e7089521ebd"));
  }
Ejemplo n.º 2
0
  @Test
  public void noQueryToTheRepositoryShouldBeSentIfTheDataModelIsAlreadyInitialized() {

    controller.getDataModel();

    verify(repository, never()).findAll();
  }
Ejemplo n.º 3
0
  @Test
  public void shouldReturnUserOnEdit() {
    User user = controller.edit(1L);

    assertThat(user, notNullValue());
    assertThat(user.getId(), equalTo(1L));
  }
Ejemplo n.º 4
0
  @Test
  public void repositoryShouldBeConsultedIfTheDataModelIsNotInitialized() {

    controller.getDataModel();

    verify(dataModelProvider).getDataModel();
  }
Ejemplo n.º 5
0
 @Test
 public void testHandleRequest() throws Exception {
   ModelAndView mav = c.handleRequest(null);
   Map m = mav.getModel();
   assertNotNull(m.get(Constants.USER_LIST));
   assertEquals("admin/userList", mav.getViewName());
 }
 @Test
 public void test() throws JSONException {
   User u =
       new User()
           .withBaseEntity(
               new BaseEntity().withAttribute("Location", "cd4ed528-87cd-42ee-a175-5e7089521ebd"));
   when(auth.getDrishtiUser(any(Authentication.class))).thenReturn(u);
   when(controller.currentUser()).thenReturn(u);
   JSONObject resp = new JSONObject(controller.authenticate().getBody());
   Assert.assertTrue(
       new Gson()
           .fromJson(resp.getJSONObject("locations").toString(), LocationTree.class)
           .hasLocation("cd4ed528-87cd-42ee-a175-5e7089521ebd"));
   // System.out.println(new Gson().toJson(locationservice.getLocationTreeOf(new
   // String[]{/*"karachi","sindh",*/"sripur","faridpur"})));
 }
Ejemplo n.º 7
0
  @Test
  public void testFindAll_shouldReturnEmptyList() throws Exception {
    final List<User> expectedUsers = Lists.emptyList();
    List<User> returnedUsers = userController.findAll();

    verify(userService, times(1)).findAll();
    assertEquals("Returned users should come from the service", expectedUsers, returnedUsers);
  }
Ejemplo n.º 8
0
  @SuppressWarnings("unchecked")
  @Test
  public void shouldIncludeRolesOnEdit() {
    controller.edit(1L);

    List<Role> roles = (List<Role>) result.included().get("roleList");
    assertThat(roles.get(0).getId(), equalTo(1L));
  }
Ejemplo n.º 9
0
  @Test
  public void shouldLoadAndActiveUser() throws Exception {
    controller.active(1L, true);

    assertThat(result.serializedResult(), containsString("\"active\":true"));
    verify(act).loadBy(User.class, 1L);
    verify(act).save(user);
  }
Ejemplo n.º 10
0
  @Test
  public void testLogin() throws Exception {

    request.setParameter("username", "A8AB4B572A3B4B0FA01539DCFD3A74A8");
    request.setParameter("password", "000000");
    result = controller.login(request, response);

    Assert.isTrue("ok".equalsIgnoreCase(result.getCode()));
  }
Ejemplo n.º 11
0
  @Test
  public void testSave_shouldCreateUser() throws Exception {
    final User savedUser = stubServiceToReturnStoredUser();
    final User user = new User(USER_NAME);
    User returnedUser = userController.createUser(user);

    verify(userService, times(1)).save(user);
    assertEquals("Returned user should come from the service", savedUser, returnedUser);
  }
  @Test
  public void testLoginCorrect() {
    LoginRequest userLogin = LoginRequest.builder().build();
    Mockito.when(authenticationService.login(userLogin))
        .thenReturn(LoginResponse.builder().build());

    LoginResponse loginResponse = classUnderTest.login(userLogin);

    Mockito.verify(authenticationService, Mockito.times(1)).login(userLogin);
  }
Ejemplo n.º 13
0
  @Test
  public void scheduleEditSelectedUserAndDisplayRevokeUserRoleConfirmationDialog() {

    controller.openRevokeRoleFromUserDialog(REVOKE_ROLE_CONFIRMATION_OUTCOME);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache, never()).createNewUser();
    inOrder.verify(cache).scheduleEditOperation();
    inOrder.verify(dialog).displayBeforeRemoveConfirmationDialog(REVOKE_ROLE_CONFIRMATION_OUTCOME);
  }
Ejemplo n.º 14
0
  @Test
  public void scheduleRemoveOperationAndDisplayConfirmationDialog() {

    controller.openRemoveUserConfirmationDialog(REMOVE_OUTCOME);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache, never()).createNewUser();
    inOrder.verify(cache).scheduleRemoveOperation();
    inOrder.verify(dialog).displayBeforeRemoveConfirmationDialog(REMOVE_OUTCOME);
  }
Ejemplo n.º 15
0
  @Test
  public void scheduleCreateOperationAndDisplayEditForm() {

    controller.openEditSelectedUserDialog(EDIT_OUTCOME);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache, never()).createNewUser();
    inOrder.verify(cache).scheduleEditOperation();
    inOrder.verify(dialog).displayInputForm(EDIT_OUTCOME);
  }
Ejemplo n.º 16
0
  @Test
  public void shouldReturnPage() {
    Page<User> paginate = controller.index();

    List<User> list = paginate.getList();
    User user = list.get(0);

    assertThat(paginate, instanceOf(Page.class));
    assertThat(paginate.getPageSize(), equalTo(1));
    assertThat(user.getId(), equalTo(1L));
    assertThat(user.getEmail(), equalTo("Foo"));
  }
Ejemplo n.º 17
0
  @Test
  public void testGetVerificationCode() throws Exception {

    //		String url = "/xxxxxxx/v1.0/verificationcode";
    //		request = newGet(url);
    //
    //		result = controller.getVerificationCode(request, response);
    //		Assert.isTrue("ok".equalsIgnoreCase(result.getCode()));

    result = controller.getVerificationCode(request, response);
    Assert.isTrue("ok".equalsIgnoreCase(result.getCode()));
  }
Ejemplo n.º 18
0
  @Test
  public void scheduleEditSelectedUserAndDisplayRoleListDialog() {
    final User grantee = mock(User.class);

    controller.openGrantRoleToUserDialog(ROLE_LIST_OUTCOME, grantee);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache, never()).createNewUser();
    inOrder.verify(cache).scheduleEditOperation();
    inOrder.verify(dialog).displayInputForm(ROLE_LIST_OUTCOME);
  }
Ejemplo n.º 19
0
  @Test
  public void grantRoleToUser() {
    final Role role = mock(Role.class);

    controller.grantRoleToUser(role);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache).grantTheRoleToTheUser(role);
    inOrder.verify(cache).executePendingCrudOperation();
    inOrder.verify(dialog).dispose();
  }
Ejemplo n.º 20
0
  @Test
  public void
      scheduleEditOperationOnCachedUserAndThanDisplayDialogToSelectADecreeSequenceToGrantAccessTo() {
    final String SELECT_DECREE_SEQUENCE_OUTCOME = "GrantAccessOnDecreeSequence";

    controller.openGrantAccessToDecreeSequenceDialog(SELECT_DECREE_SEQUENCE_OUTCOME);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache).scheduleEditOperation();
    inOrder.verify(dialog).displayInputForm(SELECT_DECREE_SEQUENCE_OUTCOME);
  }
Ejemplo n.º 21
0
  @Test
  public void revokeRoleFromUser() {
    final Role role = mock(Role.class);

    controller.revokeRoleFromUser(role);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache).revokeTheRoleFromTheUser(role);
    inOrder.verify(cache).executePendingCrudOperation();
    inOrder.verify(dialog).dispose();
  }
Ejemplo n.º 22
0
  @Test
  public void
      scheduleEditOperationOnCachedUserAndDisplayConfirmationDialogToRevokeAccessToSelectedDecreeSequence() {
    final String CONFIRMATION_OUTCOME = "RevokeAccessOnDecreeSequence";

    controller.openRevokeAccessToDecreeSequenceDialog(CONFIRMATION_OUTCOME);

    InOrder inOrder = inOrder(cache, dialog);

    inOrder.verify(cache).scheduleEditOperation();
    inOrder.verify(dialog).displayBeforeRemoveConfirmationDialog(CONFIRMATION_OUTCOME);
  }
Ejemplo n.º 23
0
  @Test
  public void testBindCallPhone() throws Exception {

    String verificationcode = "verificationcode1212121";
    String phone = "13121710713";

    EacheKeyConstant.setPhoneVerificationcodeCache(cacheManager, phone, verificationcode);

    request.setParameter("callPhone", phone);
    request.setParameter("verificationcode", verificationcode);
    result = controller.bindCallPhone(request, response);
    Assert.isTrue("ok".equalsIgnoreCase(result.getCode()));
  }
Ejemplo n.º 24
0
  @Test
  public void testSearch() throws Exception {
    // reindex before searching
    UserManager userManager = (UserManager) applicationContext.getBean("userManager");
    userManager.reindex();

    ModelAndView mav = c.handleRequest("admin");
    Map m = mav.getModel();
    List results = (List) m.get(Constants.USER_LIST);
    assertNotNull(results);
    assertTrue(results.size() >= 1);
    assertEquals("admin/userList", mav.getViewName());
  }
Ejemplo n.º 25
0
 @Test
 public void testUpdateUserInfo() throws Exception {
   BUser userInfo = new BUser();
   userInfo.setUsername("wangwr");
   userInfo.setTruename("wang万荣");
   userInfo.setSchool("知好乐测试学校123");
   userInfo.setSubjectid(1);
   userInfo.setTermid(2);
   userInfo.setGradeid(2);
   userInfo.setEducateageid(2);
   userInfo.setTeachingmaterial("初中语文人教版");
   String uuid = StringUtils.getCurretUUId(request);
   result = controller.updateUserInfo(request, userInfo);
   Assert.isTrue("ok".equalsIgnoreCase(result.getCode()));
 }
Ejemplo n.º 26
0
  /**
   * Adds a new item to the user
   *
   * @param item the new item
   */
  public void addItem(Item item) {

    if (items.contains(item)) {
      return;
    }

    // first increment the gameCount so the new item has the newly incremented game value.
    incrementGameCount();

    if (item.getId().contains("NO_INTERNET")) {
      //  don't change id
      items.add(item);
    } else {

      // Refresh the item list owned by this user in case of any recent changes
      // Grab the items from the controller.
      ItemController.GetItems getItems = new ItemController.GetItems();
      getItems.execute(getItems.MODE_GET_MY_ITEMS, username);

      UserController.setCurrentUser(this);

      try {
        items = getItems.get();
      } catch (InterruptedException e) {
        e.printStackTrace();
      } catch (ExecutionException e) {
        e.printStackTrace();
      }
      // set to item's ID before sending to controller
      item.setId(getUsername() + (char) 31 + getGameCount());
      items.add(item);
      // Post the new item information
      // Set the item via the controller.
      ItemController.AddItem addItem = new ItemController.AddItem();
      addItem.execute(item);

      // Adds the Item to the user
      UserController.UpdateUserProfile updateUserProfile = new UserController.UpdateUserProfile();
      updateUserProfile.execute(this);
    }
  }
Ejemplo n.º 27
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pagina_listagem_emprestimos);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    context = this;

    if (getIntent().hasExtra("EMAIL_USER")) {
      Bundle extras = getIntent().getExtras();
      emailUsuarioDaSessao = extras.getString("EMAIL_USER");
      System.out.println(extras.getString("EMAIL_USER"));
      Log.w("EmailUser", extras.getString("EMAIL_USER"));
    }

    usuarioDaSessao = new UserController(this);
    atual = usuarioDaSessao.findByEmail(emailUsuarioDaSessao);
    String nome = atual.getName();

    TextView NomeDoUsuario = (TextView) findViewById(R.id.NameUser);
    NomeDoUsuario.setText(nome);

    ListView lista = (ListView) findViewById(R.id.emprestimo_list_view);
    adaptador = new ArrayAdapter<ItemRow>(this, android.R.layout.simple_list_item_1, itemData);
    lista.setAdapter(adaptador);

    lista.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            ItemRow EmprestimoEscolhido = adaptador.getItem(position);
            String livroEscolhido = EmprestimoEscolhido.getItemName();
            int idLivro = EmprestimoEscolhido.getId();
            int idSolicitante = EmprestimoEscolhido.getIdSolicitante();

            try {

              Emprestimo emprestimo =
                  emprestimos.findEmprestimo(idSolicitante, atual.getId(), idLivro);
              emprestimos.confirmEmprestimo(emprestimo);
              Toast.makeText(context, "Empréstimo confirmado!", Toast.LENGTH_SHORT).show();

              Intent calIntent = new Intent(Intent.ACTION_INSERT);
              calIntent.setType("vnd.android.cursor.item/event");
              calIntent.putExtra(
                  CalendarContract.Events.TITLE,
                  "Empréstimo - " + emprestimo.getRequestedBook().getTitle());
              calIntent.putExtra(
                  CalendarContract.Events.DESCRIPTION,
                  "Empréstimo do livro "
                      + emprestimo.getRequestedBook().getTitle()
                      + " para "
                      + emprestimo.getRequester().getName()
                      + " "
                      + emprestimo.getRequester().getSurname());

              int dia = emprestimo.getDate().getDay();
              int mes = emprestimo.getDate().getMonth();
              int ano = emprestimo.getDate().getYear();
              GregorianCalendar calDate = new GregorianCalendar(dia, mes, ano);
              calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);
              calIntent.putExtra(
                  CalendarContract.EXTRA_EVENT_BEGIN_TIME, calDate.getTimeInMillis());
              calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, calDate.getTimeInMillis());
              startActivity(calIntent);

            } catch (Exception e) {
              Toast.makeText(context, "Falha ao confirmar!", Toast.LENGTH_SHORT).show();
            }

            //                Intent intent = new Intent(PaginaListagemEmprestimos.this,
            // PaginaConfirmacao.class);
            //                intent.putExtra("EMAIL_USER", emailUsuarioDaSessao);
            //                intent.putExtra("USER_SOLICITANTE", idSolicitante);
            //                intent.putExtra("LIVRO_ESCOLHIDO", livroEscolhido);
            //                startActivity(intent);
            // usuarioPortador =
          }
        });

    db = new DatabaseHandler(this);
    populaLista();
  }
Ejemplo n.º 28
0
  @Test
  public void shouldRedirectOnRemove() {
    controller.remove(1L);

    verify(result).redirectTo(c);
  }
public class ViewBorrowingOutActivity extends AppCompatActivity {
  // private ItemList myItemsList;
  private ArrayAdapter<Item> adapter;
  private User user = UserController.getUser();
  private User renter;
  private String renterID;
  private String oldID;
  private ListView itemsView;
  private ArrayList<String> usersItems = new ArrayList<>();
  private ArrayList<Item> usersItemsArrayList = new ArrayList<>();
  private ArrayList<String> rentersBorrowedItems = new ArrayList<>();
  private String[] itemsList;
  private Item selectedItem;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_borrowing_out);
    setTitle("My Items Currently Borrowed");

    SetItems();

    itemsView.setOnItemLongClickListener(
        new AdapterView.OnItemLongClickListener() {
          /*
          The ViewAdapter saves the position of what is clicked in the dynamic list.
          Set that Item as the current Item and send the user to the MyItemActivity with the current Item
           */
          // maybe a popup to ask if they wanna mark as returned actually
          @Override
          public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
            ItemController.setItem((Item) parent.getAdapter().getItem(position));
            Intent intent = new Intent(view.getContext(), MyItemActivity.class);
            startActivity(intent);
            return false;
          }
        });

    itemsView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          // http://stackoverflow.com/questions/2115758/how-do-i-display-an-alert-dialog-on-android
          // 04/03/16
          @Override
          public void onItemClick(AdapterView<?> parent, View view, final int position, long id) {
            new AlertDialog.Builder(view.getContext())
                .setTitle("Mark Returned")
                .setMessage("Mark this item as returned?")
                .setPositiveButton(
                    android.R.string.yes,
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {
                        selectedItem = usersItemsArrayList.get(position);
                        selectedItem.setAvailability(true);
                        selectedItem.setRenterID("");
                        oldID = selectedItem.getID();
                        renterID = selectedItem.getRenterID();
                        renter = UserController.getUserByIDElasticSearch(renterID);
                        rentersBorrowedItems = renter.getItemsBorrowed();
                        rentersBorrowedItems.remove(selectedItem.getID());
                        UserController.updateUserElasticSearch(renter);
                        ItemController.updateItemElasticSearch(selectedItem);
                        usersItems = user.getMyItems();
                        usersItems.remove(oldID);
                        usersItems.add(selectedItem.getID());
                        UserController.updateUserElasticSearch(user);
                        SetItems();
                      }
                    })
                .setNegativeButton(
                    android.R.string.no,
                    new DialogInterface.OnClickListener() {
                      public void onClick(DialogInterface dialog, int which) {}
                    })
                .setIcon(android.R.drawable.ic_dialog_alert)
                .show();
          }
        });
  }

  /** Refreshes the adapter so the view is refreshed */
  // this seems like a fairly shady way to update the adapter but it's the only way I could
  // seem get it to work
  // TODO: improve the way the view/adapter is updated here
  @Override
  protected void onResume() {
    super.onResume();
    SetItems();
  }

  public void SetItems() {
    itemsView = (ListView) findViewById(R.id.myItemsListView);

    if (NetworkUtil.getConnectivityStatus(this) == 1) {
      usersItems = user.getMyItems();
      itemsList = new String[usersItems.size()];
      itemsList = usersItems.toArray(itemsList);
      ItemController.getItemsByIDElasticSearch(itemsList);
      usersItemsArrayList = ItemController.getItemList().getItemList();
      for (Item item : usersItemsArrayList) {
        if (item.getAvailability()) {
          usersItemsArrayList.remove(item);
        }
      }
      if (usersItemsArrayList.isEmpty()) {
        Toast.makeText(
                ViewBorrowingOutActivity.this,
                "None of your items are being borrowed.",
                Toast.LENGTH_SHORT)
            .show();
      }
      // TODO: can stop converting the items list into String[] once that's it's actual type
      adapter = new CustomSearchResultsAdapter(this, usersItemsArrayList);
      itemsView.setAdapter(adapter);
      adapter.notifyDataSetChanged();
    } else {
      Toast.makeText(this, "You are not connected to the internet.", Toast.LENGTH_SHORT).show();
    }
  }
}
Ejemplo n.º 30
-9
 @Test
 public void testUpdateUserPwd() throws Exception {
   request.setParameter("oldPassword", "000000");
   request.setParameter("newPassword", "000000");
   result = controller.updateUserPwd(request, response);
   Assert.isTrue("ok".equalsIgnoreCase(result.getCode()));
 }