DefaultIdentityManager extends IdentityManager { @Override public String getCurrentUser() { ensureInitialized(); return super.getCurrentUser(); } DefaultIdentityManager(Properties properties); @Override String getCurrentUser(); @Override String getCurrentGroup(); @Override boolean isMonitorRunning();  }
@Test public void testNoDialogForNoUsers() { Mockito.when(mockPersistence.getAllUsers()).thenReturn(Collections.<String>emptySet()); new DefaultIdentityManager(mockProperties).getCurrentUser(); Mockito.verify(mockWindowing, Mockito.never()).showInputDialog(Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.<Map<String,Object>>any()); }
@Test public void testNoDialogForOneUsers() { Set<String> oneElementSet = new HashSet<String>(); oneElementSet.add("testUser1"); Mockito.when(mockPersistence.getAllUsers()).thenReturn(oneElementSet); new DefaultIdentityManager(mockProperties).getCurrentUser(); Mockito.verify(mockWindowing, Mockito.never()).showInputDialog(Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.<Map<String,Object>>any()); }
@Test public void testDialogForUsers() { new DefaultIdentityManager(mockProperties).getCurrentUser(); Mockito.verify(mockWindowing, Mockito.times(1)).showInputDialog(Mockito.anyString(), Mockito.anyString(), Mockito.<Object[]>any(), Mockito.any(), Mockito.<Map<String,Object>>any()); }