AssignmentCommand implements SpecialCommand { @Override public Function<String, Boolean> getMatcher() { return (input) -> StellarAssignment.isAssignment(input); }  @Override Function<String, Boolean> getMatcher(); @Override String getCommand(); @Override StellarResult execute(String input, StellarShellExecutor executor); static final String ASSIGNMENT_OP; }
@Test public void testShouldMatch() { List<String> inputs = Arrays.asList( "x := 2 + 2", " x := 2 + 2 ", " x := 2", " x := " ); for(String in : inputs) { assertTrue(command.getMatcher().apply(in), "failed: " + in); } }
@Test public void testShouldNotMatch() { List<String> inputs = Arrays.asList( "2+2", " %define x := 2", "x" ); for(String in : inputs) { assertFalse(command.getMatcher().apply(in), "failed: " + in); } }