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

fix: allows for parent-less package creation (issue #3488). #3489

Merged
merged 9 commits into from Jul 19, 2020
Merged

fix: allows for parent-less package creation (issue #3488). #3489

merged 9 commits into from Jul 19, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jul 9, 2020

This pull request adds a test case for generating a parent-less package. At the moment, the test case is failing with a NullPointerException on line 39. For this, issue #3488 was raised.

Fix #3488

@monperrus
Copy link
Collaborator

Thanks for the test case, it's very useful.

However, CI does not fail. Any idea?

@ghost
Copy link
Author

ghost commented Jul 10, 2020

Indeed, my test is not run. Which Unit Testing Framework are you using? JUnit 4 or JUnit 5?

@MartinWitt
Copy link
Collaborator

You mixed junit 4 and 5. Spoon supports junit 4 and 5.
Junit 5 assertions come from here.
Changing the static imports from org.junit.Assertions to org.junit.jupiter.api.Assertions should fix it.

@ghost
Copy link
Author

ghost commented Jul 12, 2020

When I added the Unit 5 annotations and used the JUnit 5 assertions, the test was still not getting picked up. I switched to Unit 4 and it is failing now because of the issue described in #3488.

@monperrus
Copy link
Collaborator

Thanks a lot for the failing test case. The fix should be relatively easy, would you like to give it a try?

@MartinWitt
Copy link
Collaborator

MartinWitt commented Jul 14, 2020

Fix lgtm, the testcase has 2 issues from my side.

  • It could be moved to a more fitting package and not placed inside the main package
  • in spoon we try to have a description in natural language as a comment for every testcase following the form:
    // contract: $description e.g.
    // contract: a package with null as parentname is creatable
    otherwise good catch and fix

@monperrus monperrus changed the title Add test for generating parent-less package (issue #3488). fix bug for parent-less package (issue #3488). Jul 15, 2020
@monperrus
Copy link
Collaborator

@clemensbartz what about moving the test in package spoon.test.factory? Thanks!

@ghost
Copy link
Author

ghost commented Jul 18, 2020

Class was moved to package, comment was added as well.

@monperrus
Copy link
Collaborator

Thanks a lot, LGTM. Will merge.

@monperrus monperrus changed the title fix bug for parent-less package (issue #3488). fix: allows for parent-less package creation (issue #3488). Jul 19, 2020
@monperrus monperrus merged commit de74592 into INRIA:master Jul 19, 2020
@monperrus
Copy link
Collaborator

Thanks a lot for your contribution @clemensbartz

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.

NullPointerException when creating new Package (spoon.reflect.factory.PackageFactory#create)
2 participants