@Test public void test_general_exceptions() { when(diagnostics.invoke(MBEAN_SERVER, "getTCProperties")).thenReturn(MESSAGE_REQUEST_TIMEOUT); assertThat( () -> service.getTCProperties(), is(throwing(instanceOf(DiagnosticOperationTimeoutException.class)).andMessage(is(equalTo(MESSAGE_REQUEST_TIMEOUT))))); when(diagnostics.invoke(MBEAN_SERVER, "getTCProperties")).thenReturn(MESSAGE_INVALID_JMX); assertThat( () -> service.getTCProperties(), is(throwing(instanceOf(DiagnosticOperationExecutionException.class)).andMessage(is(equalTo(MESSAGE_INVALID_JMX))))); when(diagnostics.invoke(MBEAN_SERVER, "getTCProperties")).thenReturn(MESSAGE_UNKNOWN_COMMAND); assertThat( () -> service.getTCProperties(), is(throwing(instanceOf(DiagnosticOperationUnsupportedException.class)).andMessage(is(equalTo(MESSAGE_UNKNOWN_COMMAND))))); when(diagnostics.invoke(MBEAN_SERVER, "getTCProperties")).thenReturn(MESSAGE_NOT_PERMITTED); assertThat( () -> service.getTCProperties(), is(throwing(instanceOf(DiagnosticOperationNotAllowedException.class)).andMessage(is(equalTo(MESSAGE_NOT_PERMITTED))))); when(diagnostics.invoke(MBEAN_SERVER, "getTCProperties")).thenReturn(null); assertThat( () -> service.getTCProperties(), is(throwing(instanceOf(DiagnosticConnectionException.class)).andMessage(is(nullValue(String.class))))); }
@Override public String invoke(String name, String cmd) throws DiagnosticOperationTimeoutException, DiagnosticOperationExecutionException, DiagnosticConnectionException { return execute(() -> delegate.invoke(name, cmd)); }
DiagnosticServiceImpl implements DiagnosticService { @Override public String invoke(String name, String cmd) throws DiagnosticOperationTimeoutException, DiagnosticOperationExecutionException, DiagnosticConnectionException { return execute(() -> delegate.invoke(name, cmd)); } }
DiagnosticServiceImpl implements DiagnosticService { @Override public String invoke(String name, String cmd) throws DiagnosticOperationTimeoutException, DiagnosticOperationExecutionException, DiagnosticConnectionException { return execute(() -> delegate.invoke(name, cmd)); } DiagnosticServiceImpl(Connection connection, Diagnostics delegate, DiagnosticCodec<?> codec); }
DiagnosticServiceImpl implements DiagnosticService { @Override public String invoke(String name, String cmd) throws DiagnosticOperationTimeoutException, DiagnosticOperationExecutionException, DiagnosticConnectionException { return execute(() -> delegate.invoke(name, cmd)); } DiagnosticServiceImpl(Connection connection, Diagnostics delegate, DiagnosticCodec<?> codec); @Override boolean isConnected(); @Override T getProxy(Class<T> type); @Override void close(); @Override String get(String name, String attribute); @Override void set(String name, String attribute, String arg); @Override String invoke(String name, String cmd); @Override String invokeWithArg(String name, String cmd, String arg); @Override LogicalServerState getLogicalServerState(); @Override String getInitialState(); @Override String getClusterState(); @Override String getConfig(); @Override String getProcessArguments(); @Override String getThreadDump(); @Override void terminateServer(); @Override void forceTerminateServer(); }
DiagnosticServiceImpl implements DiagnosticService { @Override public String invoke(String name, String cmd) throws DiagnosticOperationTimeoutException, DiagnosticOperationExecutionException, DiagnosticConnectionException { return execute(() -> delegate.invoke(name, cmd)); } DiagnosticServiceImpl(Connection connection, Diagnostics delegate, DiagnosticCodec<?> codec); @Override boolean isConnected(); @Override T getProxy(Class<T> type); @Override void close(); @Override String get(String name, String attribute); @Override void set(String name, String attribute, String arg); @Override String invoke(String name, String cmd); @Override String invokeWithArg(String name, String cmd, String arg); @Override LogicalServerState getLogicalServerState(); @Override String getInitialState(); @Override String getClusterState(); @Override String getConfig(); @Override String getProcessArguments(); @Override String getThreadDump(); @Override void terminateServer(); @Override void forceTerminateServer();  }