Skip to content

Conversation

@Aarushi5g
Copy link

Hey there!
Kindly accept my pull request on Statements in java.
P.S. All the unit tests including all the statements mentioned have been added as well in StatementsTest.java

Hope you'll approve it for Hacktoberfest :)
Thank you 👍

public class StatementsTest {
private Statements object = new Statements();

@Test
Copy link
Contributor

Choose a reason for hiding this comment

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

you havent imported the Test annotation class from JUnit

@januslinhc
Copy link
Contributor

@Aarushi5g we have updated the environment setting. Please re-run the pipeline

@Aarushi5g
Copy link
Author

Aarushi5g commented Oct 14, 2020 via email

Copy link
Owner

@fengyuanyang fengyuanyang left a comment

Choose a reason for hiding this comment

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

hi. , can you a look on it

public void switchStatementTest() {
Scanner sc = new Scanner(System.in);
System.out.println("Enter first number: ");
Double input1 = sc.nextDouble();
Copy link
Owner

Choose a reason for hiding this comment

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

Hi , thanks for your contribution there.
In Unit test , please use
assertEquals to compare expect value and actual value instead of using System.out
You can have a look on other Test class.


case '*':
result = number1 * number2;
System.out.print(number1 + " * " + number2 + " = " + result);
Copy link
Owner

Choose a reason for hiding this comment

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

It's a good practice to use switch , please use return instead of using System.out
it's not able to check the value in unit test.

@Aarushi5g
Copy link
Author

Please accept my pull request!!!

@Aarushi5g
Copy link
Author

I've tried my best 👍

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.

3 participants