Java Code Examples for com.github.javaparser.ast.body.MethodDeclaration#getNameAsString()

The following examples show how to use com.github.javaparser.ast.body.MethodDeclaration#getNameAsString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExceptionCatchingThrowing.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        currentMethod = n;
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)
        super.visit(n, arg);

        if (n.getThrownExceptions().size() >= 1)
            exceptionCount++;

        testMethod.setHasSmell(exceptionCount >= 1);
        testMethod.addDataItem("ExceptionCount", String.valueOf(exceptionCount));

        smellyElementList.add(testMethod);

        //reset values for next method
        currentMethod = null;
        exceptionCount = 0;
    }
}
 
Example 2
Source File: PrintStatement.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        currentMethod = n;
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)
        super.visit(n, arg);

        testMethod.setHasSmell(printCount >= 1);
        testMethod.addDataItem("PrintCount", String.valueOf(printCount));

        smellyElementList.add(testMethod);

        //reset values for next method
        currentMethod = null;
        printCount = 0;
    }
}
 
Example 3
Source File: ResourceOptimism.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n) || Util.isValidSetupMethod(n)) {
        currentMethod = n;
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)
        super.visit(n, arg);

        testMethod.setHasSmell(methodVariables.size() >= 1 || hasSmell==true);
        testMethod.addDataItem("ResourceOptimismCount", String.valueOf(resourceOptimismCount));

        smellyElementList.add(testMethod);

        //reset values for next method
        currentMethod = null;
        resourceOptimismCount = 0;
        hasSmell = false;
        methodVariables = new ArrayList<>();
    }
}
 
Example 4
Source File: SensitiveEquality.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        currentMethod = n;
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)
        super.visit(n, arg);

        testMethod.setHasSmell(sensitiveCount >= 1);
        testMethod.addDataItem("SensitiveCount", String.valueOf(sensitiveCount));

        smellyElementList.add(testMethod);

        //reset values for next method
        currentMethod = null;
        sensitiveCount = 0;
    }
}
 
Example 5
Source File: VerboseTest.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        currentMethod = n;
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)

        //method should not be abstract
        if (!currentMethod.isAbstract()) {
            if (currentMethod.getBody().isPresent()) {
                //get the total number of statements contained in the method
                if (currentMethod.getBody().get().getStatements().size() >= MAX_STATEMENTS) {
                    verboseCount++;
                }
            }
        }
        testMethod.setHasSmell(verboseCount >= 1);
        testMethod.addDataItem("VerboseCount", String.valueOf(verboseCount));

        smellyElementList.add(testMethod);

        //reset values for next method
        currentMethod = null;
        verboseCount = 0;
    }
}
 
Example 6
Source File: GeneralFixture.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        currentMethod = n;

        //call visit(NameExpr) for current method
        super.visit(n, arg);

        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(fixtureCount.size() != setupFields.size());
        smellyElementList.add(testMethod);

        fixtureCount = new HashSet();;
        currentMethod = null;
    }
}
 
Example 7
Source File: EmptyTest.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
/**
 * The purpose of this method is to 'visit' all test methods in the test file
 */
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)
        //method should not be abstract
        if (!n.isAbstract()) {
            if (n.getBody().isPresent()) {
                //get the total number of statements contained in the method
                if (n.getBody().get().getStatements().size() == 0) {
                    testMethod.setHasSmell(true); //the method has no statements (i.e no body)
                }
            }
        }
        smellyElementList.add(testMethod);
    }
}
 
Example 8
Source File: RegistryMethodVisitor.java    From gauge-java with Apache License 2.0 6 votes vote down vote up
private void addStepToRegistry(Expression expression, MethodDeclaration methodDeclaration, SingleMemberAnnotationExpr annotation) {
    String parameterizedStep = getParameterizedStep(expression);
    String stepText = new StepsUtil().getStepText(parameterizedStep);
    stepValue = new StepValue(stepText, parameterizedStep);

    entry = new StepRegistryEntry();
    entry.setName(methodDeclaration.getDeclarationAsString());
    String className = getClassName(methodDeclaration);
    String fullyQualifiedName = className == null
            ? methodDeclaration.getNameAsString() : className + "." + methodDeclaration.getNameAsString();
    entry.setFullyQualifiedName(fullyQualifiedName);
    entry.setStepText(parameterizedStep);
    entry.setStepValue(stepValue);
    entry.setParameters(methodDeclaration.getParameters());
    entry.setSpan(methodDeclaration.getRange().get());
    entry.setHasAlias(hasAlias(annotation));
    entry.setAliases(getAliases(annotation));
    entry.setFileName(file);

    stepRegistry.addStep(stepValue, entry);
}
 
