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

add migration cleanup from junit 4 to junit 5 #110

Merged
merged 58 commits into from
Nov 17, 2024
Merged

Conversation

carstenartur
Copy link
Owner

@carstenartur carstenartur commented Oct 12, 2024

Cleanup to migrate Tests to JUnit5

At the time being only a subset of all possible apis of JUnit is supported.

  • Assert -> Assertions
  • Test -> Test
  • Rule Temporary Folder
  • Rule Testname
  • ExternalResource
  • @Before, @After
  • @BeforeClass, @AfterClass

/**
*
*/
public JUnitCleanUpCore() {

Check warning

Code scanning / PMD

Document empty constructor Warning

Document empty constructor
if (compilationUnit == null) {
return null;
}
EnumSet<JUnitCleanUpFixCore> computeFixSet= computeFixSet();

Check warning

Code scanning / PMD

Avoid using implementation types like 'Stack'; use the interface instead Warning

Avoid using implementation types like 'EnumSet'; use the interface instead
throw new AbortSearchException();
}
if (typeBinding.isArray()) {
typeBinding= typeBinding.getElementType();

Check notice

Code scanning / Pmd (reported by Codacy)

Avoid reassigning parameters such as 'typeBinding'

Avoid reassigning parameters such as 'typeBinding'
@carstenartur carstenartur force-pushed the addjunitskeleton branch 2 times, most recently from 7de4607 to e000d49 Compare October 13, 2024 10:25
return true;
}
}
return ((BiPredicate<SingleMemberAnnotation, E>) (this.helperVisitor.predicatemap.get(VisitorEnum.SingleMemberAnnotation))).test(node, this.helperVisitor.dataholder);

Check warning

Code scanning / PMD

Useless parentheses. Warning

Useless parentheses.
@carstenartur carstenartur changed the title add skeleton with only renamings add migration cleanup from junit 4 to junit 5 Oct 13, 2024
if (typeBinding.getQualifiedName().equals(qualifiedname)) {
return true;
}
typeBinding = typeBinding.getSuperclass();

Check notice

Code scanning / Pmd (reported by Codacy)

Avoid reassigning parameters such as 'typeBinding'

Avoid reassigning parameters such as 'typeBinding'
if (ORG_JUNIT_RULES_EXTERNAL_RESOURCE.equals(typeBinding.getQualifiedName())) {
return true;
}
typeBinding = typeBinding.getSuperclass();

Check notice

Code scanning / Pmd (reported by Codacy)

Avoid reassigning parameters such as 'typeBinding'

Avoid reassigning parameters such as 'typeBinding'
@Override
public String getPreview() {
StringBuilder sb= new StringBuilder();
EnumSet<JUnitCleanUpFixCore> computeFixSet= computeFixSet();

Check warning

Code scanning / PMD

Avoid using implementation types like 'Stack'; use the interface instead Warning

Avoid using implementation types like 'EnumSet'; use the interface instead
IJavaProject fProject = getJavaProject();
fProject.setRawClasspath(getDefaultClasspath(), null);
IClasspathEntry cpe= JavaCore.newContainerEntry(junitContainerPath);
AbstractEclipseJava.addToClasspath(fProject, cpe);

Check warning

Code scanning / PMD

Unnecessary qualifier 'AbstractEclipseJava': 'addSourceContainer' is already in scope Warning test

Unnecessary qualifier 'AbstractEclipseJava': 'addToClasspath' is already in scope
fProject.setRawClasspath(getDefaultClasspath(), null);
IClasspathEntry cpe= JavaCore.newContainerEntry(junitContainerPath);
AbstractEclipseJava.addToClasspath(fProject, cpe);
fSourceFolder= AbstractEclipseJava.addSourceContainer(fProject, "src");

Check warning

Code scanning / PMD

Unnecessary qualifier 'AbstractEclipseJava': 'addSourceContainer' is already in scope Warning test

Unnecessary qualifier 'AbstractEclipseJava': 'addSourceContainer' is already in scope
@carstenartur carstenartur merged commit 146c0ff into main Nov 17, 2024
6 checks passed
@carstenartur carstenartur deleted the addjunitskeleton branch November 17, 2024 16:53
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.

1 participant