Package org.jclouds.abiquo.AbiquoFallbacks

Examples of org.jclouds.abiquo.AbiquoFallbacks.NullOn303


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

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


         assertEquals(ex, exception);
      }
   }

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

      // Status code is called once
      expect(response.getStatusCode()).andReturn(303);
      // 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);

      assertNull(function.createOrPropagate(exception));

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

      verify(response);
      verify(exception);
   }

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

      // Status code is called once
      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 NullOn303} function.
*/
@Test(groups = "unit", testName = "NullOn303Test")
public class NullOn303Test {
   public void testOriginalExceptionIfNotHttpResponseException() {
      NullOn303 function = new NullOn303();
      RuntimeException exception = new RuntimeException();

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

         assertEquals(ex, exception);
      }
   }

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

      // Status code is called once
      expect(response.getStatusCode()).andReturn(303);
      // 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);

      assertNull(function.createOrPropagate(exception));

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

      verify(response);
      verify(exception);
   }

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

      // Status code is called once
      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.NullOn303

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.