Comment envoyer un objet maquette en tant que JSON dans mockmvc

Je veux envoyer un objet fantaisie dans le contrôleur via MockMvc avec un type de contenu JSON. Mais quand je suis en train de sérialiser la simulation de l'erreur est:

java.lang.UnsupportedOperationException: Expecting parameterized type, got interface org.mockito.internal.MockitoInvocationHandler.
 Are you missing the use of TypeToken idiom?

Mon code est comme suit:

@Test
public void testSomething(){

    String xyz = "";
    Integer i = 10;
    SomeClass inst = mock(SomeClass.class, withSettings().serializable());
    when(inst.getProperty1()).then(xyz);
    when(inst.getProperty2()).then(i);

    Gson gson = new Gson();
    String json = gson.toJson(inst); //this is creating error

    this.mockmvc.perform(put("/someUrl/").contentType(MediaType.JSON).content(json)).andExpect(status().isOk());
}

Quelqu'un peut me dire ce que je suis absent?

source d'informationauteur Sourabh