TrustedServiceQSCDConsistency implements TrustedServiceCondition { @Override public boolean isConsistent(TrustedServiceWrapper trustedService) { List<String> capturedQualifiers = trustedService.getCapturedQualifiers(); boolean qscd = ServiceQualification.isQcWithQSCD(capturedQualifiers) || ServiceQualification.isQcQSCDStatusAsInCert(capturedQualifiers) || ServiceQualification.isQcQSCDManagedOnBehalf(capturedQualifiers); boolean noQscd = ServiceQualification.isQcNoQSCD(capturedQualifiers); if (qscd) { return !noQscd; } return true; }  @Override boolean isConsistent(TrustedServiceWrapper trustedService);  }
@Test public void testNoInfo() { TrustedServiceWrapper service = new TrustedServiceWrapper(); assertTrue(condition.isConsistent(service)); }
@Test public void testQSCD() { TrustedServiceWrapper service = new TrustedServiceWrapper(); service.setCapturedQualifiers(Arrays.asList(ServiceQualification.QC_WITH_QSCD)); assertTrue(condition.isConsistent(service)); }
@Test public void testNoQSCD() { TrustedServiceWrapper service = new TrustedServiceWrapper(); service.setCapturedQualifiers(Arrays.asList(ServiceQualification.QC_NO_QSCD)); assertTrue(condition.isConsistent(service)); }
@Test public void testConflict() { TrustedServiceWrapper service = new TrustedServiceWrapper(); service.setCapturedQualifiers(Arrays.asList(ServiceQualification.QC_NO_QSCD, ServiceQualification.QC_WITH_QSCD)); assertFalse(condition.isConsistent(service)); }