void (PsiClass beforeClass, PsiClass afterClass, PsiMethod afterMethod, PsiMethod beforeMethod) { final PsiModifierList afterModifierList = afterMethod.getModifierList(); PsiModifierList beforeModifierList = beforeMethod.getModifierList(); compareModifiers(beforeModifierList, afterModifierList); compareType(beforeMethod.getReturnType(), afterMethod.getReturnType(), afterMethod); compareParams(beforeMethod.getParameterList(), afterMethod.getParameterList()); compareThrows(beforeMethod.getThrowsList(), afterMethod.getThrowsList(), afterMethod); if (shouldCompareCodeBlocks()) { final PsiCodeBlock beforeMethodBody = beforeMethod.getBody(); final PsiCodeBlock afterMethodBody = afterMethod.getBody(); if (null != beforeMethodBody && null != afterMethodBody) { boolean codeBlocksAreEqual = beforeMethodBody.textMatches(afterMethodBody); if (!codeBlocksAreEqual) { String text1 = beforeMethodBody.getText().replaceAll("java\\.lang\\.", "").replaceAll("\\s+", ""); String text2 = afterMethodBody.getText().replaceAll("java\\.lang\\.", "").replaceAll("\\s+", ""); assertEquals("Method: (" + afterMethod.getName() + ") in Class:" + afterClass.getName() + " different", text2, text1); } } else { if (null != afterMethodBody) { fail("MethodCodeBlocks is null: Method: (" + beforeMethod.getName() + ") Class:" + beforeClass.getName()); } } } }