Package com.wesabe.api.util.auth

Examples of com.wesabe.api.util.auth.WesabeUser


    @Test
    public void itCreatesAWesabeUserInstance() throws Exception {
      final UserAuthentication auth = (UserAuthentication) authenticate();
      assertThat(auth.getUserIdentity().getUserPrincipal()).isInstanceOf(WesabeUser.class);
     
      final WesabeUser user = (WesabeUser) auth.getUserIdentity().getUserPrincipal();
      assertThat(user.getUserId()).isEqualTo(20);
      assertThat(user.getAccountKey()).isEqualTo("f6078ebe0c2f08c225c0349aef2fe062d71b972e3c91b9687cccdff24d0c8acd");
    }
View Full Code Here


      assertThat(user.toString(), is("WesabeUser [userId=409, accountKey=47dfae9288abf3d5d2252abfb0bd6ac9662637d646e6df9d5d274bc336e27abc]"));
    }
   
    @Test
    public void itHasTheSameHashCodeAsAnEqualWesabeUser() throws Exception {
      final WesabeUser other = WesabeUser.create("409", "47dfae9288abf3d5d2252abfb0bd6ac9662637d646e6df9d5d274bc336e27abc");
      assertThat(user.hashCode(), is(other.hashCode()));
    }
View Full Code Here

      assertThat(user.hashCode(), is(other.hashCode()));
    }
   
    @Test
    public void itHasADifferentHashCodeThanAWesabeUserWithADifferentUserId() throws Exception {
      final WesabeUser other = WesabeUser.create("408", "47dfae9288abf3d5d2252abfb0bd6ac9662637d646e6df9d5d274bc336e27abc");
      assertThat(user.hashCode(), is(not(other.hashCode())));
    }
View Full Code Here

      assertThat(user.hashCode(), is(not(other.hashCode())));
    }
   
    @Test
    public void itHasADifferentHashCodeThanAWesabeUserWithADifferentAccountKey() throws Exception {
      final WesabeUser other = WesabeUser.create("409", "47dfae9288abf3d5d2252abfb0bd6ac9662637d646e6df9d5d274bc336e27abd");
      assertThat(user.hashCode(), is(not(other.hashCode())));
    }
View Full Code Here

      assertThat(user.hashCode(), is(not(other.hashCode())));
    }
   
    @Test
    public void itIsEqualToEqualWesabeUser() throws Exception {
      final WesabeUser other = WesabeUser.create("409", "47dfae9288abf3d5d2252abfb0bd6ac9662637d646e6df9d5d274bc336e27abc");
      assertThat(user.equals(other), is(true));
    }
View Full Code Here

      assertThat(user.equals(other), is(true));
    }
   
    @Test
    public void itIsNotEqualToAWesabeUserWithADifferentUserId() throws Exception {
      final WesabeUser other = WesabeUser.create("408", "47dfae9288abf3d5d2252abfb0bd6ac9662637d646e6df9d5d274bc336e27abc");
      assertThat(user.equals(other), is(false));
    }
View Full Code Here

      assertThat(user.equals(other), is(false));
    }
   
    @Test
    public void itIsNotEqualToAWesabeUserWithADifferentAccountKey() throws Exception {
      final WesabeUser other = WesabeUser.create("409", "47dfae9288abf3d5d2252abfb0bd6ac9662637d646e6df9d5d274bc336e27abd");
      assertThat(user.equals(other), is(false));
    }
View Full Code Here

      assertThat(provider.getInjectedType(), is(sameInstance((Type) WesabeUser.class)));
    }
   
    @Test
    public void itInjectsTheUserPrincipalFromTheRequest() throws Exception {
      final WesabeUser user = mock(WesabeUser.class);
     
      final HttpRequestContext request = mock(HttpRequestContext.class);
      when(request.getUserPrincipal()).thenReturn(user);
     
      final HttpContext context = mock(HttpContext.class);
View Full Code Here

TOP

Related Classes of com.wesabe.api.util.auth.WesabeUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.