Search in sources :

Example 1 with VersionInfo

use of com.quorum.tessera.partyinfo.node.VersionInfo in project tessera by ConsenSys.

the class NodeInfoUtilTest method from.

@Test
public void from() {
    PartyInfo partyInfo = mock(PartyInfo.class);
    VersionInfo versionInfo = mock(VersionInfo.class);
    Recipient recipient = Recipient.of(mock(PublicKey.class), "someurl");
    when(partyInfo.getUrl()).thenReturn("someurl");
    when(versionInfo.supportedApiVersions()).thenReturn(Set.of("v1", "v3"));
    when(partyInfo.getRecipients()).thenReturn(Set.of(recipient));
    NodeInfo nodeInfo = NodeInfoUtil.from(partyInfo, Set.of("v1", "v3"));
    assertThat(nodeInfo).isNotNull();
    assertThat(nodeInfo.getUrl()).isEqualTo("someurl");
    assertThat(nodeInfo.supportedApiVersions()).isEqualTo(Set.of("v3", "v1"));
    assertThat(nodeInfo.getRecipients()).hasSize(1);
    assertThat(nodeInfo.getRecipients().iterator().next().getUrl()).isEqualTo("someurl");
}
Also used : VersionInfo(com.quorum.tessera.partyinfo.node.VersionInfo) PublicKey(com.quorum.tessera.encryption.PublicKey) NodeInfo(com.quorum.tessera.partyinfo.node.NodeInfo) Test(org.junit.Test)

Aggregations

PublicKey (com.quorum.tessera.encryption.PublicKey)1 NodeInfo (com.quorum.tessera.partyinfo.node.NodeInfo)1 VersionInfo (com.quorum.tessera.partyinfo.node.VersionInfo)1 Test (org.junit.Test)1