### Question:
AuthenticationService implements IAuthenticationService { public boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources) { return userResources.stream().anyMatch(resource -> resource.getCode().equals(urlConfigAttribute.getAttribute())); } @Autowired  AuthenticationService(Map<RequestMatcher, ConfigAttribute> resourceConfigAttributes); @Override boolean decide(HttpServletRequest authRequest); boolean isMatch(ConfigAttribute urlConfigAttribute, Set<Resource> userResources); ConfigAttribute findConfigAttributesByUrl(HttpServletRequest authRequest); static final String NONEXISTENT_URL; }### Answer:
@Test public void testIsMatch_假如存在如上资源信息_当给定包含在资源信息时_那么返回true() { AuthenticationService authenticationService = new AuthenticationService(null); Resource resource = new Resource(); resource.setCode("user_manager:view"); Set<Resource> resources = Sets.newHashSet(resource); Assert.assertTrue(authenticationService.isMatch(new SecurityConfig("user_manager:view"), resources)); }
@Test public void testIsMatch_假如存在如上资源信息_当给不包含在资源信息时_那么返回false() { AuthenticationService authenticationService = new AuthenticationService(null); Resource resource = new Resource(); resource.setCode("user_manager:manager"); Set<Resource> resources = Sets.newHashSet(resource); Assert.assertFalse(authenticationService.isMatch(new SecurityConfig("user_manager:view"), resources)); }