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 test for removeAnnotation method #4056

Merged
merged 6 commits into from
Aug 9, 2021
Merged

review: test: add test for removeAnnotation method #4056

merged 6 commits into from
Aug 9, 2021

Conversation

Rohitesh-Kumar-Jain
Copy link
Contributor

#1818

Hi, I have added a new test for the method removeAnnotation :

These tests are intended to kill this mutation:

Screenshot 2021-07-19 at 11 14 20 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.

Hi @Rohitesh-Kumar-Jain,

Sorry about the slow response these days. I'm prioritizing your PRs as I know you're doing the GSOC thing, but I'm just not around that much during vacation times.

Anyway, the test here looks pretty good, but there are a couple of fundamental mistakes/miscomprehensions.

First of all, we don't typically test implementations, but rather test the public interfaces (e.g. CtElement). Second, you're not actually explicitly testing CtElementImpl in this test, you're testing the CtClass interface. How that interface's removeAnnotation method is implement is an unspecified implementation detail that could change at any time, making the test's specification non-robust.

To fix this, I would either a) place this test inside CtClassTest or b) explicitly instantiate a CtElementImpl and test that. I would favor a) as we don't typically test specific implementation details, but the choice is up to you.

src/test/java/spoon/test/ctElement/CtElementImplTest.java Outdated Show resolved Hide resolved
src/test/java/spoon/test/ctElement/CtElementImplTest.java Outdated Show resolved Hide resolved
@Rohitesh-Kumar-Jain
Copy link
Contributor Author

Sorry about the slow response these days. I'm prioritizing your PRs as I know you're doing the GSOC thing, but I'm just not around that much during vacation times.

It's perfectly fine, do enjoy vacations 🎉, I am too going to grandma's house just after this ends

Thanks for prioritizing PRs : )

First of all, we don't typically test implementations, but rather test the public interfaces

I will keep this in mind for future

How that interface's removeAnnotation method is implement is an unspecified implementation detail that could change at any time, making the test's specification non-robust.

That didn't came to my mind, thanks for letting me know

To fix this, I would either a) place this test inside CtClassTest or b) explicitly instantiate a CtElementImpl and test that.

a) seems fine to me as well

@Rohitesh-Kumar-Jain
Copy link
Contributor Author

a) seems fine to me as well

For a) realized I first need to migrate CtClassTest it to Junit5

@slarse
Copy link
Collaborator

slarse commented Jul 26, 2021

For a) realized I first need to migrate CtClassTest it to Junit5

This PR is already started, so I'm perfectly fine with you skipping that in this case.

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.

@slarse slarse merged commit d9c091f into INRIA:master Aug 9, 2021
@Rohitesh-Kumar-Jain Rohitesh-Kumar-Jain deleted the add-test-for-removeAnnotation-method branch August 9, 2021 08:04
@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.

3 participants