@Test public void contentIdentifierCheck() throws Exception { XmlSignature sig = new XmlSignature(); sig.setContentIdentifier("Valid_Value"); ValueConstraint constraint = new ValueConstraint(); constraint.setLevel(Level.FAIL); constraint.setValue("Valid_Value"); XmlSAV result = new XmlSAV(); ContentIdentifierCheck cic = new ContentIdentifierCheck(result, new SignatureWrapper(sig), constraint); cic.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.OK, constraints.get(0).getStatus()); }
@Test public void failedContentIdentifierCheck() throws Exception { XmlSignature sig = new XmlSignature(); sig.setContentIdentifier("Invalid_Value"); ValueConstraint constraint = new ValueConstraint(); constraint.setLevel(Level.FAIL); constraint.setValue("Valid_Value"); XmlSAV result = new XmlSAV(); ContentIdentifierCheck cic = new ContentIdentifierCheck(result, new SignatureWrapper(sig), constraint); cic.execute(); List<XmlConstraint> constraints = result.getConstraint(); assertEquals(1, constraints.size()); assertEquals(XmlStatus.NOT_OK, constraints.get(0).getStatus()); } }