Examples of FalseOn5xx


Examples of org.jclouds.abiquo.AbiquoFallbacks.FalseOn5xx

* @author Ignasi Barrera
*/
@Test(groups = "unit", testName = "FalseOn5xxTest")
public class FalseOn5xxTest {
   public void testOriginalExceptionIfNotHttpResponseException() {
      FalseOn5xx function = new FalseOn5xx();
      RuntimeException exception = new RuntimeException();

      try {
         function.createOrPropagate(exception);
      } catch (Exception ex) {
         assertEquals(ex, exception);
      }
   }
View Full Code Here

Examples of org.jclouds.abiquo.AbiquoFallbacks.FalseOn5xx

         assertEquals(ex, exception);
      }
   }

   public void testFalseIf5xx() throws Exception {
      FalseOn5xx function = new FalseOn5xx();
      HttpResponse response = EasyMock.createMock(HttpResponse.class);
      HttpResponseException exception = EasyMock.createMock(HttpResponseException.class);

      // Status code is called twice
      expect(response.getStatusCode()).andReturn(503);
      expect(response.getStatusCode()).andReturn(503);
      // Get response gets called twice
      expect(exception.getResponse()).andReturn(response);
      expect(exception.getResponse()).andReturn(response);
      // Get cause is called to determine the root cause
      expect(exception.getCause()).andReturn(null);

      replay(response);
      replay(exception);

      assertFalse(function.createOrPropagate(exception));

      verify(response);
      verify(exception);
   }
View Full Code Here

Examples of org.jclouds.abiquo.AbiquoFallbacks.FalseOn5xx

      verify(response);
      verify(exception);
   }

   public void testExceptionIfNot5xx() {
      FalseOn5xx function = new FalseOn5xx();
      HttpResponse response = EasyMock.createMock(HttpResponse.class);
      HttpResponseException exception = EasyMock.createMock(HttpResponseException.class);

      // Status code is called twice
      expect(response.getStatusCode()).andReturn(600);
      expect(response.getStatusCode()).andReturn(600);
      // Get response gets called twice
      expect(exception.getResponse()).andReturn(response);
      expect(exception.getResponse()).andReturn(response);
      // Get cause is called to determine the root cause
      expect(exception.getCause()).andReturn(null);

      replay(response);
      replay(exception);

      try {
         function.createOrPropagate(exception);
      } catch (Exception ex) {
         assertEquals(ex, exception);
      }

      verify(response);
View Full Code Here

Examples of org.jclouds.abiquo.AbiquoFallbacks.FalseOn5xx

* Unit tests for the {@link FalseOn5xx} function.
*/
@Test(groups = "unit", testName = "FalseOn5xxTest")
public class FalseOn5xxTest {
   public void testOriginalExceptionIfNotHttpResponseException() {
      FalseOn5xx function = new FalseOn5xx();
      RuntimeException exception = new RuntimeException();

      try {
         function.createOrPropagate(exception);
      } catch (Exception ex) {
         assertEquals(ex, exception);
      }
   }
View Full Code Here

Examples of org.jclouds.abiquo.AbiquoFallbacks.FalseOn5xx

         assertEquals(ex, exception);
      }
   }

   public void testFalseIf5xx() throws Exception {
      FalseOn5xx function = new FalseOn5xx();
      HttpResponse response = EasyMock.createMock(HttpResponse.class);
      HttpResponseException exception = EasyMock.createMock(HttpResponseException.class);

      // Status code is called twice
      expect(response.getStatusCode()).andReturn(503);
      expect(response.getStatusCode()).andReturn(503);
      // Get response gets called twice
      expect(exception.getResponse()).andReturn(response);
      expect(exception.getResponse()).andReturn(response);
      // Get cause is called to determine the root cause
      expect(exception.getCause()).andReturn(null);

      replay(response);
      replay(exception);

      assertFalse(function.createOrPropagate(exception));

      verify(response);
      verify(exception);
   }
View Full Code Here

Examples of org.jclouds.abiquo.AbiquoFallbacks.FalseOn5xx

      verify(response);
      verify(exception);
   }

   public void testExceptionIfNot5xx() {
      FalseOn5xx function = new FalseOn5xx();
      HttpResponse response = EasyMock.createMock(HttpResponse.class);
      HttpResponseException exception = EasyMock.createMock(HttpResponseException.class);

      // Status code is called twice
      expect(response.getStatusCode()).andReturn(600);
      expect(response.getStatusCode()).andReturn(600);
      // Get response gets called twice
      expect(exception.getResponse()).andReturn(response);
      expect(exception.getResponse()).andReturn(response);
      // Get cause is called to determine the root cause
      expect(exception.getCause()).andReturn(null);

      replay(response);
      replay(exception);

      try {
         function.createOrPropagate(exception);
      } catch (Exception ex) {
         assertEquals(ex, exception);
      }

      verify(response);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.