@Test
public void testGetMDCValue() {

    UserIdMDCPutFilter mdcPutFilter = new UserIdMDCPutFilter();
    // expected data
    String userName = "terasoluna@nttd.co.jp";
    // SecurityContextHolder setting start
    securityContext = mock(SecurityContext.class);
    authentication = mock(Authentication.class);
    user = new User(userName, "yyyy", Arrays.asList(
            new SimpleGrantedAuthority("user")));
    when(authentication.getPrincipal()).thenReturn(user);
    when(securityContext.getAuthentication()).thenReturn(authentication);
    SecurityContextHolder.setContext(securityContext);
    // setting end
    // run
    String mdcValueStr = mdcPutFilter.getMDCValue(request, response);
    // assert
    assertThat(mdcValueStr, is(userName));
}