Example 9
Source File: SleepyTest.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        currentMethod = n;
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)
        super.visit(n, arg);

        testMethod.setHasSmell(sleepCount >= 1);
        testMethod.addDataItem("ThreadSleepCount", String.valueOf(sleepCount));

        smellyElementList.add(testMethod);

        //reset values for next method
        currentMethod = null;
        sleepCount = 0;
    }
}
 
Example 10
Source File: IgnoredTest.java    From TestSmellDetector with GNU General Public License v3.0 6 votes vote down vote up
/**
 * The purpose of this method is to 'visit' all test methods in the test file.
 */
@Override
public void visit(MethodDeclaration n, Void arg) {

    //JUnit 4
    //check if test method has Ignore annotation
    if (n.getAnnotationByName("Test").isPresent()) {
        if (n.getAnnotationByName("Ignore").isPresent()) {
            testMethod = new TestMethod(n.getNameAsString());
            testMethod.setHasSmell(true);
            smellyElementList.add(testMethod);
            return;
        }
    }

    //JUnit 3
    //check if test method is not public
    if (n.getNameAsString().toLowerCase().startsWith("test")) {
        if (!n.getModifiers().contains(Modifier.PUBLIC)) {
            testMethod = new TestMethod(n.getNameAsString());
            testMethod.setHasSmell(true);
            smellyElementList.add(testMethod);
            return;
        }
    }
}
 
Example 11
Source File: AddOverrideAnnotation.java    From Refactoring-Bot with MIT License 6 votes vote down vote up
@Override
public String performRefactoring(BotIssue issue, GitConfiguration gitConfig) throws Exception {
	String path = issue.getFilePath();

	FileInputStream in = new FileInputStream(gitConfig.getRepoFolder() + "/" + path);
	CompilationUnit compilationUnit = LexicalPreservingPrinter.setup(StaticJavaParser.parse(in));

	MethodDeclaration methodDeclarationToModify = RefactoringHelper
			.getMethodDeclarationByLineNumber(issue.getLine(), compilationUnit);
	if (methodDeclarationToModify == null) {
		throw new BotRefactoringException("Could not find a method declaration at specified line!");
	}
	if (isOverrideAnnotationExisting(methodDeclarationToModify)) {
		throw new BotRefactoringException("Method is already annotated with 'Override'!");
	}

	methodDeclarationToModify.addMarkerAnnotation(OVERRIDE_ANNOTATION_NAME);

	// Save changes to file
	PrintWriter out = new PrintWriter(gitConfig.getRepoFolder() + "/" + path);
	out.println(LexicalPreservingPrinter.print(compilationUnit));
	out.close();

	// Return commit message
	return "Added override annotation to method '" + methodDeclarationToModify.getNameAsString() + "'";
}
 
Example 12
Source File: JFinalControllerParser.java    From JApiDocs with Apache License 2.0 5 votes vote down vote up
@Override
protected void afterHandleMethod(RequestNode requestNode, MethodDeclaration md) {
    String methodName = md.getNameAsString();
    requestNode.setUrl(getUrl(methodName));
    md.getAnnotationByName("ActionKey").ifPresent(an -> {
        if(an instanceof SingleMemberAnnotationExpr){
            String url = ((SingleMemberAnnotationExpr)an).getMemberValue().toString();
            requestNode.setMethod(Arrays.asList(RequestMethod.GET.name(), RequestMethod.POST.name()));
            requestNode.setUrl(Utils.removeQuotations(url));
            return;
        }
    });
}
 
Example 13
Source File: RemoveMethodParameterTest.java    From Refactoring-Bot with MIT License 5 votes vote down vote up
/**
 * The target class extends a super class and implements an interface. Test that
 * the super class was correctly refactored
 * 
 * @throws Exception
 */
@Test
public void testInterfaceMethodInSuperClassRefactored() throws Exception {
	// arrange
	List<File> filesToConsider = new ArrayList<File>();
	filesToConsider.add(fileOfTestClass);
	filesToConsider.add(fileOfSuperClass);
	filesToConsider.add(fileOfInterface);
	int lineNumberOfMethodWithParameterToBeRemoved = removeParameterTestClass.getLineOfMethodWithUnusedParameter(0,
			0, 0);
	String parameterName = "b";

	CompilationUnit cuOriginalFileOfSuperClass = StaticJavaParser.parse(fileOfSuperClass);
	MethodDeclaration originalMethodInSuperClass = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterSuperClass.getLineOfMethodWithUnusedParameter(0, 0, 0), cuOriginalFileOfSuperClass);
	assertThat(originalMethodInSuperClass).isNotNull();

	// act
	performRemoveParameter(filesToConsider, fileOfTestClass, lineNumberOfMethodWithParameterToBeRemoved,
			parameterName);

	// assert that method in super class has been refactored
	CompilationUnit cuRefactoredFileOfSuperClass = StaticJavaParser.parse(fileOfSuperClass);
	String methodInSuperClassName = originalMethodInSuperClass.getNameAsString();
	MethodDeclaration methodInSuperClass = getMethodByName(SUPER_CLASS_NAME, methodInSuperClassName,
			cuRefactoredFileOfSuperClass);
	assertThat(methodInSuperClass).isNotNull();
	assertThat(methodInSuperClass.getParameterByName(parameterName).isPresent()).isFalse();
}
 
Example 14
Source File: ConditionalTestLogic.java    From TestSmellDetector with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void visit(MethodDeclaration n, Void arg) {
    if (Util.isValidTestMethod(n)) {
        currentMethod = n;
        testMethod = new TestMethod(n.getNameAsString());
        testMethod.setHasSmell(false); //default value is false (i.e. no smell)
        super.visit(n, arg);

        testMethod.setHasSmell(conditionCount > 0 | ifCount > 0 | switchCount > 0 | foreachCount > 0 | forCount > 0 | whileCount > 0);

        testMethod.addDataItem("ConditionCount", String.valueOf(conditionCount));
        testMethod.addDataItem("IfCount", String.valueOf(ifCount));
        testMethod.addDataItem("SwitchCount", String.valueOf(switchCount));
        testMethod.addDataItem("ForeachCount", String.valueOf(foreachCount));
        testMethod.addDataItem("ForCount", String.valueOf(forCount));
        testMethod.addDataItem("WhileCount", String.valueOf(whileCount));

        smellyElementList.add(testMethod);

        //reset values for next method
        currentMethod = null;
        conditionCount = 0;
        ifCount = 0;
        switchCount = 0;
        forCount = 0;
        foreachCount = 0;
        whileCount = 0;
    }
}
 
Example 15
Source File: RemoveMethodParameterTest.java    From Refactoring-Bot with MIT License 5 votes vote down vote up
/**
 * Test whether the refactoring was performed correctly in the sub class of the
 * target class (descendant)
 * 
 * @throws Exception
 */
@Test
public void testSubClassRefactored() throws Exception {
	// arrange
	List<File> filesToConsider = new ArrayList<File>();
	filesToConsider.add(fileOfTestClass);
	filesToConsider.add(fileOfSubClass);
	int lineNumberOfMethodWithParameterToBeRemoved = removeParameterTestClass.getLineOfMethodWithUnusedParameter(0,
			0, 0);
	String parameterName = "b";

	CompilationUnit cuOriginalFileOfSubClass = StaticJavaParser.parse(fileOfSubClass);
	MethodDeclaration originalMethodInSubClass = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterSubClass.getLineOfMethodWithUnusedParameter(0, 0, 0), cuOriginalFileOfSubClass);
	assertThat(originalMethodInSubClass).isNotNull();

	// act
	performRemoveParameter(filesToConsider, fileOfTestClass, lineNumberOfMethodWithParameterToBeRemoved,
			parameterName);

	// assert that target's sub class has been refactored
	CompilationUnit cuRefactoredFileOfSubClass = StaticJavaParser.parse(fileOfSubClass);
	String methodInSubClassName = originalMethodInSubClass.getNameAsString();
	MethodDeclaration methodInSubClass = getMethodByName(SUB_CLASS_NAME, methodInSubClassName,
			cuRefactoredFileOfSubClass);
	assertThat(methodInSubClass).isNotNull();
	assertThat(methodInSubClass.getParameterByName(parameterName).isPresent()).isFalse();
}
 
