@Test public void testAuthType() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); AuthInfo info = new AuthInfo(req).setAuthType("FakeAuth"); assertEquals("FakeAuth", info.getAuthType()); // This should work when creating a new AuthInfo from the same request assertEquals("FakeAuth", new AuthInfo(req).getAuthType()); }
@Test public void testAuthType() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); AuthInfo info = new AuthInfo(req).setAuthType("FakeAuth"); assertEquals("FakeAuth", info.getAuthType()); // This should work when creating a new AuthInfo from the same request assertEquals("FakeAuth", new AuthInfo(req).getAuthType()); }
@Test public void testBinding() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); SecurityToken token = new FakeGadgetToken(); new AuthInfo(req).setSecurityToken(token).setAuthType("FakeAuth"); Injector injector = Guice.createInjector(new TestModule(req)); AuthInfo injected = injector.getInstance(AuthInfo.class); assertEquals(token, injected.getSecurityToken()); assertEquals("FakeAuth", injected.getAuthType()); }
@Test public void testBinding() throws Exception { HttpServletRequest req = new FakeHttpServletRequest(); SecurityToken token = new FakeGadgetToken(); new AuthInfo(req).setSecurityToken(token).setAuthType("FakeAuth"); Injector injector = Guice.createInjector(new TestModule(req)); AuthInfo injected = injector.getInstance(AuthInfo.class); assertEquals(token, injected.getSecurityToken()); assertEquals("FakeAuth", injected.getAuthType()); }