ServiceMetadata extends AbstractServiceMetadata<Endpoint> implements Serializable { public static ServiceMetadata of(ParticipantIdentifier participantIdentifier, DocumentTypeIdentifier documentTypeIdentifier, List<ProcessMetadata<Endpoint>> processes) { return new ServiceMetadata(participantIdentifier, documentTypeIdentifier, processes); } private  ServiceMetadata(ParticipantIdentifier participantIdentifier, DocumentTypeIdentifier documentTypeIdentifier,
                            List<ProcessMetadata<Endpoint>> processes); static ServiceMetadata of(ParticipantIdentifier participantIdentifier,
                                     DocumentTypeIdentifier documentTypeIdentifier,
                                     List<ProcessMetadata<Endpoint>> processes);  }
@Test public void simple() throws Exception { Endpoint endpoint1 = Endpoint.of( TransportProfile.AS2_1_0, URI.create("https: Mockito.mock(X509Certificate.class) ); Endpoint endpoint2 = Endpoint.of( TransportProfile.AS2_1_0, URI.create("https: Mockito.mock(X509Certificate.class) ); Endpoint endpoint3 = Endpoint.of( TransportProfile.AS4, URI.create("https: Mockito.mock(X509Certificate.class) ); ProcessMetadata<Endpoint> processMetadata1 = ProcessMetadata.of( ProcessIdentifier.of("Some:Process"), endpoint1, endpoint3); ProcessMetadata<Endpoint> processMetadata2 = ProcessMetadata.of( ProcessIdentifier.of("Other:Process"), endpoint2); ServiceMetadata serviceMetadata = ServiceMetadata.of( ParticipantIdentifier.of("9908:991825827"), DocumentTypeIdentifier.of("Some:Document"), Arrays.asList(processMetadata1, processMetadata2) ); Assert.assertEquals(serviceMetadata.getProcesses().size(), 2); Assert.assertEquals(serviceMetadata.getParticipantIdentifier(), ParticipantIdentifier.of("9908:991825827")); Assert.assertEquals(serviceMetadata.getDocumentTypeIdentifier(), DocumentTypeIdentifier.of("Some:Document")); Assert.assertEquals(serviceMetadata.getEndpoint(ProcessIdentifier.of("Some:Process"), TransportProfile.AS2_1_0), endpoint1); Assert.assertEquals(serviceMetadata.getEndpoint(ProcessIdentifier.of("Some:Process"), TransportProfile.AS2_1_0, TransportProfile.AS4), endpoint1); Assert.assertEquals(serviceMetadata.getEndpoint(ProcessIdentifier.of("Some:Process"), TransportProfile.AS4, TransportProfile.AS2_1_0), endpoint3); Assert.assertEquals(serviceMetadata.getEndpoint(ProcessIdentifier.of("Other:Process"), TransportProfile.AS2_1_0), endpoint2); try { serviceMetadata.getEndpoint(ProcessIdentifier.of("Other:Process"), TransportProfile.AS4); Assert.fail(); } catch (EndpointNotFoundException e) { } try { serviceMetadata.getEndpoint(ProcessIdentifier.of("Another:Process"), TransportProfile.AS4, TransportProfile.AS2_1_0, TransportProfile.START); Assert.fail(); } catch (EndpointNotFoundException e) { } }