    @Test
    public void testSendEmail() throws Exception {

        String from = "test@mail.com";
        String message = "Mail message";
        String name = "Name";

        ContactForm contactForm = new ContactForm();
        contactForm.setMail(from);
        contactForm.setMessage(message);
        contactForm.setName(name);

        Mockito.when(mailService.sendEMail(from, mailTo, "Message from " + name, message)).thenReturn(true);

        mockMvc.perform(post("/contact").accept(MediaType.APPLICATION_XHTML_XML)
                .sessionAttr("contactForm", contactForm))
                .andExpect(redirectedUrl("contact?sent=false"))
                .andExpect(model().attributeExists("contactForm"));
    }