when(tree.getValue()).thenReturn("a string literal");
assertTrue(new StringLiteral("a string literal").matches(tree, null));
}
@Test public void notMatches() {
LiteralTree tree = mock(LiteralTree.class);
when(tree.getValue()).thenReturn("a string literal");
assertFalse(new StringLiteral("different string").matches(tree, null));
IdentifierTree idTree = mock(IdentifierTree.class);
assertFalse(new StringLiteral("test").matches(idTree, null));
LiteralTree intTree = mock(LiteralTree.class);
when(intTree.getValue()).thenReturn(5);
assertFalse(new StringLiteral("test").matches(intTree, null));
}