DTOConverter { public static SignatureValue toSignatureValue(SignatureValueDTO signatureValueDTO) { if (signatureValueDTO != null) { return new SignatureValue(signatureValueDTO.getAlgorithm(), signatureValueDTO.getValue()); } return null; }  static ToBeSigned toToBeSigned(ToBeSignedDTO toBeSignedDTO); static ToBeSignedDTO toToBeSignedDTO(ToBeSigned toBeSigned); static SignatureValue toSignatureValue(SignatureValueDTO signatureValueDTO); static SignatureValueDTO toSignatureValueDTO(SignatureValue signatureValue); static Digest toDigest(DigestDTO digestDTO); static DigestDTO toDigestDTO(Digest digest);  }
@Test public void toSignatureValueTest() { SignatureValueDTO signatureValueDTO = new SignatureValueDTO(SignatureAlgorithm.RSA_SHA256, Utils.fromBase64("7b907e3ef6f8a4342ba42f9c66518bf32f0ec242e8784284c1d8cd816cd77bf2")); SignatureValue signatureValue = DTOConverter.toSignatureValue(signatureValueDTO); assertEquals(signatureValueDTO.getAlgorithm(), signatureValue.getAlgorithm()); assertTrue(Arrays.equals(signatureValueDTO.getValue(), signatureValue.getValue())); assertEquals(signatureValueDTO.hashCode(), signatureValue.hashCode()); }
@Test public void toSignatureValueNullArrayTest() { SignatureValueDTO signatureValueDTO = new SignatureValueDTO(SignatureAlgorithm.RSA_SHA256, null); SignatureValue signatureValue = DTOConverter.toSignatureValue(signatureValueDTO); assertEquals(signatureValueDTO.getAlgorithm(), signatureValue.getAlgorithm()); assertNull(signatureValueDTO.getValue()); assertEquals(signatureValueDTO.hashCode(), signatureValue.hashCode()); }
@Test public void toSignatureValueNullTest() { SignatureValue signatureValue = DTOConverter.toSignatureValue(null); assertNull(signatureValue); }