Skip to content

Commit

Permalink
Add 4 blame test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Oct 6, 2024
1 parent 446ecac commit 3c68268
Show file tree
Hide file tree
Showing 7 changed files with 1,562 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/codetracker/FileTrackerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import gr.uom.java.xmi.UMLAttribute;
import gr.uom.java.xmi.decomposition.UMLOperationBodyMapper;
import gr.uom.java.xmi.diff.ExtractClassRefactoring;
import gr.uom.java.xmi.diff.ExtractOperationRefactoring;
import gr.uom.java.xmi.diff.ExtractSuperclassRefactoring;
import gr.uom.java.xmi.diff.MoveOperationRefactoring;
import gr.uom.java.xmi.diff.RenameAttributeRefactoring;
Expand Down Expand Up @@ -986,6 +987,11 @@ private boolean isMoved(Method rightMethod, List<Refactoring> refactorings) {
if (parentContainers.contains(move.getMovedOperation()))
return true;
}
else if (r.getRefactoringType().equals(RefactoringType.EXTRACT_AND_MOVE_OPERATION)) {
ExtractOperationRefactoring extract = (ExtractOperationRefactoring) r;
if (parentContainers.contains(extract.getExtractedOperation()))
return true;
}
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import gr.uom.java.xmi.UMLAnonymousClass;
import gr.uom.java.xmi.decomposition.UMLOperationBodyMapper;
import gr.uom.java.xmi.diff.ExtractClassRefactoring;
import gr.uom.java.xmi.diff.ExtractOperationRefactoring;
import gr.uom.java.xmi.diff.ExtractSuperclassRefactoring;
import gr.uom.java.xmi.diff.MoveOperationRefactoring;
import gr.uom.java.xmi.diff.RenameAttributeRefactoring;
Expand Down Expand Up @@ -993,6 +994,11 @@ private boolean isMoved(Method rightMethod, List<Refactoring> refactorings) {
if (parentContainers.contains(move.getMovedOperation()))
return true;
}
else if (r.getRefactoringType().equals(RefactoringType.EXTRACT_AND_MOVE_OPERATION)) {
ExtractOperationRefactoring extract = (ExtractOperationRefactoring) r;
if (parentContainers.contains(extract.getExtractedOperation()))
return true;
}
}
return false;
}
Expand Down
4 changes: 4 additions & 0 deletions src/test/java/org/codetracker/blame/CodeTrackerBlameTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ private static Stream<Arguments> testBlamerInputProvider(){
"https://github.com/apache/flink/commit/9e936a5f8198b0059e9b5fba33163c2bbe3efbdd, flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/DispatcherRestEndpoint.java, /src/test/resources/blame/blameTestWithLocalRepo14.txt",
"https://github.com/junit-team/junit4/commit/02c328028b4d32c15bbf0becc9838e54ecbafcbf, src/main/java/org/junit/runners/BlockJUnit4ClassRunner.java, /src/test/resources/blame/blameTestWithLocalRepo15.txt",
"https://github.com/square/okhttp/commit/5224f3045ba9b171fce521777edf389f9206173c, okhttp/src/main/java/okhttp3/internal/http2/Http2Connection.java, /src/test/resources/blame/blameTestWithLocalRepo16.txt",
"https://github.com/apache/hadoop/commit/9c3fc3ef2865164aa5f121793ac914cfeb21a181, hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fifo/FifoScheduler.java, /src/test/resources/blame/blameTestWithLocalRepo17.txt",
"https://github.com/mockito/mockito/commit/077562ea54f1fa87ff8dd233c3060ddbf0f1ce26, src/main/java/org/mockito/internal/invocation/MatchersBinder.java, /src/test/resources/blame/blameTestWithLocalRepo18.txt",
"https://github.com/hibernate/hibernate-search/commit/5b778035965d7588ad1d1ae522c4bafebd3a0e16, engine/src/main/java/org/hibernate/search/backend/impl/StreamingOperationDispatcher.java, /src/test/resources/blame/blameTestWithLocalRepo19.txt",
"https://github.com/eclipse/jetty.project/commit/fc5dd874f3deda71e6cd42af994a5af5cb6be4af, jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java, /src/test/resources/blame/blameTestWithLocalRepo20.txt",
"https://github.com/eclipse/jgit/commit/bd1a82502680b5de5bf86f6c4470185fd1602386, org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java, /src/test/resources/blame/blameTestUntilCommitZero.txt",
"https://github.com/JetBrains/intellij-community/commit/ecb1bb9d4d484ae63ee77f8ad45bdce154db9356, java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java, /src/test/resources/blame/blameTestUntilCommitZero2.txt",
"https://github.com/JetBrains/intellij-community/commit/ecb1bb9d4d484ae63ee77f8ad45bdce154db9356, java/compiler/impl/src/com/intellij/compiler/actions/CompileDirtyAction.java, /src/test/resources/blame/blameTestUntilCommitZero3.txt"
Expand Down
Loading

0 comments on commit 3c68268

Please sign in to comment.