Skip to content

Conversation

@vyshakputhusseri
Copy link
Contributor

I tried to upgraded the code base to junit5 to get new features for unit testing. Below are the steps, I followed :
Steps:

  1. Update the dependencies in pom.xml
  2. Changing Packages

org.junit.Test to org.junit.jupiter.api.Test
org.junit.Assert.* to org.junit.jupiter.api.Assertions.*

  1. When converting exception assertions from JUnit 4 to JUnit 5, the approach changes from using the @test(expected = ...) annotation to using the assertThrows method in JUnit 5
Screenshot 2024-11-01 at 1 15 06 AM

@vyshakputhusseri
Copy link
Contributor Author

#231

@davidmoten
Copy link
Owner

Looks worthwhile, thanks! I'll review soon.

@codecov
Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.39%. Comparing base (7f0f860) to head (b5dcb1d).
Report is 139 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #232      +/-   ##
============================================
- Coverage     99.53%   98.39%   -1.15%     
- Complexity      171      173       +2     
============================================
  Files            10       10              
  Lines           428      435       +7     
  Branches         75       77       +2     
============================================
+ Hits            426      428       +2     
- Misses            1        3       +2     
- Partials          1        4       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines 24 to 44
Constructor<T> constructor;
try {
constructor = cls.getDeclaredConstructor();
} catch (NoSuchMethodException e1) {
throw new RuntimeException(e1);
} catch (SecurityException e1) {
throw new RuntimeException(e1);
}
assertTrue(Modifier.isPrivate(constructor.getModifiers()));
constructor.setAccessible(true);
try {
constructor.newInstance();
} catch (InstantiationException e) {
throw new RuntimeException(e);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
} catch (IllegalArgumentException e) {
throw new RuntimeException(e);
} catch (InvocationTargetException e) {
throw new RuntimeException(e);
}
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 missed this case.
Can I make change to this method?

Copy link
Owner

Choose a reason for hiding this comment

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

Sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@davidmoten That one missed change was also done. You can proceed with the review.

Copy link
Owner

@davidmoten davidmoten left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@davidmoten davidmoten merged commit f20ede4 into davidmoten:master Nov 7, 2024
5 checks passed
@davidmoten
Copy link
Owner

oops, forgot to squash, I'll squash now

@davidmoten
Copy link
Owner

squashed, thanks for the contribution @puthusseri!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants