コード例 #1
0
  @Test(expected = IllegalStateException.class)
  public void testRemoveAttachmentFail2() {
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");

    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    transaction.canLeave(ExecutionPolicy.ALWAYS);
    transaction.leave(ExecutionPolicy.ALWAYS);

    transaction.removeAttachment();
  }
コード例 #2
0
  @Test
  public void testAttachment3() {
    String oldAttachment = "context";
    String newAttachment = "newnew";
    InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");

    transaction.tryEnter(ExecutionPolicy.ALWAYS);
    transaction.setAttachment(oldAttachment);
    assertSame(oldAttachment, transaction.getAttachment());
    assertSame(oldAttachment, transaction.setAttachment(newAttachment));
    assertSame(newAttachment, transaction.getAttachment());
    assertSame(newAttachment, transaction.removeAttachment());
    assertNull(transaction.getAttachment());
    transaction.canLeave(ExecutionPolicy.ALWAYS);
    transaction.leave(ExecutionPolicy.ALWAYS);
  }
コード例 #3
0
 @Test(expected = IllegalStateException.class)
 public void testRemoveAttachmentFail() {
   InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test");
   transaction.removeAttachment();
 }