### Question:
SecurityHelper { public String getCurrentRealm() { TokenDetails tokenDetails = null; Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); if (authentication != null && !(authentication instanceof AnonymousAuthenticationToken)) { tokenDetails = getTokenDetails(authentication); } if (tokenDetails != null) { return tokenDetails.getRealm(); } return null; }  String getCurrentRealm(); String getCurrentLogin();  }### Answer:
@Test void getCurrentRealm() { SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken(LOGIN, getTokenDetails(), new ArrayList<>())); assertNotNull(SecurityContextHolder.getContext().getAuthentication()); assertEquals(REALM, securityHelper.getCurrentRealm()); }
@Test void getCurrentRealmTokenDetailsIsNull() { SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken(LOGIN, null, new ArrayList<>())); assertNotNull(SecurityContextHolder.getContext().getAuthentication()); assertNull(securityHelper.getCurrentRealm()); }
@Test void getCurrentRealmDefaultRealm() { SecurityContextHolder.clearContext(); assertNull(SecurityContextHolder.getContext().getAuthentication()); assertNull(securityHelper.getCurrentRealm()); }