TrustedServiceLegalPersonConsistency implements TrustedServiceCondition { @Override public boolean isConsistent(TrustedServiceWrapper trustedService) { List<String> capturedQualifiers = trustedService.getCapturedQualifiers(); boolean qcForLegalPerson = ServiceQualification.isQcForLegalPerson(capturedQualifiers); boolean qcForEsig = ServiceQualification.isQcForEsig(capturedQualifiers); return (!(qcForLegalPerson && qcForEsig)); }  @Override boolean isConsistent(TrustedServiceWrapper trustedService);  }
@Test public void testEmpty() { TrustedServiceWrapper service = new TrustedServiceWrapper(); assertTrue(condition.isConsistent(service)); }
@Test public void testLegalOnly() { TrustedServiceWrapper service = new TrustedServiceWrapper(); service.setCapturedQualifiers(Arrays.asList(ServiceQualification.QC_FOR_LEGAL_PERSON)); assertTrue(condition.isConsistent(service)); }
@Test public void testESigOnly() { TrustedServiceWrapper service = new TrustedServiceWrapper(); service.setCapturedQualifiers(Arrays.asList(ServiceQualification.QC_FOR_ESIG)); assertTrue(condition.isConsistent(service)); }
@Test public void testConflict() { TrustedServiceWrapper service = new TrustedServiceWrapper(); service.setCapturedQualifiers(Arrays.asList(ServiceQualification.QC_FOR_ESIG, ServiceQualification.QC_FOR_LEGAL_PERSON)); assertFalse(condition.isConsistent(service)); }