Example 16
Source File: AttributeSyncHandler.java    From jeddict with Apache License 2.0 5 votes vote down vote up
public void syncExistingSnippet(String name, MethodDeclaration method, Map<String, ImportDeclaration> imports) {
    String methodName = method.getNameAsString();
    if (isBeanMethod(methodName)) {
        boolean getterMethod = isGetterMethod(methodName);
        syncJavadoc(method.getComment(), getterMethod ? GETTER_JAVADOC : SETTER_JAVADOC);
        syncAnnotation(method.getAnnotations(), getterMethod ? AttributeAnnotationLocationType.GETTER : AttributeAnnotationLocationType.SETTER, imports);
        syncThrows(method, getterMethod, imports);
        syncMethodBody(name, method, getterMethod, imports);
    } else if (isHelperMethod(methodName)) {
        syncHelperMethodBody(name, method, isAddMethod(methodName), imports);
    }
}
 
Example 17
Source File: RemoveMethodParameterTest.java    From Refactoring-Bot with MIT License 5 votes vote down vote up
/**
 * Test whether the refactoring was performed correctly in the super class of
 * the target class (ancestor)
 * 
 * @throws Exception
 */
@Test
public void testSuperClassRefactored() throws Exception {
	// arrange
	List<File> filesToConsider = new ArrayList<File>();
	filesToConsider.add(fileOfTestClass);
	filesToConsider.add(fileOfSuperClass);
	int lineNumberOfMethodWithParameterToBeRemoved = removeParameterTestClass.getLineOfMethodWithUnusedParameter(0,
			0, 0);
	String parameterName = "b";

	CompilationUnit cuOriginalFileOfSuperClass = StaticJavaParser.parse(fileOfSuperClass);
	MethodDeclaration originalMethodInSuperClass = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterSuperClass.getLineOfMethodWithUnusedParameter(0, 0, 0), cuOriginalFileOfSuperClass);
	assertThat(originalMethodInSuperClass).isNotNull();

	// act
	performRemoveParameter(filesToConsider, fileOfTestClass, lineNumberOfMethodWithParameterToBeRemoved,
			parameterName);

	// assert that target's super class has been refactored
	CompilationUnit cuRefactoredFileOfSuperClass = StaticJavaParser.parse(fileOfSuperClass);
	String methodInSuperClassName = originalMethodInSuperClass.getNameAsString();
	MethodDeclaration methodInSuperClass = getMethodByName(SUPER_CLASS_NAME, methodInSuperClassName,
			cuRefactoredFileOfSuperClass);
	assertThat(methodInSuperClass).isNotNull();
	assertThat(methodInSuperClass.getParameterByName(parameterName).isPresent()).isFalse();
}
 
Example 18
Source File: RenameMethod.java    From Refactoring-Bot with MIT License 5 votes vote down vote up
/**
 * Tries to find the target method in the given class or interface. Checks if
 * the found method itself could be refactored, without yet checking other code
 * locations
 * 
 * @param issue
 * @param filePath
 * @param newMethodName
 * @return
 * @throws BotRefactoringException
 * @throws FileNotFoundException
 */
