CurrentUser { public static String getUser() { String user = getUserInternal(); if (user == null) { throw new IllegalStateException("No user logged into the system"); } else { return user; } }  static CurrentUser get(); static void authenticate(String user); static Subject getSubject(); static String getUser();  }
@Test(threadPoolSize = 10, invocationCount = 10, timeOut = 10000) public void testGetUser() throws Exception { String id = Long.toString(System.nanoTime()); CurrentUser.authenticate(id); Assert.assertEquals(CurrentUser.getUser(), id); }