Package org.jclouds.abiquo.AbiquoFallbacks

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


         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

      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

* 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

         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

      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

Related Classes of org.jclouds.abiquo.AbiquoFallbacks.FalseOn5xx

Copyright © 2018 www.massapicom. 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.