@Test public void should_mask_string_with_even_length() { assertThat( SecurityServiceImpl.maskSecondHalf("12345678901234567890"), is("1234567890XXXXXXXXXX")); }
static String maskSecondHalf(String s) { int pos = s.length() / 2; StringBuilder sb = new StringBuilder(s.substring(0, pos)); while (sb.length() < s.length()) { sb.append('X'); } return sb.toString(); }
SecurityServiceImpl implements SecurityService { static String maskSecondHalf(String s) { int pos = s.length() / 2; StringBuilder sb = new StringBuilder(s.substring(0, pos)); while (sb.length() < s.length()) { sb.append('X'); } return sb.toString(); } }
SecurityServiceImpl implements SecurityService { static String maskSecondHalf(String s) { int pos = s.length() / 2; StringBuilder sb = new StringBuilder(s.substring(0, pos)); while (sb.length() < s.length()) { sb.append('X'); } return sb.toString(); }  }
SecurityServiceImpl implements SecurityService { static String maskSecondHalf(String s) { int pos = s.length() / 2; StringBuilder sb = new StringBuilder(s.substring(0, pos)); while (sb.length() < s.length()) { sb.append('X'); } return sb.toString(); }  @PostConstruct void postConstruct(); @Override Long getCustomerId(); @Override void authenticateToken(String token); @Override void removeAuthentication(); @Override @Transactional String createCodeForWebappToken(Long customerId, WebappCredentials credentials); @Override @Transactional String tradeCodeToWebappToken(String code); @Scheduled(initialDelay = 60_000L, fixedRate = 600_000L) @Transactional @Override void removeExpiredTokenCodes(); @Override @Transactional String doHerokuSingleSignOn(
      String token, String externalId, String email, long timestampSeconds, String salt); }
SecurityServiceImpl implements SecurityService { static String maskSecondHalf(String s) { int pos = s.length() / 2; StringBuilder sb = new StringBuilder(s.substring(0, pos)); while (sb.length() < s.length()) { sb.append('X'); } return sb.toString(); }  @PostConstruct void postConstruct(); @Override Long getCustomerId(); @Override void authenticateToken(String token); @Override void removeAuthentication(); @Override @Transactional String createCodeForWebappToken(Long customerId, WebappCredentials credentials); @Override @Transactional String tradeCodeToWebappToken(String code); @Scheduled(initialDelay = 60_000L, fixedRate = 600_000L) @Transactional @Override void removeExpiredTokenCodes(); @Override @Transactional String doHerokuSingleSignOn(
      String token, String externalId, String email, long timestampSeconds, String salt);  }