-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Formalize null handling of type tokens #2030
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
new Gson().getAdapter((TypeToken<Object>) null); | ||
assertTrue("Unreachable", false); | ||
} | ||
catch (NullPointerException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you join this to the previous line?
} catch (NullPointerException e) {
// Note: ExpectedException cannot be used due to test suite extending TestCase | ||
try { | ||
new Gson().getAdapter((TypeToken<Object>) null); | ||
assertTrue("Unreachable", false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fail()
would be fine here.
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These imports seem to be unused.
@@ -82,4 +86,16 @@ public void testClonedTypeAdapterFactoryListsAreIndependent() { | |||
} | |||
@Override public Object read(JsonReader in) throws IOException { return null; } | |||
} | |||
|
|||
public void testNullAdapterLookup() { | |||
// Formalize the handling of null type tokens (previously it was partially handled, but still throwing an error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this comment line here is useful in the test code. To me this message only seems to be relevant regarding why this pull request or commit was created, but not why this test exists.
Note that unlike eamonnmcmanus, I am not a member of this project. Feel free to consider my comments only as suggestion.
I am closing this pull request because this issue has been fixed as part of #2153. Thanks nonetheless for your pull request! |
#1831