private MethodDeclaration findAndValidateTargetMethod(BotIssue issue, String filePath, String newMethodName)
		throws BotRefactoringException, FileNotFoundException {
	List<ClassOrInterfaceDeclaration> classesAndInterfaces = RefactoringHelper
			.getAllClassesAndInterfacesFromFile(filePath);

	MethodDeclaration targetMethod = null;
	for (ClassOrInterfaceDeclaration classOrInterface : classesAndInterfaces) {
		for (MethodDeclaration currentMethod : classOrInterface.getMethods()) {
			if (RefactoringHelper.isMethodDeclarationAtLine(currentMethod, issue.getLine())) {
				targetMethod = currentMethod;
				break;
			}
		}
		if (targetMethod != null) {
			break;
		}
	}

	if (targetMethod == null) {
		throw new BotRefactoringException("Could not find specified method declaration at given line!");
	}

	String oldMethodName = targetMethod.getNameAsString();
	if (oldMethodName.equals(newMethodName)) {
		throw new BotRefactoringException("New method name must differ from the current one!");
	}

	return targetMethod;
}
 
Example 19
Source File: RemoveMethodParameterTest.java    From Refactoring-Bot with MIT License 4 votes vote down vote up
/**
 * Test that a refactoring of an inner class (implementing the same interface as
 * the outer class) results in a correct refactoring of both, the inner and the
 * outer class. Also test whether the implemented interface and super class of
 * the outer class was successfully refactored
 * 
 * @throws Exception
 */
@Test
public void testInnerClassWithInterfaceRefactoring() throws Exception {
	// arrange
	List<File> filesToConsider = new ArrayList<File>();
	filesToConsider.add(fileOfTestClass);
	filesToConsider.add(fileOfInterface);
	filesToConsider.add(fileOfSuperClass);
	int lineNumberOfMethodWithParameterToBeRemoved = removeParameterInnerClassWithInterfaceImpl
			.getLineOfMethodWithUnusedParameter(0, 0, 0);
	String parameterName = "b";

	CompilationUnit cuOriginalFileOfTestClass = StaticJavaParser.parse(fileOfTestClass);
	CompilationUnit cuOriginalFileOfSuperClass = StaticJavaParser.parse(fileOfSuperClass);
	MethodDeclaration originalInnerClassMethod = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterInnerClassWithInterfaceImpl.getLineOfMethodWithUnusedParameter(0, 0, 0),
			cuOriginalFileOfTestClass);
	MethodDeclaration originalOuterClassMethod = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterTestClass.getLineOfMethodWithUnusedParameter(0, 0, 0), cuOriginalFileOfTestClass);
	MethodDeclaration originalMethodInSuperClass = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterSuperClass.getLineOfMethodWithUnusedParameter(0, 0, 0), cuOriginalFileOfSuperClass);

	SoftAssertions softAssertions = new SoftAssertions();
	softAssertions.assertThat(originalInnerClassMethod).isNotNull();
	softAssertions.assertThat(originalOuterClassMethod).isNotNull();
	softAssertions.assertThat(originalMethodInSuperClass).isNotNull();
	softAssertions.assertAll();

	// act
	performRemoveParameter(filesToConsider, fileOfTestClass, lineNumberOfMethodWithParameterToBeRemoved,
			parameterName);

	// assert
	CompilationUnit cuRefactoredFileOfTestClass = StaticJavaParser.parse(fileOfTestClass);

	// assert that method in inner class has been refactored
	MethodDeclaration refactoredInnerClassMethod = getMethodByName(TARGET_INNER_CLASS_WITH_INTERFACE_NAME,
			originalInnerClassMethod.getNameAsString(), cuRefactoredFileOfTestClass);
	assertThat(refactoredInnerClassMethod).isNotNull();
	assertThat(refactoredInnerClassMethod.getParameterByName(parameterName).isPresent()).isFalse();

	// assert that method in outer class has been refactored
	MethodDeclaration refactoredOuterClassMethod = getMethodByName(TARGET_CLASS_NAME,
			originalOuterClassMethod.getNameAsString(), cuRefactoredFileOfTestClass);
	assertThat(refactoredOuterClassMethod).isNotNull();
	assertThat(refactoredOuterClassMethod.getParameterByName(parameterName).isPresent()).isFalse();

	// assert that method in interface has been refactored
	CompilationUnit cuRefactoredFileOfInterface = StaticJavaParser.parse(fileOfInterface);
	List<MethodDeclaration> methodDeclarations = cuRefactoredFileOfInterface.findAll(MethodDeclaration.class);
	assertThat(methodDeclarations).size().isEqualTo(1);
	assertThat(methodDeclarations.get(0).getParameterByName(parameterName).isPresent()).isFalse();

	// assert that super class of outer class has been refactored
	CompilationUnit cuRefactoredFileOfSuperClass = StaticJavaParser.parse(fileOfSuperClass);
	String methodInSuperClassName = originalMethodInSuperClass.getNameAsString();
	MethodDeclaration methodInSuperClass = getMethodByName(SUPER_CLASS_NAME, methodInSuperClassName,
			cuRefactoredFileOfSuperClass);
	assertThat(methodInSuperClass).isNotNull();
	assertThat(methodInSuperClass.getParameterByName(parameterName).isPresent()).isFalse();
}
 
