RepositorySecurityDecoratorTest.java 文件源码

java
阅读 19 收藏 0 点赞 0 评论 0

项目:molgenis 作者:
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void updateStream()
{
    TestingAuthenticationToken authentication = new TestingAuthenticationToken("username", null,
            "ROLE_ENTITY_WRITE_" + entityId);
    authentication.setAuthenticated(false);
    SecurityContextHolder.getContext().setAuthentication(authentication);

    Entity entity0 = mock(Entity.class);
    Stream<Entity> entities = Stream.of(entity0);
    ArgumentCaptor<Stream<Entity>> captor = ArgumentCaptor.forClass(Stream.class);
    doNothing().when(delegateRepository).update(captor.capture());
    repositorySecurityDecorator.update(entities);
    assertEquals(captor.getValue().collect(Collectors.toList()), singletonList(entity0));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号