@Test
public void test_adds_user_to_context() throws Exception {

    when(context.header("authorization")).thenReturn("Bearer session_id");
    when(apiKeyStore.getLogin("session_id")).thenReturn("user_id");
    when(users.find("user_id")).thenReturn(new DatashareUser("user_id"));
    Payload payload = apiKeyFilter.apply("url", context, nextFilter);
    assertThat(payload).isSameAs(next);
    verify(context).setCurrentUser(user.capture());
    assertThat(user.getValue().login()).isEqualTo("user_id");
}