Example 20
Source File: RemoveMethodParameterTest.java    From Refactoring-Bot with MIT License 4 votes vote down vote up
/**
 * Test whether the refactoring was performed correctly in the sibling class of
 * the target class
 * 
 * @throws Exception
 */
@Test
public void testSiblingClassRefactored() throws Exception {
	// arrange
	List<File> filesToConsider = new ArrayList<File>();
	filesToConsider.add(fileOfTestClass);
	filesToConsider.add(fileOfSiblingClass);
	int lineNumberOfMethodWithParameterToBeRemoved = removeParameterTestClass.getLineOfMethodWithUnusedParameter(0,
			0, 0);
	String parameterName = "b";

	CompilationUnit cuOriginalFileOfSiblingClass = StaticJavaParser.parse(fileOfSiblingClass);
	CompilationUnit cuOriginalFileOfTestClass = StaticJavaParser.parse(fileOfTestClass);
	MethodDeclaration originalMethod = RefactoringHelper.getMethodDeclarationByLineNumber(
			lineNumberOfMethodWithParameterToBeRemoved, cuOriginalFileOfTestClass);
	MethodDeclaration originalMethodInSiblingClass = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterSiblingClass.getLineOfMethodWithUnusedParameter(0, 0, 0), cuOriginalFileOfSiblingClass);
	MethodDeclaration originalCallerMethodInSiblingClass = RefactoringHelper.getMethodDeclarationByLineNumber(
			removeParameterSiblingClass.getLineNumberOfCaller(), cuOriginalFileOfSiblingClass);

	SoftAssertions softAssertions = new SoftAssertions();
	softAssertions.assertThat(originalMethod).isNotNull();
	softAssertions.assertThat(originalMethodInSiblingClass).isNotNull();
	softAssertions.assertThat(originalCallerMethodInSiblingClass).isNotNull();
	softAssertions.assertAll();

	// act
	performRemoveParameter(filesToConsider, fileOfTestClass, lineNumberOfMethodWithParameterToBeRemoved,
			parameterName);

	// assert
	CompilationUnit cuRefactoredFileOfSiblingClass = StaticJavaParser.parse(fileOfSiblingClass);
	CompilationUnit cuRefactoredFileOfTestClass = StaticJavaParser.parse(fileOfTestClass);
	MethodDeclaration refactoredMethod = getMethodByName(TARGET_CLASS_NAME, originalMethod.getNameAsString(),
			cuRefactoredFileOfTestClass);

	// assert that target's sibling has been refactored
	String methodInSiblingClassName = originalMethodInSiblingClass.getNameAsString();
	MethodDeclaration methodInSiblingClass = getMethodByName(SIBLING_CLASS_NAME, methodInSiblingClassName,
			cuRefactoredFileOfSiblingClass);
	assertThat(methodInSiblingClass).isNotNull();
	assertThat(methodInSiblingClass.getParameterByName(parameterName).isPresent()).isFalse();

	// assert that caller method in target's sibling class has been refactored
	String callerMethodInSiblingClassName = originalCallerMethodInSiblingClass.getNameAsString();
	MethodDeclaration methodInSiblingClassWithSiblingMethodCall = getMethodByName(SIBLING_CLASS_NAME,
			callerMethodInSiblingClassName, cuRefactoredFileOfSiblingClass);
	assertThat(methodInSiblingClassWithSiblingMethodCall).isNotNull();
	assertAllMethodCallsArgumentSizeEqualToRefactoredMethodParameterCount(methodInSiblingClassWithSiblingMethodCall,
			refactoredMethod);
}