If I understand what you're doing, you've mocked a builder.
You don't have mocking that covers calling builder.entity()
on the builder
returned by webResource.accept()
, so it returns null
and the next call in the chain fails (builder.type()
).
Add:
when(builder.entity(anyString())).thenReturn(builder);
(provided multiPart
is a String
)