MagicListGlobals implements SpecialCommand { @Override public Function<String, Boolean> getMatcher() { return (input) -> startsWith(trimToEmpty(input), MAGIC_GLOBALS); }  @Override String getCommand(); @Override Function<String, Boolean> getMatcher(); @Override StellarResult execute(String command, StellarShellExecutor executor); static final String MAGIC_GLOBALS; }
@Test public void testShouldMatch() { List<String> inputs = Arrays.asList( "%globals", " %globals ", "%globals FOO", " %globals FOO " ); for(String in : inputs) { assertTrue(magic.getMatcher().apply(in), "failed: " + in); } }
@Test public void testShouldNotMatch() { List<String> inputs = Arrays.asList( "foo", " globals ", "bar", "%define" ); for(String in : inputs) { assertFalse(magic.getMatcher().apply(in), "failed: " + in); } }