DbSetupTracker { public void launchIfNecessary(@Nonnull DbSetup dbSetup) { boolean skipLaunch = nextLaunchSkipped && dbSetup.equals(lastSetupLaunched); nextLaunchSkipped = false; if (skipLaunch) { return; } dbSetup.launch(); lastSetupLaunched = dbSetup; }  void launchIfNecessary(@Nonnull DbSetup dbSetup); void skipNextLaunch(); @Override String toString();  }
@Test public void launchIfNecessaryLaunchesTheFirstTime() throws SQLException { DbSetupTracker tracker = new DbSetupTracker(); tracker.launchIfNecessary(dbSetup1); verify(operation1).execute(any(Connection.class), any(BinderConfiguration.class)); }
@Test public void launchIfNecessaryLaunchesIfNotSkipped() throws SQLException { DbSetupTracker tracker = new DbSetupTracker(); tracker.launchIfNecessary(dbSetup1); tracker.launchIfNecessary(dbSetup1); verify(operation1, times(2)).execute(any(Connection.class), any(BinderConfiguration.class)); }