@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(); }
@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); }
@Test(expected = IllegalStateException.class) public void testRemoveAttachmentFail() { InterceptorScopeInvocation transaction = new DefaultInterceptorScopeInvocation("test"); transaction.removeAttachment(); }