LocalAuthorityController { @GetMapping("/{siren}/dcId") public ResponseEntity<String> getDcId(@PathVariable String siren) { Optional<LocalAuthority> localAuthority = localAuthorityService.findBySiren(siren); return localAuthority .map(localAuthority1 -> new ResponseEntity<>(localAuthority1.getOzwilloInstanceInfo().getDcId(), HttpStatus.OK)) .orElseGet(() -> new ResponseEntity<>(HttpStatus.NOT_FOUND)); } LocalAuthorityController(LocalAuthorityService localAuthorityService, ProfileService profileService,
            WorkGroupService workGroupService); @GetMapping("/instance-id/{instaceId}") ResponseEntity<String> getSlugByInstanceId(@PathVariable String instaceId); @GetMapping("/current") @JsonView(Views.LocalAuthorityView.class) ResponseEntity<LocalAuthority> getCurrentLocalAuthority(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String agentUuid); @GetMapping("/all") @JsonView(Views.LocalAuthorityViewBasic.class) List<LocalAuthority> getAllBasicLocalAuthorities(); @GetMapping("/{uuid}") @JsonView(Views.LocalAuthorityView.class) ResponseEntity<LocalAuthority> getLocalAuthorityByUuid(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Agent-UUID") String agentUuid,
            @PathVariable String uuid); @GetMapping("/instance/slug-name/{slugName}") OzwilloInstanceInfo getInstanceInfoBySlugName(@PathVariable String slugName); @GetMapping("/instance/instance-id/{instanceId}") OzwilloInstanceInfo getInstanceInfoByInstanceId(@PathVariable String instanceId); @PostMapping("/current/{module}") ResponseEntity addModule(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String agentUuid,
            @PathVariable Module module); @DeleteMapping("/current/{module}") ResponseEntity removeModule(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String agentUuid,
            @PathVariable Module module); @GetMapping("/{uuid}/agent/{agentUuid}") @JsonView(Views.ProfileView.class) ResponseEntity<Profile> getProfile(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid, @PathVariable String agentUuid); @GetMapping("/current/agent/{agentUuid}") @JsonView(Views.ProfileView.class) ResponseEntity<Profile> getProfileFromCurrent(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String agentUuid); @GetMapping("/{uuid}/group") @JsonView(Views.WorkGroupView.class) ResponseEntity<List<WorkGroup>> getAllGroupByLocalAuthority(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid); @GetMapping("/{uuid}/{moduleName}/group") @JsonView(Views.WorkGroupView.class) ResponseEntity<List<WorkGroup>> getAllGroupByLocalAuthorityAndModule(@PathVariable String uuid,
            @PathVariable String moduleName); @GetMapping("/current/group") @JsonView(Views.WorkGroupView.class) ResponseEntity<List<WorkGroup>> getAllGroupForCurrent(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid); @PostMapping("/{uuid}/group") @JsonView(Views.WorkGroupView.class) ResponseEntity<WorkGroup> newGroupFromFront(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid, @RequestBody WorkGroupUI workGroupUI); @PostMapping("/{uuid}/group/{name}") @JsonView(Views.WorkGroupView.class) ResponseEntity<String> newGroupFromModules(
            @PathVariable String uuid, @PathVariable String name, @RequestBody Set<String> rights); @PostMapping("/current/group") @JsonView(Views.WorkGroupView.class) ResponseEntity<WorkGroup> newGroupForCurrent(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @RequestBody WorkGroupUI workGroupUI); @GetMapping("/group/{uuid}") @JsonView(Views.WorkGroupView.class) ResponseEntity<WorkGroup> getGroup(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid); @PatchMapping("/group/{uuid}") @JsonView(Views.WorkGroupView.class) ResponseEntity<WorkGroup> updateGroup(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid, @RequestBody WorkGroupUI workGroupUI); @DeleteMapping("/group/{uuid}") ResponseEntity deleteGroup(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid); @GetMapping("/certificates/{uuid}") ResponseEntity<Certificate> getLocalAuthorityCertificate(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid); @PostMapping("/current/certificates") ResponseEntity addCurrentLocalAuthorityCertificate(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @RequestParam("file") MultipartFile file); @PostMapping("/{uuid}/certificates") ResponseEntity addLocalAuthorityCertificate(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid, @RequestParam("file") MultipartFile file); @DeleteMapping("/current/certificates/{uuid}") ResponseEntity deleteCurrentLocalAuthorityCertificate(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Local-Authority-UUID") String currentLocalAuthUuid,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid); @DeleteMapping("/{localAuthorityUuid}/certificates/{uuid}") ResponseEntity deleteLocalAuthorityCertificate(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String localAuthorityUuid, @PathVariable String uuid); @PostMapping("/{uuid}/{module}") ResponseEntity addModuleByUuid(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid, @PathVariable Module module); @DeleteMapping("/{uuid}/{module}") ResponseEntity removeModuleByUuid(
            @RequestAttribute("STELA-Current-Profile-Is-Local-Authority-Admin") boolean isLocalAuthorityAdmin,
            @RequestAttribute("STELA-Current-Agent-UUID") String currentAgentUuid,
            @PathVariable String uuid, @PathVariable Module module); @GetMapping("/certificate/{serial}/{issuer}") ResponseEntity<LocalAuthority> getByCertificate(
            @PathVariable String serial,
            @PathVariable String issuer); @GetMapping("/{uuid}/siret") String getSiret(@PathVariable String uuid); @GetMapping("/{siren}/accessToken") ResponseEntity<String> getAccessToken(@PathVariable String siren); @GetMapping("/{siren}/dcId") ResponseEntity<String> getDcId(@PathVariable String siren);  }
@Test public void getDcId() throws Exception { OzwilloInstanceInfo ozwilloInstanceInfo = new OzwilloInstanceInfo(); ReflectionTestUtils.setField(ozwilloInstanceInfo, "dcId", "https: LocalAuthority localAuthority = new LocalAuthority("uuid-local-authority-test-one"); localAuthority.setOzwilloInstanceInfo(ozwilloInstanceInfo); localAuthority.setSiren("123456789"); given(localAuthorityService.findBySiren("123456789")).willReturn(Optional.of(localAuthority)); ResultActions resultActions = mockMvc.perform(get("/api/admin/local-authority/123456789/dcId")); resultActions .andExpect(matchAll( status().isOk(), jsonPath("$").value("https: )) .andDo(print()); }