| 1 17 18 24 package javax.resource.spi.work; 25 26 import javax.resource.NotSupportedException; 27 import junit.framework.TestCase; 28 29 35 public class ExecutionContextTest extends TestCase { 36 37 public void testConstructor() { 38 ExecutionContext context = new ExecutionContext(); 39 assertNull(context.getXid()); 40 assertEquals(-1, context.getTransactionTimeout()); 41 } 42 43 public void testNegativeTimeout() { 44 ExecutionContext context = new ExecutionContext(); 45 try { 46 context.setTransactionTimeout(-1); 47 } catch (NotSupportedException nse) { 48 assertEquals("Illegal timeout value", nse.getMessage()); 49 return; 50 } 51 fail("Expected NotSupportedException."); 52 } 53 54 public void testZeroTimeout() { 55 ExecutionContext context = new ExecutionContext(); 56 try { 57 context.setTransactionTimeout(0); 58 } catch (NotSupportedException nse) { 59 assertEquals("Illegal timeout value", nse.getMessage()); 60 return; 61 } 62 fail("Expected NotSupportedException."); 63 } 64 } 65 | Popular Tags |