@Test
  public void testRegister() throws Exception {
    final UserId id = UserId.newId(new Email("*****@*****.**"), "passwordtest");
    final UserCredentials cred = UserCredentials.blockedAccess();
    final User newUser = User.createUser(id, cred);

    final User registredUser = service.register(newUser);

    Assert.assertThat(registredUser.getCredentials().getTokenValue(), equalTo("1234"));
  }
  @Test
  public void testWithAValidUserId() throws Exception {
    final UserId id = UserId.newId(new Email("*****@*****.**"), "passwordtest");
    final UserCredentials cred =
        UserCredentials.newCredentials(UserToken.newToken("1234"), AcessLevel.DEFAULT);
    final User expectedUser = User.createUser(id, cred);

    when(userRepository.findById(new Identity<UserId>(id))).thenReturn(expectedUser);

    Assert.assertThat(expectedUser, equalTo(service.authenticate(id)));
  }