@@ -0,0 +1,1636 @@
+package com.coding4people.mosquitoreport.api.controllers;%0D%0A%0D%0Aimport static org.junit.Assert.assertEquals;%0D%0Aimport static org.mockito.Matchers.eq;%0D%0Aimport static org.mockito.Mockito.verify;%0D%0Aimport static org.mockito.Mockito.when;%0D%0A%0D%0Aimport javax.ws.rs.client.Entity;%0D%0Aimport javax.ws.rs.core.Response;%0D%0A%0D%0Aimport org.glassfish.jersey.server.ResourceConfig;%0D%0Aimport org.junit.Test;%0D%0Aimport org.mockito.Mock;%0D%0A%0D%0Aimport com.coding4people.mosquitoreport.api.WithServer;%0D%0Aimport com.coding4people.mosquitoreport.api.controllers.SignUpController.SignUpInput;%0D%0Aimport com.coding4people.mosquitoreport.api.models.Email;%0D%0Aimport com.coding4people.mosquitoreport.api.repositories.EmailRepository;%0D%0Aimport com.coding4people.mosquitoreport.api.repositories.UserRepository;%0D%0A%0D%0Apublic class SignUpControllerTest extends WithServer %7B%0D%0A    @Mock%0D%0A    EmailRepository emailRepository;%0D%0A    @Mock%0D%0A    UserRepository userRepository;%0D%0A%0D%0A    @Override%0D%0A    protected ResourceConfig configure() %7B%0D%0A        return super.configure().register(SignUpController.class);%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void testSignUpEmailAlreadyExists() %7B%0D%0A        SignUpInput input = new SignUpInput();%0D%0A        input.setEmail(%22test@test.org%22);%0D%0A        input.setPassword(%22123456%22);%0D%0A        input.setFirstname(%22new firstname%22);%0D%0A        input.setLastname(%22new lastname%22);%0D%0A%0D%0A        when(emailRepository.load(input.getEmail())).thenReturn(new Email());%0D%0A%0D%0A        Response response = target().path(%22/signup/email%22).request().post(Entity.json(input));%0D%0A%0D%0A        assertEquals(400, response.getStatus());%0D%0A%0D%0A        verify(emailRepository).load(eq(input.getEmail()));%0D%0A    %7D%0D%0A%7D%0D%0A

Test sign up when email already exists