@@ -0,0 +1,2508 @@
+package com.coding4people.mosquitoreport.api.controllers;%0D%0A%0D%0Aimport static org.junit.Assert.assertEquals;%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.AuthEmailController.AuthInput;%0D%0Aimport com.coding4people.mosquitoreport.api.models.Email;%0D%0Aimport com.coding4people.mosquitoreport.api.repositories.EmailRepository;%0D%0A%0D%0Apublic class AuthControllerTest extends WithServer %7B%0D%0A    @Mock%0D%0A    private EmailRepository emailRepository;%0D%0A%0D%0A    @Override%0D%0A    protected ResourceConfig configure() %7B%0D%0A        return super.configure().register(AuthEmailController.class);%0D%0A    %7D%0D%0A    %0D%0A    @Test%0D%0A    public void testAuthFailed() %7B%0D%0A    %09AuthInput data = new AuthInput();%0D%0A        data.setEmail(%22test@test.org%22);%0D%0A        data.setPassword(%22fakepassword%22);%0D%0A        %0D%0A        Email email = new Email();%0D%0A        email.setEmail(%22test@test.org%22);%0D%0A        email.setPassword(%22fakehash%22);%0D%0A%0D%0A        when(emailRepository.load(%22test@test.org%22)).thenReturn(email);%0D%0A%0D%0A        Response response = target().path(%22/auth/email%22).request().post(Entity.json(data));%0D%0A%0D%0A        assertEquals(200, response.getStatus());%0D%0A        assertEquals(%22application/json;charset=UTF-8%22, response.getHeaderString(%22Content-type%22));%0D%0A%0D%0A        Email result = response.readEntity(Email.class);%0D%0A        verify(emailRepository).load(%22test@test.org%22);%0D%0A        assertEquals(%22test@test.org%22, result.getEmail());%0D%0A    %7D%0D%0A%0D%0A    @Test%0D%0A    public void testAuthSuccess() %7B%0D%0A    %09AuthInput data = new AuthInput();%0D%0A        data.setEmail(%22test@test.org%22);%0D%0A        data.setPassword(%22asdfgh%22);%0D%0A        %0D%0A        Email email = new Email();%0D%0A        email.setEmail(%22test@test.org%22);%0D%0A        email.setPassword(%22fakehash%22);%0D%0A%0D%0A        when(emailRepository.load(%22test@test.org%22)).thenReturn(email);%0D%0A%0D%0A        Response response = target().path(%22/auth/email%22).request().post(Entity.json(data));%0D%0A%0D%0A        assertEquals(200, response.getStatus());%0D%0A        assertEquals(%22application/json;charset=UTF-8%22, response.getHeaderString(%22Content-type%22));%0D%0A%0D%0A        Email result = response.readEntity(Email.class);%0D%0A        verify(emailRepository).load(%22test@test.org%22);%0D%0A        assertEquals(%22test@test.org%22, result.getEmail());%0D%0A    %7D%0D%0A%7D%0D%0A

Add AuthController tests