@Test
public void testPerform() throws Exception {

  final Cluster cluster = Mockito.mock(Cluster.class);
  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");
  Mockito.when(cluster.getDesiredConfigs()).thenReturn(Collections.singletonMap("yarn-site", desiredConfig));
  final Config config = Mockito.mock(Config.class);
  Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config);
  final Map<String, String> properties = new HashMap<String, String>();
  Mockito.when(config.getProperties()).thenReturn(properties);
  PrerequisiteCheck check = new PrerequisiteCheck(null, null);
  servicesYarnWorkPreservingCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus());
  properties.put("yarn.resourcemanager.work-preserving-recovery.enabled", "true");
  check = new PrerequisiteCheck(null, null);
  servicesYarnWorkPreservingCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}