### Question:
StandaloneEndpointPublisher implements EndpointPublisher { static int getPort() { int port = DEFAULT_PORT; final String portAsStr = System.getProperty(DEFAULT_PORT_PROPERTY); if (portAsStr != null) { port = Integer.parseInt(portAsStr); } return port; }  Endpoint publish(ServiceDomain domain, String context, InboundHandler handler); static HttpRequestInfo getRequestInfo(HttpExchange request, ContentType type); static final int DEFAULT_PORT; static final String DEFAULT_PORT_PROPERTY; }### Answer:
@Test public void useDefaultPort() { final int port = StandaloneEndpointPublisher.getPort(); assertThat(port, is(equalTo(StandaloneEndpointPublisher.DEFAULT_PORT))); }
@Test public void useConfiguredPort() { System.setProperty(StandaloneEndpointPublisher.DEFAULT_PORT_PROPERTY, Integer.toString(TEST_PORT)); final int port = StandaloneEndpointPublisher.getPort(); assertThat(port, is(equalTo(TEST_PORT))); }