@Test
public void removesDuplicatedAuthSubjects() {

    final Collection<String> authSubjectsWithDuplicates = Arrays.asList("test:sub", "sub");
    final AuthorizationContext authorizationContextWithDuplicates =
            AuthorizationContext.newInstance(DittoAuthorizationContextType.UNSPECIFIED,
                    authSubjectsWithDuplicates.stream()
                            .map(AuthorizationSubject::newInstance)
                            .collect(Collectors.toList()));
    final AuthorizationContext authorizationContextWithoutDuplicates =
            AuthorizationContext.newInstance(DittoAuthorizationContextType.UNSPECIFIED,
                    AuthorizationSubject.newInstance("test:sub"));
    final DittoHeaders dittoHeaders = underTest
            .authorizationContext(authorizationContextWithDuplicates)
            .build();
    assertThat(dittoHeaders.getAuthorizationContext()).isEqualTo(authorizationContextWithDuplicates);
    assertThat(dittoHeaders.get(DittoHeaderDefinition.AUTHORIZATION_CONTEXT.getKey()))
            .isEqualTo(authorizationContextWithoutDuplicates.toJsonString());
}