Пример #1
0
  @Test
  public void convert_Valid() {
    Authority authority = new AuthorityImpl();
    authority.setAuthority("asd;lkfjlkj");
    authority.setDefaultForNewUser(true);

    MongoDbAuthority converted = authorityConverter.convert(authority);
    assertNotNull(converted.getAuthority());
    // assertNotNull(converted.getId());
    assertThat(converted.getAuthority(), is(sameInstance(authority.getAuthority())));
    assertThat(converted.isDefaultForNewUser(), is(sameInstance(authority.isDefaultForNewUser())));

    Authority authorityMongo = new MongoDbAuthority();
    authorityMongo.setAuthority("authority");
    authorityMongo.setDefaultForNewUser(true);
    MongoDbAuthority mongoConverted = authorityConverter.convert(authorityMongo);
    assertThat(mongoConverted, is(sameInstance(authorityMongo)));
    assertThat(mongoConverted.getAuthority(), is(sameInstance(authorityMongo.getAuthority())));
    assertThat(
        mongoConverted.isDefaultForNewUser(),
        is(sameInstance(authorityMongo.isDefaultForNewUser())));
  }
Пример #2
0
 @Test
 public void getSourceType_Valid() {
   assertNotNull(authorityConverter.getSourceType());
 }
Пример #3
0
 @Test
 public void hydrate_Valid() {
   MongoDbAuthority authority = new MongoDbAuthority();
   authorityConverter.hydrate(authority);
   assertNotNull(authority);
 }