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

feat: updating junit from version 4.x to 5.x #56

Merged
merged 2 commits into from
Apr 24, 2024
Merged

feat: updating junit from version 4.x to 5.x #56

merged 2 commits into from
Apr 24, 2024

Conversation

MikeLaptev
Copy link
Contributor

Issue number of the reported bug or feature request: #55

Describe your changes

  • updated version of junit
  • updated version of mockito
  • updated tests (initial changes has been made using openrewrite, but adjusted after to keep name of test functions unchanged
  • result codes tests has been split on a several groups due to difficulties to use @Nested tests in the existing way the tests are written
  • marking commented out tests as @Disabled
  • several misprints has been addressed as well

Testing performed
I have used mvn -U clean test with all targeted platforms such as JDK8, JDK11 and JDK17.

Additional context
I didn't find how I can run integration tests locally as part of the dockerized setup, so, it would be great if you can added some instructions 🙏🏼

- updated version of junit
- updated version of mockito
- updated tests (initial changes has been made using openrewrite, but adjusted after to keep name of test functions unchanged
- result codes tests has been split on a several groups due to difficulties to use @nested tests in the existing way the tests are written
- marking commented out tests as @disabled
- several misprints has been addressed as well

Signed-Off-By: Mikhail Laptev <mikhail.laptev@gmail.com>
Copy link
Collaborator

@sgalichkin sgalichkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good.
There a few questions

} catch (RuntimeException e) {
// OK
}
@ParameterizedTest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Finally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is something that I like the most for parametrized tests in JUnit5 together with the fact that you don't need a separate class for them, so both regular and parametrized can be part of just a single one

@@ -519,7 +520,7 @@ public void arriveAtStep(QueueImpl queue, QueueOptions queueOptions, QueueTestSt
connection.setChannelStatus(ChannelStatus.CHANNEL_UP);

// Negotiate
sendNegotiationRespose(
sendNegotiationResponse(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Less typos, better code

@@ -589,8 +590,8 @@ public void arriveAtStep(QueueImpl queue, QueueOptions queueOptions, QueueTestSt
Argument.expectNonNull(curRequest, "curRequest")
.configureStream()
.streamParameters();
assertEquals(params.subscriptions().length, 1);
assertEquals(params.subscriptions()[0].consumers().length, 1);
assertEquals(1, params.subscriptions().length);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
Now is everywhere: first is expected, second is actual

@@ -709,7 +710,7 @@ private static Uri createUri() {

/** Basic test that creates BrokerSession with a test channel */
@Test
public void breathingTest() {
void breathingTest() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍
No need to be public

@@ -631,7 +632,8 @@ public void testDisconnectWhileConnectionInProgress() {
assertEquals(0, obj.linger());
}

// @Test
@Test
@Disabled
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

public void testExpressionValidator(
String inputExpression, Boolean expectedResult, String expectedErrorMessage)
throws java.io.IOException {
initExpressionValidatorTest(inputExpression, expectedResult, expectedErrorMessage);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, we don't, good catch!

// @Test
public void pushMessageTest() throws BMQException, IOException {
@Test
@Disabled
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put the comment above as an argument for @Disabled or at least add some summary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the comment to the @Disabled 👍🏼


import com.bloomberg.bmq.ResultCodes;

public class AckResultChecks {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do such classes need to be in separate files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've looked one more on the structure, it is not needed, at the time of applying changes it has been easier to keep them in such a structure, but, I've consolidated checks with particular test classes, the only one - generic, I kept separate since it is related to all of them.

Let me know what do you think about that!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed this comment.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it makes sense to have a separate class/file for some reason e.g. it's used by other classes then it should be fine.
If it's used by one class only, then it may be better to not use a separate file for that (unless it may be used by other classes in future)

}

@Test
public void successTest() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, didn't notice while looking through the changes.

}
}

public static class StorageFailureTest extends AckGenericTest {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, I agree, there is no particular reason to have it public here and in the other classes and functions.

Signed-Off-By: Mikhail Laptev <mikhail.laptev@gmail.com>
@MikeLaptev
Copy link
Contributor Author

Comments have been addressed.

Copy link
Collaborator

@sgalichkin sgalichkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 , one question

@@ -20,10 +20,9 @@

import com.bloomberg.bmq.ResultCodes;

public class GenericResultChecks {
class GenericResultChecks {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So unlike others, we still need this as a separate class?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Answered in original comment above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, it is used by all the tests in the com.bloomberg.bmq.resultcodes package.
maybe I need to look at the structure with a fresh mind one day...

@678098 678098 self-assigned this Apr 24, 2024
Copy link
Collaborator

@678098 678098 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update @MikeLaptev!

@678098 678098 merged commit 1986bae into bloomberg:main Apr 24, 2024
7 checks passed
@678098 678098 added the A-Other Area: Other label Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Other Area: Other
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants