### Question:
RefreshController { @Operation(summary = "Trigger an internal restart of the Chaos Engine", description = "Triggers the Chaos Engine to completely restart itself. All properties and spring conditionals are reloaded and reevaluated. May return false if restart cannot be initiated because experiments are in progress.", responses = { @ApiResponse(description = "Boolean value of if Application restart has been initiated.") }) @PostMapping("/all") public boolean doRestart () { return refreshManager.doRestart(); }  @Operation(summary = "Trigger Spring Property refresh", description = "Triggers the Spring Framework backend to refresh all properties loaded from external sources (i.e., vault), and reload any Refreshable Beans that depend on them, such as Platform services", responses = { @ApiResponse(description = "Refresh has initiated and these properties have been found to refresh", content = @Content(array = @ArraySchema(schema = @Schema(implementation = String.class)))) }) @PostMapping Collection<String> doRefresh(); @Operation(summary = "Trigger an internal restart of the Chaos Engine", description = "Triggers the Chaos Engine to completely restart itself. All properties and spring conditionals are reloaded and reevaluated. May return false if restart cannot be initiated because experiments are in progress.", responses = { @ApiResponse(description = "Boolean value of if Application restart has been initiated.") }) @PostMapping("/all") boolean doRestart(); static final String REFRESH; }### Answer:
@Test @WithAdmin public void doRestartAsAdmin () throws Exception { doReturn(true).when(refreshManager).doRestart(); mvc.perform(post("/refresh/all").contentType(MediaType.APPLICATION_JSON)) .andExpect(status().isOk()) .andExpect(content().string("true")); }
@Test @WithGenericUser public void doRestartAsUser () throws Exception { doReturn(true).when(refreshManager).doRestart(); mvc.perform(post("/refresh/all").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isForbidden()); }
@Test @WithAnonymousUser public void doRestartAnonymous () throws Exception { doReturn(true).when(refreshManager).doRestart(); mvc.perform(post("/refresh/all").contentType(MediaType.APPLICATION_JSON)).andExpect(status().isNotFound()); }
@Test @WithAdmin public void doRestartFailure () throws Exception { doThrow(new RuntimeException()).when(refreshManager).doRestart(); mvc.perform(patch("/refresh/all").contentType(MediaType.APPLICATION_JSON)) .andExpect(status().is5xxServerError()); }