void (String newName, String expectedType) { try { doTest(newName, false, false, false, expectedType); } catch (Exception e) { assertEquals("Error message:Cannot perform refactoring.\nSelected block should represent an expression", e.getMessage()); return; } fail("Should not be able to perform refactoring"); }