@Test
public void transformMethodExpressionToMethodCallExpressionTypeSafe() {

    final Expression expr = StaticJavaParser.parseExpression("address.city.startsWith(\"M\")");
    final Expression expr1 = StaticJavaParser.parseExpression("getAddress().city.startsWith(\"M\")");
    final Expression expr2 = StaticJavaParser.parseExpression("address.getCity().startsWith(\"M\")");
    final MethodCallExpr expected = StaticJavaParser.parseExpression("getAddress().getCity().startsWith(\"M\")");
    assertEquals(expected.toString(), new ToMethodCall(typeResolver).toMethodCallWithClassCheck(expr, null, Person.class).getExpression().toString());
    assertEquals(expected.toString(), new ToMethodCall(typeResolver).toMethodCallWithClassCheck(expr1, null, Person.class).getExpression().toString());
    assertEquals(expected.toString(), new ToMethodCall(typeResolver).toMethodCallWithClassCheck(expr2, null, Person.class).getExpression().toString());
}