1

I am trying to mock an object using Mockito Library for Java. After mocking the object i am updating some values for that mocked object.

Message m = mock(Message.class);
m.put("org.apache.cxf.http.case_insensitive_queries", false);
m.put("org.apache.cxf.endpoint.private", false);
m.put(Message.REQUEST_URI, pathInfo);
m.put(Message.HTTP_REQUEST_METHOD, method);

However, on debugging the code, i am not able to see the values which i set in the message object.

Attaching screenshot how the message object looks likeenter image description here

Sully
  • 14,672
  • 5
  • 54
  • 79
CodeMonkey
  • 2,265
  • 9
  • 48
  • 94

1 Answers1

0

The put-method in the mocked message doesn't actually do anything. It only records that it has been called so you can verify the call as part of a test. It's a mock object and not the real thing, after all.

Dennis Traub
  • 50,557
  • 7
  • 93
  • 108