コード例 #1
0
 @Test
 public void testInterceptorWithMissingNullArgument() {
   InterceptorResult result = interceptor.invoke(null, mockOperationKey1, new Object[] {null});
   assertNotNull(result);
   assertEquals(InterceptorState.FORCE_ON_EXCEPTION, result.getState());
   assertTrue(result.getResult() instanceof CougarValidationException);
 }
コード例 #2
0
  @Test
  public void testInterceptorWithMissingMandatoryAttributesOfCollectionParam2() {
    List<MyComplexObject> l = new ArrayList<MyComplexObject>();
    l.add(new MyComplexObject(false));

    InterceptorResult result = interceptor.invoke(null, mockOperationKey2, new Object[] {l, null});
    assertNotNull(result);
    assertEquals(InterceptorState.FORCE_ON_EXCEPTION, result.getState());
    assertTrue(result.getResult() instanceof CougarValidationException);
  }
コード例 #3
0
  @Test
  public void testInterceptorWithCollections() {
    List<MyComplexObject> l = new ArrayList<MyComplexObject>();
    l.add(new MyComplexObject(true));

    Map<String, MyComplexObject> m = new HashMap<String, MyComplexObject>();
    m.put("bob", new MyComplexObject(true));

    InterceptorResult result = interceptor.invoke(null, mockOperationKey2, new Object[] {l, m});
    assertEquals(InterceptorState.CONTINUE, result.getState());
    assertNull(result.getResult());
  }
コード例 #4
0
 @Test
 public void testInterceptorWithCorrectArguments() {
   InterceptorResult result = interceptor.invoke(null, mockOperationKey1, new Object[] {"1", "2"});
   assertEquals(InterceptorState.CONTINUE, result.getState());
 }