HsqlDatabaseManagerSwingTask extends Task { public boolean shouldRegister(Map<String, String> properties) { String propertyName = HsqlDatabaseManagerSwingTask.class.getCanonicalName(); ok = url.contains(":hsqldb:mem:") && properties.containsKey(propertyName) && "true".equals(properties.get(propertyName)); return ok; } HsqlDatabaseManagerSwingTask(String url); @Override void execute(ImmutableMultimap<String, String> parameters, PrintWriter output); boolean shouldRegister(Map<String, String> properties);  }
@Test public void whenShouldRegisterWithEverythingRequired() { task = new HsqlDatabaseManagerSwingTask(URL_HSQLDB); properties.put(HsqlDatabaseManagerSwingTask.class.getCanonicalName(), Boolean.TRUE.toString()); boolean actual = task.shouldRegister(properties); assertThat(actual).isTrue().isEqualTo(task.ok); }
@Test public void whenShouldRegisterWithoutHsqldbUrl() { task = new HsqlDatabaseManagerSwingTask(URL_NON_HSQLDB); properties.put(HsqlDatabaseManagerSwingTask.class.getCanonicalName(), Boolean.TRUE.toString()); boolean actual = task.shouldRegister(properties); assertThat(actual).isFalse().isEqualTo(task.ok); }