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

Added tests for NumberParser #296

Merged
merged 1 commit into from Apr 27, 2016
Merged

Conversation

rohancme
Copy link
Contributor

Added tests for the NumberParser class.

I've created a tool that uses Randoop to generate tests and then prunes them using PIT as a measure of quality. So far it's been useful in understanding which classes need more tests in a repo and approaches on how to add Line and Mutation Coverage.

Thought I would start with one of the simpler classes to test and once I get this reviewed I can submit a few more PRs with tests for other classes as well!

@rohancme
Copy link
Contributor Author

rohancme commented Apr 21, 2016

Improvement in Test Coverage (using PIT):

Before:
before_rome_np

After:
after_rome_np

@Test
public void testLongParseSuccess() {
Long num = NumberParser.parseLong("1");
assertTrue(num == 1L);
Copy link
Member

Choose a reason for hiding this comment

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

Would assertEquals work? Same for other tests.

@mishako
Copy link
Member

mishako commented Apr 22, 2016

Hi Rohan! Thank you for the contribution. Looks good! I left some comments. They might be a bit nitpicky, but since you're going to continue with this kind of pull requests, I think it's good to do everything properly from the start.

@rohancme
Copy link
Contributor Author

Thanks for the review @mishako ! Really appreciate it. I'll make the
changes and update soon!

On Fri, Apr 22, 2016, 3:07 PM mishako notifications@github.com wrote:

Hi Rohan! Thank you for the contribution. Looks good! I left some
comments. They might be a bit nitpicky, but since you're going to continue
with this kind of pull requests, I think it's good to do everything
properly from the start.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#296 (comment)

@rohancme
Copy link
Contributor Author

@mishako I've made the suggested changes. I'd appreciate you taking a quick look!

@mishako
Copy link
Member

mishako commented Apr 27, 2016

@rchakra3 You've included commits from master in your branch.

@rohancme
Copy link
Contributor Author

@mishako Sorry I've fixed that!

@mishako
Copy link
Member

mishako commented Apr 27, 2016

@rchakra3 Nice! Do you want to squash commits into one before we merge it?

@rohancme
Copy link
Contributor Author

@mishako Done! :)

@mishako
Copy link
Member

mishako commented Apr 27, 2016

@rchakra3 Ah, sorry, I missed more things:

  • The first argument of assertEquals(a, b) is expected value, not the other way around.
  • The first argument of assertEquals(a, b, c) is message (see two bottom tests).

@rohancme rohancme force-pushed the NumberParserTests branch 2 times, most recently from e439179 to 6c7032c Compare April 27, 2016 19:36
@rohancme
Copy link
Contributor Author

@mishako I've made the changes. Do the messages look fine?

@mishako
Copy link
Member

mishako commented Apr 27, 2016

@rchakra3 The messages look fine, but they are pretty much what assertEquals has by default, so do you really need them?

@rohancme
Copy link
Contributor Author

@mishako That's true. I assumed you expected a custom message as per your second point above:
"The first argument of assertEquals(a, b, c) is message (see two bottom tests)."
since assertEquals(a, b, c) with a as the message seems to be deprecated

Did I misunderstand you?

@mishako
Copy link
Member

mishako commented Apr 27, 2016

@rchakra3 No, it's me, sorry. You were correctly using delta as the third argument, I didn't know about it and assumed you made a mistake. Sorry! :)

@rohancme
Copy link
Contributor Author

@mishako Not a problem! :)

I think I've got all the changes in now!

@mishako mishako merged commit 63ce658 into rometools:master Apr 27, 2016
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.

None yet

2 participants