@Test
public void test_add() {
Instant now = Instant.now(_usrMaster.getClock());
ManageableOGUser user = new ManageableOGUser("AddedUser");
user.setPasswordHash("TESTHASH");
user.setName("Test Name");
user.setEmailAddress("test@test.com");
user.setExternalIdBundle(BUNDLE);
user.setEntitlements(Sets.newHashSet("A", "B"));
ZoneId zone = user.getTimeZone();
UserDocument doc = new UserDocument(user);
UserDocument test = _usrMaster.add(doc);
UniqueId uniqueId = test.getUniqueId();
assertNotNull(uniqueId);
assertEquals("DbUsr", uniqueId.getScheme());
assertTrue(uniqueId.isVersioned());
assertTrue(Long.parseLong(uniqueId.getValue()) >= 1000);
assertEquals("0", uniqueId.getVersion());
assertEquals(now, test.getVersionFromInstant());
assertEquals(null, test.getVersionToInstant());
assertEquals(now, test.getCorrectionFromInstant());
assertEquals(null, test.getCorrectionToInstant());
ManageableOGUser testUser = test.getUser();
assertNotNull(testUser);
assertEquals(uniqueId, testUser.getUniqueId());
assertEquals("TESTHASH", testUser.getPasswordHash());
assertEquals("Test Name", testUser.getName());
assertEquals(zone, testUser.getTimeZone());
assertEquals("test@test.com", testUser.getEmailAddress());
assertEquals(BUNDLE, testUser.getExternalIdBundle());
assertEquals(Sets.newHashSet("A", "B"), testUser.getEntitlements());
}