HostsRepositoryVersionCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { return super.isApplicable(request) && request.getRepositoryVersion() != null; } HostsRepositoryVersionCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }
@Test public void testIsApplicable() throws Exception { final PrereqCheckRequest request = new PrereqCheckRequest("cluster"); request.setRepositoryVersion("not null"); HostsRepositoryVersionCheck hrvc = new HostsRepositoryVersionCheck(); Configuration config = Mockito.mock(Configuration.class); hrvc.config = config; Assert.assertTrue(hrvc.isApplicable(request)); Assert.assertTrue(new HostsMasterMaintenanceCheck().isApplicable(request)); HostsRepositoryVersionCheck hrvc2 = new HostsRepositoryVersionCheck(); hrvc2.config = config; Assert.assertTrue(hrvc2.isApplicable(request)); request.setRepositoryVersion(null); HostsMasterMaintenanceCheck hmmc2 = new HostsMasterMaintenanceCheck(); hmmc2.config = config; Assert.assertFalse(hmmc2.isApplicable(request)); }