diff --git a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java index 959189fad4..e25d4d08a1 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java @@ -2736,6 +2736,24 @@ private List getSplitClassRefactorings(List pair : renameDiff.getCommonAtrributes()) { + MoveAttributeRefactoring move = new MoveAttributeRefactoring(pair.getLeft(), pair.getRight()); + refactorings.add(move); + } + for(Pair pair : renameDiff.getCommonEnumConstants()) { + MoveAttributeRefactoring move = new MoveAttributeRefactoring(pair.getLeft(), pair.getRight()); + refactorings.add(move); + } + for(UMLAttributeDiff attributeDiff : renameDiff.getAttributeDiffList()) { + MoveAttributeRefactoring move = new MoveAttributeRefactoring(attributeDiff.getRemovedAttribute(), attributeDiff.getAddedAttribute()); + refactorings.add(move); + refactorings.addAll(attributeDiff.getRefactorings()); + } + for(UMLEnumConstantDiff attributeDiff : renameDiff.getEnumConstantDiffList()) { + MoveAttributeRefactoring move = new MoveAttributeRefactoring(attributeDiff.getRemovedEnumConstant(), attributeDiff.getAddedEnumConstant()); + refactorings.add(move); + refactorings.addAll(attributeDiff.getRefactorings()); + } } if(!classSplitDiff.samePackage()) { RenamePattern renamePattern = refactoring.getRenamePattern(); diff --git a/src/test/java/org/refactoringminer/test/TestAllRefactorings.java b/src/test/java/org/refactoringminer/test/TestAllRefactorings.java index fb0a8763a4..ba6e80ccf2 100644 --- a/src/test/java/org/refactoringminer/test/TestAllRefactorings.java +++ b/src/test/java/org/refactoringminer/test/TestAllRefactorings.java @@ -17,6 +17,6 @@ public void testAllRefactorings() throws Exception { GitHistoryRefactoringMinerImpl detector = new GitHistoryRefactoringMinerImpl(); TestBuilder test = new TestBuilder(detector, REPOS, Refactorings.All.getValue()); RefactoringPopulator.feedRefactoringsInstances(Refactorings.All.getValue(), Systems.FSE.getValue(), test); - test.assertExpectationsWithGitHubAPI(12356, 20, 232); + test.assertExpectationsWithGitHubAPI(12362, 20, 232); } } diff --git a/src/test/resources/oracle/data.json b/src/test/resources/oracle/data.json index ac4517a3f8..ecc92b32db 100644 --- a/src/test/resources/oracle/data.json +++ b/src/test/resources/oracle/data.json @@ -112058,6 +112058,48 @@ "validation": "TP", "detectionTools": "RefactoringMiner", "validators": null + }, { + "type": "Move Attribute", + "description": "Move Attribute private TOKEN_VALUE_TO_NAME : String[] from class com.puppycrawl.tools.checkstyle.utils.Utils to private TOKEN_VALUE_TO_NAME : String[] from class com.puppycrawl.tools.checkstyle.utils.TokenUtils", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Move Attribute", + "description": "Move Attribute private PATH_DENORMALIZER : String from class com.puppycrawl.tools.checkstyle.utils.UtilsTest to private PATH_DENORMALIZER : String from class com.puppycrawl.tools.checkstyle.utils.CommonUtilsTest", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Move Attribute", + "description": "Move Attribute private TOKEN_NAME_EXCEPTION_PREFIX : String from class com.puppycrawl.tools.checkstyle.utils.Utils to private TOKEN_NAME_EXCEPTION_PREFIX : String from class com.puppycrawl.tools.checkstyle.utils.TokenUtils", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Move Attribute", + "description": "Move Attribute private TOKEN_ID_EXCEPTION_PREFIX : String from class com.puppycrawl.tools.checkstyle.utils.Utils to private TOKEN_ID_EXCEPTION_PREFIX : String from class com.puppycrawl.tools.checkstyle.utils.TokenUtils", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Move Attribute", + "description": "Move Attribute private TOKEN_IDS : int[] from class com.puppycrawl.tools.checkstyle.utils.Utils to private TOKEN_IDS : int[] from class com.puppycrawl.tools.checkstyle.utils.TokenUtils", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null + }, { + "type": "Move Attribute", + "description": "Move Attribute private TOKEN_NAME_TO_VALUE : ImmutableMap from class com.puppycrawl.tools.checkstyle.utils.Utils to private TOKEN_NAME_TO_VALUE : ImmutableMap from class com.puppycrawl.tools.checkstyle.utils.TokenUtils", + "comment": null, + "validation": "TP", + "detectionTools": "RefactoringMiner", + "validators": null }], "refDiffExecutionTime": null }, { diff --git a/src/test/resources/oracle/expected.txt b/src/test/resources/oracle/expected.txt index c9f28386e7..4de087da7c 100644 --- a/src/test/resources/oracle/expected.txt +++ b/src/test/resources/oracle/expected.txt @@ -394,7 +394,7 @@ c9c475a6c7a8cb728ba1c091b386db46f11a781f, 2, 0, 0 0a1a4c6e94c9b3b73b21b323f14ae7b7337b1b44, 4, 0, 0 a07cae0aca9f9072256b3a5fd05779e8d69b9748, 8, 0, 0 febbc986cb25ed460ea601c0a68c7d2597f89ee4, 3, 0, 0 -cdf3e56bacd3895262af8a1df9ca5c81f4071970, 54, 0, 0 +cdf3e56bacd3895262af8a1df9ca5c81f4071970, 60, 0, 0 de022d2434e58dd633fd50a7f9bb50565a8767b5, 83, 0, 0 9d44f0e06232661259681d64002dd53c7c43099d, 11, 0, 0 b6565814805dfb2d989be25c11d4fb4cf8fb1d84, 10, 0, 0