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 NPE when Spoon launch with a wrong path for input resource #1057

Merged
merged 16 commits into from
Dec 20, 2016
Merged

Fix NPE when Spoon launch with a wrong path for input resource #1057

merged 16 commits into from
Dec 20, 2016

Conversation

surli
Copy link
Collaborator

@surli surli commented Dec 20, 2016

Fix #1042 and now encapsulate a FileNotFoundException inside a SpoonException in case of a wrong path given to Spoon.

@Test
public void testLauncherWithWrongPathAsInput() {
expectedEx.expect(SpoonException.class);
expectedEx.expectMessage("java.io.FileNotFoundException: The following file does not exist: /Users/urli/Github/spoon/src/wrong/direction/File.java");
Copy link
Contributor

Choose a reason for hiding this comment

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

Should a test case really depend on the message of an exception?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh. Indeed I was a bit fast in my cut & paste. The intent was only to paste the FileNotFound. I fix that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Furthermore, I'm pretty sure that most of us do not clone Spoon into: /Users/urli/Github/spoon :)

@Test
public void testLauncherWithWrongPathAsInput() {
expectedEx.expect(SpoonException.class);
expectedEx.expectMessage("java.io.FileNotFoundException");
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Change to use a try catch and make the assert in catch

@monperrus monperrus merged commit ff57253 into INRIA:master Dec 20, 2016
@surli surli deleted the fixNPEWithWrongPath branch December 20, 2016 16:31
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