### Question:
CurrentUser { public static String getUser() { CurrentUser user = CURRENT_USER.get(); if (user == null || user.proxyUser == null) { throw new IllegalStateException("No user logged into the system"); } else { return user.proxyUser; } } private  CurrentUser(String authenticatedUser); static void authenticate(final String user); static void proxyDoAsUser(final String doAsUser, final String proxyHost); static void proxy(final String aclOwner, final String aclGroup); static void clear(); static boolean isAuthenticated(); static String getAuthenticatedUser(); static UserGroupInformation getAuthenticatedUGI(); static String getUser(); static UserGroupInformation createProxyUGI(String proxyUser); static UserGroupInformation getProxyUGI(); static Set<String> getGroupNames(); static String getPrimaryGroupName();  }### Answer:
@Test(threadPoolSize = 10, invocationCount = 10, timeOut = 10000) public void testGetUser() throws Exception { String id = Long.toString(System.nanoTime()); CurrentUser.authenticate(id); Assert.assertEquals(CurrentUser.getAuthenticatedUser(), id); Assert.assertEquals(CurrentUser.getUser(), id); }
@Test (expectedExceptions = IllegalStateException.class) public void testGetUserInvalid() throws Exception { CurrentUser.getUser(); }