Examples of AutoDiscoveryException


Examples of org.rhq.enterprise.communications.command.server.discovery.AutoDiscoveryException

        ITestAnnotatedPojo pojo = agent1.getClientCommandSender().getClientRemotePojoFactory().getRemotePojo(
            ITestAnnotatedPojo.class);

        try {
            // AutoDiscoveryException matches the throws clause - will not be wrapped
            pojo.throwSpecificException(new AutoDiscoveryException("should not be wrapped"));
        } catch (AutoDiscoveryException expected) {
            assert expected.getMessage().equals("should not be wrapped");
        }

        try {
            // IOException matches the throws clause - will not be wrapped
            pojo.throwSpecificException(new IOException("should not be wrapped"));
        } catch (IOException expected) {
            assert expected.getMessage().equals("should not be wrapped");
        }

        try {
            // IllegalArgumentException doesn't match throws but is a java.* runtime exception - will not be wrapped
            pojo.throwSpecificException(new IllegalArgumentException("should not be wrapped"));
        } catch (IllegalArgumentException expected) {
            assert expected.getMessage().equals("should not be wrapped");
        }

        try {
            // IllegalArgumentException doesn't match throws but it and its causes are java.* exceptions - will not be wrapped
            pojo.throwSpecificException(new IllegalArgumentException("should not be wrapped", new Exception("inner 1",
                new IllegalStateException("inner 2"))));
        } catch (IllegalArgumentException expected) {
            assert expected.getMessage().equals("should not be wrapped");
            assert expected.getCause() instanceof Exception;
            assert expected.getCause().getMessage().equals("inner 1");
            assert expected.getCause().getCause() instanceof IllegalStateException;
            assert expected.getCause().getCause().getMessage().equals("inner 2");
        }

        try {
            // AutoDiscoveryException match throws so we assume the developer knows what he is doing and only
            // includes causes within it that are allowed to be sent over the wire - it is not wrapped
            pojo.throwSpecificException(new AutoDiscoveryException("should not be wrapped", new CannotConnectException(
                "inner exception")));
        } catch (AutoDiscoveryException expected) {
            assert expected.getMessage().equals("should not be wrapped");
            assert expected.getCause() instanceof CannotConnectException;
            assert expected.getCause().getMessage().equals("inner exception");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.