コード例 #1
0
 @Test(expectedExceptions = ProxyCannotBeStartedException.class)
 public void testStartShouldThrowExceptionWhenTheProxyCannotBeStarted() throws Exception {
   // GIVEN
   int requestTimeout = 30000;
   propertiesDTO = new PropertyDTO(0, requestTimeout);
   given(configurationAccess.getProperties()).willReturn(propertiesDTO);
   doThrow(Exception.class).when(server).start(requestTimeout);
   // WHEN
   underTest.start();
   // THEN exception thrown
 }
コード例 #2
0
 @Test
 public void testStartShouldStartTheProxySuccessfully() throws Exception {
   // GIVEN
   int requestTimeout = 30000;
   int proxyPort = 9092;
   propertiesDTO = new PropertyDTO(proxyPort, requestTimeout);
   given(configurationAccess.getProperties()).willReturn(propertiesDTO);
   // WHEN
   underTest.start();
   // THEN
   verify(server).setPort(proxyPort);
   verify(server).start(requestTimeout);
   verify(server).addRequestInterceptor(loggingRequestInterceptor);
   verify(server).addResponseInterceptor(loggingResponseInterceptor);
 }