@Test public void testWatchers() { Properties properties = new Properties(); MavenSession session = mock(MavenSession.class); when(session.getExecutionProperties()).thenReturn(properties); assertThat(Watchers.all(session)).isEmpty(); Watcher watcher1 = mock(Watcher.class); Watchers.add(session, watcher1); assertThat(Watchers.all(session)).hasSize(1); Watcher watcher2 = mock(Watcher.class); Watchers.add(session, watcher2); assertThat(Watchers.all(session)).hasSize(2); assertThat(Watchers.remove(session, watcher1)).isTrue(); assertThat(Watchers.remove(session, null)).isFalse(); assertThat(Watchers.all(session)).hasSize(1); }
private Watchers() { }
Watchers { private Watchers() { } }
Watchers { private Watchers() { } private  Watchers(); }
Watchers { private Watchers() { } private  Watchers(); static synchronized void add(MavenSession session, Watcher watcher); static synchronized void add(Context context, Watcher watcher); static synchronized boolean remove(MavenSession session, Watcher watcher); static synchronized boolean contains(MavenSession session, Watcher watcher); static synchronized List<Watcher> all(MavenSession session); static synchronized List<Watcher> all(Context context); }
Watchers { private Watchers() { } private  Watchers(); static synchronized void add(MavenSession session, Watcher watcher); static synchronized void add(Context context, Watcher watcher); static synchronized boolean remove(MavenSession session, Watcher watcher); static synchronized boolean contains(MavenSession session, Watcher watcher); static synchronized List<Watcher> all(MavenSession session); static synchronized List<Watcher> all(Context context); static final String WATCHERS_KEY; }