### Question:
AdminResource { @GET @Path("setSafeMode/{mode}") @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) public String setSafeMode(@PathParam("mode") String mode) { LOG.info("Setting falcon server safemode property to: {}", mode); try { if ("true".equalsIgnoreCase(mode)) { StartupProperties.createSafemodeFile(); } else if ("false".equalsIgnoreCase(mode)) { StartupProperties.deleteSafemodeFile(); } else { LOG.error("Bad request, Invalid value for setsafemode : {}", mode); throw FalconWebException.newAPIException("Invalid value \"" + mode + "\" provided for safemode.", Response.Status.BAD_REQUEST); } } catch (IOException e) { LOG.error("Unable to manage safemode file in Falcon Server {} ", e.getMessage()); throw FalconWebException.newAPIException(e.getMessage(), Response.Status.BAD_REQUEST); } return StartupProperties.get().getProperty(StartupProperties.SAFEMODE_PROPERTY, "false"); }  @GET @Path("stack") @Produces(MediaType.TEXT_PLAIN) String getThreadDump(); @GET @Path("version") @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) PropertyList getVersion(); @GET @Path("setSafeMode/{mode}") @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) String setSafeMode(@PathParam("mode") String mode); @GET @Path("config/{type}") @Produces({MediaType.TEXT_XML, MediaType.APPLICATION_JSON}) PropertyList getVersion(@PathParam("type") String type); @GET @Path("clearuser") @Produces(MediaType.TEXT_PLAIN) String clearUser(@Context HttpServletResponse response); @GET @Path("getuser") @Produces(MediaType.TEXT_PLAIN) String getAuthenticatedUser(); static final String SAFEMODE; }### Answer:
@Test public void testSetSafemode() throws Exception { checkProperty(AdminResource.SAFEMODE, "false"); AdminResource resource = new AdminResource(); String safemode = resource.setSafeMode("true"); Assert.assertEquals(safemode, "true"); Assert.assertTrue(StartupProperties.doesSafemodeFileExist()); checkProperty(AdminResource.SAFEMODE, "true"); safemode = resource.setSafeMode("false"); Assert.assertEquals(safemode, "false"); Assert.assertFalse(StartupProperties.doesSafemodeFileExist()); checkProperty(AdminResource.SAFEMODE, "false"); }