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

review: test: add tests for JavaOutputProcessor class #4043

Merged
merged 3 commits into from
Jul 16, 2021
Merged

review: test: add tests for JavaOutputProcessor class #4043

merged 3 commits into from
Jul 16, 2021

Conversation

Rohitesh-Kumar-Jain
Copy link
Contributor

#1818

Hi, I have added some new tests for methods of the JavaOutputProcessor class :

These tests are intended to kill these 2 mutations:

Screenshot 2021-07-14 at 4 24 56 PM

Link to #3967

Copy link
Collaborator

@slarse slarse left a comment

Choose a reason for hiding this comment

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

Tests look good to me, just had a little nitpick on the file exists assertion.

On a side note, with JUnit5, test methods do not need to be public anymore, it's sufficient that they are package private. I don't think that matters too much in the grand scheme of things, but I'd personally make the test methods package private.

src/test/java/spoon/support/JavaOutputProcessorTest.java Outdated Show resolved Hide resolved
src/test/java/spoon/support/JavaOutputProcessorTest.java Outdated Show resolved Hide resolved
Copy link
Collaborator

@slarse slarse 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, very well written tests @Rohitesh-Kumar-Jain! I'd encourage you to look at the first tests you wrote, and then look at these. The improvement is tangible.

I had one nitpick on your edit. It's such a small thing that I'll leave it up to you if you want to change it. Will merge tomorrow morning regardless.


// act
javaOutputProcessor.process(module);
File expectedFile = tempDir.toPath().resolve("emptyModule/module-info.java").toFile();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is really nitpicking, but in the AAA pattern, computing an expected value is not part of the act phase. It either belongs in arrange or assert, depending on who you ask. For a value as simple as this one, I'd definitely put it in the assert phase to keep the variable use close to its definition.

@Rohitesh-Kumar-Jain
Copy link
Contributor Author

Looks good, very well written tests @Rohitesh-Kumar-Jain!

I am glad I am improving 🎉

I'd encourage you to look at the first tests you wrote, and then look at these.

Yes, actually I look often at my previous tests and suggestions requested for them, Idea is avoiding the past mistakes, and learn from new mistakes.

Copy link
Collaborator

@slarse slarse 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, well done!

FYI, I'm going on vacation tomorrow and will be back on August 9th. I may be around Spoon a bit but certainly not every day. So, probably expect slower feedback during this time.

@nharrand Ping that I'm going away.

@slarse slarse merged commit 09a609b into INRIA:master Jul 16, 2021
@monperrus monperrus mentioned this pull request Aug 19, 2021
woutersmeenk pushed a commit to woutersmeenk/spoon that referenced this pull request Aug 29, 2021
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