You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, Jukito will inject a mock CheckConformance which will later cause issues because the contract for the interface is to never return a null, causing a NullPointerException when the mock breaks that contract:
if (checkConformance != null) {
ImmutableList<SoySyntaxException> violations = checkConformance.getViolations(soyTree);
if (!violations.isEmpty()) {
Jukito shouldn't inject such injection points with mocks unless bind() or forceMock() has been called for the key.
The workaround in my case is to explicitly bind CheckConformance to a dummy instance (or configure the mock) to make sure it never return nulls.
The text was updated successfully, but these errors were encountered:
Ah indeed, if Jukito has to inject a mock somewhere in the graph, then it should inject one in the optional injection point I suppose. I'd say Jukito should follow whatever Guice does for JIT bindings.
If that's not possible, or too difficult, I could also live with a way to disable "auto mocking" for some classes (kind of the opposite of forceMock()).
In my case, the workaround was easy, but I'm sure there are times when it's not so simple. This would be particularly true when the optionally-injected classes are really internal (e.g. package private) to a third-party lib.
I'm using a third-party library that uses Guice (Closure Templates) and makes use of optional injection:
Unfortunately, Jukito will inject a mock
CheckConformance
which will later cause issues because the contract for the interface is to never return anull
, causing aNullPointerException
when the mock breaks that contract:Jukito shouldn't inject such injection points with mocks unless
bind()
orforceMock()
has been called for the key.The workaround in my case is to explicitly bind
CheckConformance
to a dummy instance (or configure the mock) to make sure it never returnnull
s.The text was updated successfully, but these errors were encountered: