samedi 4 juin 2016

What is the way i should test update method?

I would like test if my update method saving changes into object passing as path variable, but I stack :

mockMvc.perform(post("/pet/update/{id}", 1L)
        .param("species", "gorilla"))
        .andExpect(status().isFound())
        .andExpect(redirectedUrl("/pet/findById/1"));

assertThat(one.getName(), is("Kajtek"));
assertThat(one.getSpecies(), is("gorilla"));

I thought when I use the param method, I setting parameters name and value then pass they into object which is keep in model but am I wrong?

Aucun commentaire:

Enregistrer un commentaire