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

[issue #12043] module client refact unit test to junit5 #12044

Merged
merged 5 commits into from May 24, 2024

Conversation

shalk
Copy link
Contributor

@shalk shalk commented Apr 29, 2024

Please do not create a Pull Request without creating an issue first.

What is the purpose of the change

#12043

Brief changelog

XX

Verifying this change

XXXX

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in test module.
  • Run mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true to make sure basic checks pass. Run mvn clean install -DskipITs to make sure unit-test pass. Run mvn clean test-compile failsafe:integration-test to make sure integration-test pass.

@shalk shalk changed the title [issue ##12043] Feat junit5 refact client [issue #12043] module client refact unit test to junit5 Apr 29, 2024
Copy link
Collaborator

@KomachiSion KomachiSion left a comment

Choose a reason for hiding this comment

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

测试用例方法命名需要以test开头。


private RpcClient rpcClient;

private Connection connection;

@Test
public void testReceive() throws Exception {
void receive() throws Exception {
Copy link
Collaborator

Choose a reason for hiding this comment

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

测试用例需要以test开头

Copy link
Contributor Author

Choose a reason for hiding this comment

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

prefix is only need for junit3

Copy link
Collaborator

Choose a reason for hiding this comment

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

是的, 我的意思是nacos的测试用例希望以test开头,来更准确的表达测试方法的语意,你可以认为是一个规范。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@KomachiSion
Copy link
Collaborator

另外 问一下改成junit5之后, 使用方法必须改成现在这样吗?

@shalk
Copy link
Contributor Author

shalk commented May 6, 2024

另外 问一下改成junit5之后, 使用方法必须改成现在这样吗?

When i use some plugins to massive refactor, it remove prefix test from test method automatic. Because this is best pratise.

the reason can ref [this]( https://thejavaguy.org/posts/011-dont-prefix-junit-tests-with-the-word-test/

The convention prefix with test is must be for junit3, the prefix is not need any more, from junit4 and junit5 ,we don't neccessaly write it. maybe some early developers follow these junit3 rule.

When we use IDEA to generate test class,when we chose junit3, the prefix will be added, when chose junit4/junit5, the prefix will be not added.

@shalk shalk requested a review from KomachiSion May 6, 2024 12:24

private RpcClient rpcClient;

private Connection connection;

@Test
public void testReceive() throws Exception {
void receive() throws Exception {
Copy link
Collaborator

Choose a reason for hiding this comment

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

是的, 我的意思是nacos的测试用例希望以test开头,来更准确的表达测试方法的语意,你可以认为是一个规范。

@shalk
Copy link
Contributor Author

shalk commented May 10, 2024

@KomachiSion ok, i try to keep the method name not change this time.

@shalk shalk force-pushed the feat-junit5-refact-client branch from 27e10b1 to 2218811 Compare May 10, 2024 12:35
@shalk shalk requested a review from KomachiSion May 11, 2024 02:22
KomachiSion
KomachiSion previously approved these changes May 16, 2024
@shalk shalk force-pushed the feat-junit5-refact-client branch from e2939be to cf6a011 Compare May 17, 2024 05:59
@KomachiSion KomachiSion merged commit 6fa3069 into alibaba:develop May 24, 2024
7 checks passed
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.

None yet

2 participants