Repository: incubator-tephra Updated Branches: refs/heads/master 1502a021f -> 99c7bec49 (forced update)
http://git-wip-us.apache.org/repos/asf/incubator-tephra/blob/99c7bec4/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java ---------------------------------------------------------------------- diff --git a/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java b/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java index 77e9232..24798ca 100644 --- a/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java +++ b/tephra-core/src/test/java/org/apache/tephra/TransactionSystemTest.java @@ -33,25 +33,33 @@ import java.util.concurrent.TimeUnit; */ public abstract class TransactionSystemTest { - public static final byte[] C1 = new byte[] { 'c', '1' }; - public static final byte[] C2 = new byte[] { 'c', '2' }; - public static final byte[] C3 = new byte[] { 'c', '3' }; - public static final byte[] C4 = new byte[] { 'c', '4' }; + private static final byte[] C1 = new byte[] { 'c', '1' }; + private static final byte[] C2 = new byte[] { 'c', '2' }; + private static final byte[] C3 = new byte[] { 'c', '3' }; + private static final byte[] C4 = new byte[] { 'c', '4' }; protected abstract TransactionSystemClient getClient() throws Exception; protected abstract TransactionStateStorage getStateStorage() throws Exception; - // Unfortunately, in-memory mode and thrift mode throw different exceptions here - @Test(expected = Exception.class) + @Test // can't do (expected=IllegalArgumentException) because the subclass needs to perform an extra assert public void testNegativeTimeout() throws Exception { - getClient().startShort(-1); + try { + getClient().startShort(-1); + Assert.fail("Expected illegal argument for negative timeout"); + } catch (IllegalArgumentException e) { + // expected + } } - // Unfortunately, in-memory mode and thrift mode throw different exceptions here - @Test(expected = Exception.class) + @Test // can't do (expected=IllegalArgumentException) because the subclass needs to perform an extra assert public void testExcessiveTimeout() throws Exception { - getClient().startShort((int) TimeUnit.DAYS.toSeconds(10)); + try { + getClient().startShort((int) TimeUnit.DAYS.toSeconds(10)); + Assert.fail("Expected illegal argument for excessive timeout"); + } catch (IllegalArgumentException e) { + // expected + } } @Test
