ChunkScopeMatcherFactory implements ScopeMatcherFactory { @Override public ScopeMatcher create(String input) { String[] inputParts = StringUtil.split(input, _delimiter); if (inputParts.length == 0) { return ScopeMatcher.NONE; } return new ChunkScopeMatcher(inputParts); }  @Override ScopeMatcher create(String input);  }
@Test public void testMatch() throws Exception { ScopeMatcherFactory chunkScopeMatcherFactory = new ChunkScopeMatcherFactory(); ScopeMatcher scopeMatcher = chunkScopeMatcherFactory.create( "everything.readonly"); Assert.assertTrue(scopeMatcher.match("everything.readonly")); Assert.assertFalse(scopeMatcher.match("everything")); }
@Test public void testMatch2() throws Exception { ScopeMatcherFactory chunkScopeMatcherFactory = new ChunkScopeMatcherFactory(); ScopeMatcher scopeMatcher = chunkScopeMatcherFactory.create( "everything"); Assert.assertTrue(scopeMatcher.match("everything.readonly")); Assert.assertTrue(scopeMatcher.match("everything")); }
@Test public void testMatchMatchesWholeChunksOnly() throws Exception { ScopeMatcherFactory chunkScopeMatcherFactory = new ChunkScopeMatcherFactory(); ScopeMatcher scopeMatcher = chunkScopeMatcherFactory.create( "everything"); Assert.assertFalse(scopeMatcher.match("everything2.readonly")); Assert.assertFalse(scopeMatcher.match("everything2")); }