### Question:
AtlasMigrationPropertyCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { String atlasMigrationProperty = getProperty(request,"application-properties","atlas.migration.data.filename"); if(StringUtils.isBlank(atlasMigrationProperty)) { LOG.info("The property atlas.migration.data.filename is not found in application-properties, need to add the property before upgrade."); prerequisiteCheck.getFailedOn().add(serviceName); prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } else if (atlasMigrationProperty.contains("/etc/atlas/conf")) { LOG.info("The property atlas.migration.data.filename is found in application-properties, but it contains atlas conf path ie /etc/atlas/conf. Avoid using conf path for this property."); prerequisiteCheck.getFailedOn().add(serviceName); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } AtlasMigrationPropertyCheck(); Set<String> getApplicableServices(); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }### Answer:
@Test public void testPerform() throws Exception { final Cluster cluster = Mockito.mock(Cluster.class); final Map<String, Service> services = new HashMap<>(); final Service service = Mockito.mock(Service.class); services.put("ATLAS", service); Mockito.when(cluster.getServices()).thenReturn(services); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("application-properties", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); properties.put("atlas.migration.data.filename", ""); PrerequisiteCheck check = new PrerequisiteCheck(null, null); atlasMigrationPropertyCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus()); properties.put("atlas.migration.data.filename", "/etc/atlas/conf/upgrade_data.json"); check = new PrerequisiteCheck(null, null); atlasMigrationPropertyCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus()); properties.put("atlas.migration.data.filename", "/home/atlas/upgrade_data.json"); check = new PrerequisiteCheck(null, null); atlasMigrationPropertyCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus()); }