@Test public void whenExecuteInvalidItShouldThrow() throws Exception { task = new HsqlDatabaseManagerSwingTask(URL_HSQLDB); task.execution = mock(Runnable.class); task.ok = false; try { task.execute(mock(ImmutableMultimap.class), mock(PrintWriter.class)); failBecauseExceptionWasNotThrown(IllegalStateException.class); } catch (IllegalStateException e) { verify(task.execution, never()).run(); } }
@Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { Preconditions.checkState(ok, "Registered without calling shouldRegister() or when returned false"); execution.run(); }
HsqlDatabaseManagerSwingTask extends Task { @Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { Preconditions.checkState(ok, "Registered without calling shouldRegister() or when returned false"); execution.run(); } }
HsqlDatabaseManagerSwingTask extends Task { @Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { Preconditions.checkState(ok, "Registered without calling shouldRegister() or when returned false"); execution.run(); } HsqlDatabaseManagerSwingTask(String url); }
HsqlDatabaseManagerSwingTask extends Task { @Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { Preconditions.checkState(ok, "Registered without calling shouldRegister() or when returned false"); execution.run(); } HsqlDatabaseManagerSwingTask(String url); @Override void execute(ImmutableMultimap<String, String> parameters, PrintWriter output); boolean shouldRegister(Map<String, String> properties); }
HsqlDatabaseManagerSwingTask extends Task { @Override public void execute(ImmutableMultimap<String, String> parameters, PrintWriter output) throws Exception { Preconditions.checkState(ok, "Registered without calling shouldRegister() or when returned false"); execution.run(); } HsqlDatabaseManagerSwingTask(String url); @Override void execute(ImmutableMultimap<String, String> parameters, PrintWriter output); boolean shouldRegister(Map<String, String> properties);  }