test recoverable exceptions
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/29ef0c8c Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/29ef0c8c Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/29ef0c8c Branch: refs/heads/master Commit: 29ef0c8cb3f4092f24c2c99911a69d2805d7a2bd Parents: 9077ad0 Author: randgalt <randg...@apache.org> Authored: Mon Jun 2 11:26:17 2014 -0500 Committer: randgalt <randg...@apache.org> Committed: Mon Jun 2 11:26:17 2014 -0500 ---------------------------------------------------------------------- .../java/org/apache/curator/x/rpc/RpcTests.java | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/29ef0c8c/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java ---------------------------------------------------------------------- diff --git a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java index 5a83b25..0862b11 100644 --- a/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java +++ b/curator-x-rpc/src/test/java/org/apache/curator/x/rpc/RpcTests.java @@ -203,5 +203,24 @@ public class RpcTests extends BaseClassForTests service.shutdownNow(); } -} + @Test + public void testRecoverableException() throws Exception + { + CuratorProjection curatorProjection = curatorServiceClient.newCuratorProjection("test"); + CreateSpec spec = new CreateSpec(); + spec.path = "/this/wont/work"; + spec.data = ByteBuffer.wrap("value".getBytes()); + try + { + curatorServiceClient.createNode(curatorProjection, spec); + Assert.fail("Should have failed"); + } + catch ( CuratorException e ) + { + Assert.assertEquals(e.getType(), ExceptionType.NODE); + Assert.assertNotNull(e.nodeException); + Assert.assertEquals(e.nodeException, NodeExceptionType.NONODE); + } + } +}