Skip to content
New issue

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

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

Already on GitHub? # to your account

test: migrate MethodReferenceTest to JUnit 5 #4549

Merged

Conversation

MartinWitt
Copy link
Collaborator

#3919

Change Log

The following bad smells are refactored:

JUnit4-@test

The JUnit 4 @Test annotation should be replaced with JUnit 5 @Test annotation.

JUnit4-AssertThat

AssertThat in Junit 4 is deprecated. Use AssertThat in Hamcrest instead.

JUnit4Assertion

The JUnit4 assertion should be replaced with JUnit5 Assertions.

Junit4-@before

The JUnit 4 @Before annotation should be replaced with JUnit 5 @BeforeEach annotation.

The following has changed in the code:

JUnit4-@test

  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAStaticMethod
  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAnInstanceMethodOfAParticularObject
  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAnInstanceMethodOfMultiParticularObject
  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAnInstanceMethodOfAnArbitraryObjectOfAParticularType
  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAConstructor
  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAClassParametrizedConstructor
  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAJavaUtilClassConstructor
  • Replaced junit 4 test annotation with junit 5 test annotation in testCompileMethodReferenceGeneratedBySpoon
  • Replaced junit 4 test annotation with junit 5 test annotation in testTryRecoverTypeArgumentsHandlesNullTypeArguments
  • Replaced junit 4 test annotation with junit 5 test annotation in testNoClasspathExecutableReferenceExpression
  • Replaced junit 4 test annotation with junit 5 test annotation in testNoClasspathSuperExecutable
  • Replaced junit 4 test annotation with junit 5 test annotation in testGetGenericMethodFromReference
  • Replaced junit 4 test annotation with junit 5 test annotation in testGetGenericExecutableReference
  • Replaced junit 4 test annotation with junit 5 test annotation in testReferenceBuilderWithComplexGenerics

JUnit4-AssertThat

  • Replaced Assert.assertThat with MatcherAssert.assertThat in testGetGenericExecutableReference
  • Replaced Assert.assertThat with MatcherAssert.assertThat in testGetGenericExecutableReference
  • Replaced Assert.assertThat with MatcherAssert.assertThat in testGetGenericExecutableReference
  • Replaced Assert.assertThat with MatcherAssert.assertThat in testReferenceBuilderWithComplexGenerics
  • Replaced Assert.assertThat with MatcherAssert.assertThat in testReferenceBuilderWithComplexGenerics

Junit4-@before

  • Replaced @Before annotation with @BeforeEach at method setUp

JUnit4Assertion

  • Transformed junit4 assert to junit 5 assertion in testReferenceToAStaticMethod
  • Transformed junit4 assert to junit 5 assertion in testReferenceToAnInstanceMethodOfAParticularObject
  • Transformed junit4 assert to junit 5 assertion in testReferenceToAnInstanceMethodOfMultiParticularObject
  • Transformed junit4 assert to junit 5 assertion in testReferenceToAnInstanceMethodOfAnArbitraryObjectOfAParticularType
  • Transformed junit4 assert to junit 5 assertion in testReferenceToAConstructor
  • Transformed junit4 assert to junit 5 assertion in testReferenceToAClassParametrizedConstructor
  • Transformed junit4 assert to junit 5 assertion in testReferenceToAJavaUtilClassConstructor
  • Transformed junit4 assert to junit 5 assertion in testNoClasspathExecutableReferenceExpression
  • Transformed junit4 assert to junit 5 assertion in testNoClasspathSuperExecutable
  • Transformed junit4 assert to junit 5 assertion in testGetGenericMethodFromReference
  • Transformed junit4 assert to junit 5 assertion in testGetGenericExecutableReference
  • Transformed junit4 assert to junit 5 assertion in assertTypedBy
  • Transformed junit4 assert to junit 5 assertion in assertTargetedBy
  • Transformed junit4 assert to junit 5 assertion in assertExecutableNamedBy
  • Transformed junit4 assert to junit 5 assertion in assertIsWellPrinted
  • Transformed junit4 assert to junit 5 assertion in testReferenceBuilderWithComplexGenerics

 The following has changed in the code:
Replaced @before annotation with @beforeeach at method setUp
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAStaticMethod
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAnInstanceMethodOfAParticularObject
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAnInstanceMethodOfMultiParticularObject
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAnInstanceMethodOfAnArbitraryObjectOfAParticularType
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAConstructor
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAClassParametrizedConstructor
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceToAJavaUtilClassConstructor
Replaced junit 4 test annotation with junit 5 test annotation in testCompileMethodReferenceGeneratedBySpoon
Replaced junit 4 test annotation with junit 5 test annotation in testTryRecoverTypeArgumentsHandlesNullTypeArguments
Replaced junit 4 test annotation with junit 5 test annotation in testNoClasspathExecutableReferenceExpression
Replaced junit 4 test annotation with junit 5 test annotation in testNoClasspathSuperExecutable
Replaced junit 4 test annotation with junit 5 test annotation in testGetGenericMethodFromReference
Replaced junit 4 test annotation with junit 5 test annotation in testGetGenericExecutableReference
Replaced junit 4 test annotation with junit 5 test annotation in testReferenceBuilderWithComplexGenerics
Replaced Assert.assertThat with MatcherAssert.assertThat in testGetGenericExecutableReference
Replaced Assert.assertThat with MatcherAssert.assertThat in testGetGenericExecutableReference
Replaced Assert.assertThat with MatcherAssert.assertThat in testGetGenericExecutableReference
Replaced Assert.assertThat with MatcherAssert.assertThat in testReferenceBuilderWithComplexGenerics
Replaced Assert.assertThat with MatcherAssert.assertThat in testReferenceBuilderWithComplexGenerics
Transformed junit4 assert to junit 5 assertion in testReferenceToAStaticMethod
Transformed junit4 assert to junit 5 assertion in testReferenceToAnInstanceMethodOfAParticularObject
Transformed junit4 assert to junit 5 assertion in testReferenceToAnInstanceMethodOfMultiParticularObject
Transformed junit4 assert to junit 5 assertion in testReferenceToAnInstanceMethodOfAnArbitraryObjectOfAParticularType
Transformed junit4 assert to junit 5 assertion in testReferenceToAConstructor
Transformed junit4 assert to junit 5 assertion in testReferenceToAClassParametrizedConstructor
Transformed junit4 assert to junit 5 assertion in testReferenceToAJavaUtilClassConstructor
Transformed junit4 assert to junit 5 assertion in testNoClasspathExecutableReferenceExpression
Transformed junit4 assert to junit 5 assertion in testNoClasspathSuperExecutable
Transformed junit4 assert to junit 5 assertion in testGetGenericMethodFromReference
Transformed junit4 assert to junit 5 assertion in testGetGenericExecutableReference
Transformed junit4 assert to junit 5 assertion in assertTypedBy
Transformed junit4 assert to junit 5 assertion in assertTargetedBy
Transformed junit4 assert to junit 5 assertion in assertExecutableNamedBy
Transformed junit4 assert to junit 5 assertion in assertIsWellPrinted
Transformed junit4 assert to junit 5 assertion in testReferenceBuilderWithComplexGenerics
@monperrus monperrus merged commit 75c7ed3 into INRIA:master Jan 22, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants