Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: migrate CompilationUnitPrintTest to junit 5 #4400

Merged

Conversation

MartinWitt
Copy link
Collaborator

#3919
The following has changed in the code:
Replaced junit 4 test annotation with junit 5 test annotation in test
Transformed junit4 assert to junit 5 assertion in test

 The following has changed in the code:
Replaced junit 4 test annotation with junit 5 test annotation in test
Transformed junit4 assert to junit 5 assertion in test
@monperrus monperrus changed the title review: test: migrate CompilationUnitPrintTest to junit 5 test: migrate CompilationUnitPrintTest to junit 5 Jan 6, 2022
@monperrus monperrus merged commit e2d3990 into INRIA:master Jan 6, 2022
@monperrus
Copy link
Collaborator

thanks @MartinWitt would you share the code of the transformation?

@MartinWitt
Copy link
Collaborator Author

The project is more or less here, https://github.com/MartinWitt/laughing-train.

@algomaster99
Copy link
Contributor

@monperrus We could use the script for bumping Junit4 to Junit5 in gumtree-spoon. I can head that.

@algomaster99
Copy link
Contributor

@MartinWitt How could I apply transformations for updating Junit for this project? The README for your project considers three separate transformations.

@MartinWitt
Copy link
Collaborator Author

Oh, I have three different kind of bad smell fixes planed, but currently the only real working and useful is JUnit transformation.
You have three ways to apply it.

Single File:

@Test
	void refactorTests3() throws IOException, InvalidRemoteException, GitAPIException {
		new TransformationEngine().applyToGivenPath(
				"PathToTests",
				"NameOfClassToRefactor", RunMode.FULL);
	}

All Files

@Test
	void refactorTests3() throws IOException {
		new TransformationEngine().applyToGivenPath(
				"PathToTests",
				 RunMode.FULL);
	}

Git Repo with changelog

For the git version you need to edit https://github.com/MartinWitt/laughing-train/blob/master/code-transformation/src/main/resources/app.properties

@Test
public void bar() throws IOException, InvalidRemoteException, GitAPIException {
String path = ProjectPath
String filename = TypeToRefactorName
String repoPath = PathToLocalGitRepo
CommitBuilder.refactorRepo(repoPath, path, filename,
	(v, u) -> {
		return new TransformationEngine().applyToGivenPath(path, filename, RunMode.FULL);
})};

If you want to change which processor is used uncomment them here https://github.com/MartinWitt/laughing-train/blob/master/code-transformation/src/main/java/xyz/keksdose/spoon/code_solver/TransformationEngine.java#L73

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants