I have this mock:
@Mock
ObjectMetadata metaMock;
I then use it in a test with the following line of code:
when(client.getObjectMetadata(bucket, key)).thenReturn(metaMock);
My test returns a NullPointerException at this line in my method under test:
ObjectMetadata meta = client.getObjectMetadata(bucket, key);
As best as I can tell this should work. Am I doing anything wrong here? the only thing I can think is that metaMock may need to have something assigned to it. Is this the case?