Skip to content

unit tests for HelloWorld_UsingAPI - #98

Open
ricardo-ramos-moura wants to merge 1 commit into
NachiketaVadera:masterfrom
ricardo-ramos-moura:unit-test-for-hello-world-api
Open

unit tests for HelloWorld_UsingAPI#98
ricardo-ramos-moura wants to merge 1 commit into
NachiketaVadera:masterfrom
ricardo-ramos-moura:unit-test-for-hello-world-api

Conversation

@ricardo-ramos-moura

Copy link
Copy Markdown

Add unit test for HelloWorld_UsingAPI.

@ricardo-ramos-moura

Copy link
Copy Markdown
Author

@NachiketaVadera please review this PR.

@iamteamstar iamteamstar left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Test files must live under src/test/, not src/main/. This is a Maven/Gradle standard convention. Placing tests in main means they get bundled into production artifacts.
Correct path:
src/test/java/com/helloworld/HelloWorld_APITest.java


@InjectMocks
private HelloWorld_API helloWorld_API;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@Injectmocks is used to inject mock dependencies into the class under test. If HelloWorld_API has no dependencies, this annotation adds no value — a plain new HelloWorld_API() is clearer and more explicit. If it does have dependencies, they should be declared with @mock.

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.

2 participants