Skip to content
Snippets Groups Projects
Commit 58772f94 authored by Paul-Christian Volkmer's avatar Paul-Christian Volkmer
Browse files

Task #3894: Fixed last missing test by checking if response equals expected

parent 40b42f70
No related merge requests found
...@@ -20,7 +20,6 @@ package de.thm.arsnova.controller; ...@@ -20,7 +20,6 @@ package de.thm.arsnova.controller;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import javax.inject.Inject; import javax.inject.Inject;
...@@ -42,7 +41,6 @@ import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAda ...@@ -42,7 +41,6 @@ import org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAda
import org.springframework.web.servlet.view.RedirectView; import org.springframework.web.servlet.view.RedirectView;
import de.thm.arsnova.LoginController; import de.thm.arsnova.LoginController;
import de.thm.arsnova.entities.User;
@RunWith(SpringJUnit4ClassRunner.class) @RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={ @ContextConfiguration(locations={
...@@ -102,20 +100,15 @@ public class LoginControllerTest { ...@@ -102,20 +100,15 @@ public class LoginControllerTest {
assertEquals("Guest1234567890", auth.getName()); assertEquals("Guest1234567890", auth.getName());
} }
/*
@Test @Test
public void testUser() throws Exception { public void testUser() throws Exception {
request.setMethod("GET"); request.setMethod("GET");
request.setRequestURI("/whoami"); request.setRequestURI("/whoami");
final ModelAndView mav = handlerAdapter.handle(request, response, loginController); handlerAdapter.handle(request, response, loginController);
assertNotNull(response);
assertNotNull(mav); assertEquals(response.getContentAsString(),"{\"username\":\"Guest1234567890\"}");
assertTrue(mav.getModel().containsKey("user")); }
assertEquals(mav.getModel().get("user").getClass(), User.class);
assertEquals("Guest1234567890", ((User)mav.getModel().get("user")).getUsername());
}*/
@Test @Test
public void testLogoutWithoutRedirect() throws Exception { public void testLogoutWithoutRedirect() throws Exception {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment