### Question:
UiInstanceService { public void setFinalStatus(CombinedInstanceDto combinedInstanceDto) { if (combinedInstanceDto.getSupperStatus() == 1) { combinedInstanceDto.setFinalStatus(1); } else if (combinedInstanceDto.getSupperStatus() == -1) { combinedInstanceDto.setFinalStatus(0); } else if (combinedInstanceDto.getSupperStatus() == 0 && combinedInstanceDto.getPubStatus() == 1 && combinedInstanceDto.getInstanceStatus() == 1 && combinedInstanceDto.getHeartStatus() == 1) { combinedInstanceDto.setFinalStatus(1); } else { combinedInstanceDto.setFinalStatus(0); } }  UiResponse findInstance(HttpServletRequest request, Map parameterMap); UiResponse findExpiredInstance(HttpServletRequest request, Map parameterMap); UiResponse deleteById(long instanceId); UiResponse findByInstanceId(HttpServletRequest request, String instanceId); void setFinalStatus(CombinedInstanceDto combinedInstanceDto); @Transactional(rollbackFor = Exception.class) String updateSupperStatus(HttpServletRequest request, String originalStatus, String supperStatus, long instanceId); @Transactional(rollbackFor = Exception.class) String updatePublishStatus(HttpServletRequest request, String pubStatus, long instanceId); List<String> getAllSdkVersion();  }### Answer:
@Test public void testSetFinalStatus() throws Exception{ RegisterInstanceRequest registerInstanceRequest = RegisterInstanceUtil.setRegisterInstanceRequest(); RegisterInstanceResponse response = instanceService.registerInstance(registerInstanceRequest); Thread.sleep(2 * 1000); InstanceEntity testInstanceEntity = RegisterInstanceUtil.createTestInstanceEntity(); HttpServletRequest request = new MockHttpServletRequest(); Map<String, Object> parameterMap = new LinkedHashMap<String, Object>(); parameterMap = setParameterMap(parameterMap); InstanceEntity instanceEntity = instanceService.findByCandInstanceId("w545878765"); Assert.assertEquals(testInstanceEntity.getAppClusterName(), instanceEntity.getAppClusterName()); Assert.assertEquals(testInstanceEntity.getCandAppId(), instanceEntity.getCandAppId()); instanceService.updateHeartStatus(Lists.newArrayList(instanceEntity), false, 1); Assert.assertEquals(0, instanceService.findByCandInstanceId("w545878765").getHeartStatus()); CombinedInstanceDto combinedInstanceDto = (CombinedInstanceDto) uiInstanceService.findInstance(request, parameterMap).getData().get(0); Assert.assertEquals(testInstanceEntity.getAppClusterName(), combinedInstanceDto.getAppClusterName()); Assert.assertEquals(testInstanceEntity.getCandAppId(), combinedInstanceDto.getCandAppId()); uiInstanceService.setFinalStatus(combinedInstanceDto); Assert.assertEquals(0, combinedInstanceDto.getFinalStatus()); }