use of com.quorum.tessera.config.keypairs.DirectKeyPair in project tessera by ConsenSys.
the class KeyDataMarshallerTest method defaultMarshal.
@Test
public void defaultMarshal() {
KeyDataMarshaller k = new DefaultKeyDataMarshaller();
DirectKeyPair configKeyPair = new DirectKeyPair("PUBLIC", "PRIVATE");
KeyData keyData = k.marshal(configKeyPair);
assertThat(keyData).isNotNull();
assertThat(keyData.getPublicKey()).isEqualTo("PUBLIC");
assertThat(keyData.getPrivateKey()).isEqualTo("PRIVATE");
}
use of com.quorum.tessera.config.keypairs.DirectKeyPair in project tessera by ConsenSys.
the class ValidationTest method directKeyPairInvalidBase64.
@Test
public void directKeyPairInvalidBase64() {
DirectKeyPair keyPair = new DirectKeyPair("INVALID_BASE", "INVALID_BASE");
Set<ConstraintViolation<DirectKeyPair>> violations = validator.validate(keyPair);
assertThat(violations).hasSize(2);
Iterator<ConstraintViolation<DirectKeyPair>> iterator = violations.iterator();
ConstraintViolation<DirectKeyPair> violation = iterator.next();
assertThat(violation.getMessageTemplate()).isEqualTo("Invalid Base64 key provided");
ConstraintViolation<DirectKeyPair> violation2 = iterator.next();
assertThat(violation2.getMessageTemplate()).isEqualTo("Invalid Base64 key provided");
}
Aggregations