void () { String s1 = """ class X {{ class A { void b(Integer i); void b2(int i); void c(int d); void c2(Integer d); } A a; a.b2(1) ; a.b2(1) ; a.b(1) ; a.b( new Integer(0) ) ; a.b( new Integer(0) ) ; a.c(new Integer(2)); a.c(new Integer(3)); a.c2(new Integer(3)); a.c(3); Integer i = 4; int j = Integer.valueOf(4); }}"""; assertEquals("Find boxing in method call", 1, findMatchesCount(s1, "a.'b('_Params:[formal( Integer ) && exprtype( int ) ])")); assertEquals("Find unboxing in method call", 2, findMatchesCount(s1, "a.c('_Params:[formal( int ) && exprtype( Integer ) ])")); assertEquals("Find any boxing", 2, findMatchesCount(s1, "'_a:[formal( Integer ) && exprtype( int ) ]")); assertEquals("Find any unboxing", 3, findMatchesCount(s1, "'_a:[formal( int ) && exprtype( Integer ) ]")); }