final String zipcode = "450-0002";
final String address = "架空の住所";
User user = service.put(uid, name, mail, phone, zipcode, address);
assertThat(user, is(notNullValue()));
assertThat(user, instanceOf(Manager.class));
Manager manager = (Manager)user;
assertThat(manager.getName(), is(name));
assertThat(manager.getMail().getEmail(), is(mail));
assertThat(manager.getPhone().getNumber(), is(phone));
assertThat(manager.getZipcode(), is(zipcode));
assertThat(manager.getAddress().getAddress(), is(address));
assertNotNull(user.getInitialKey());
assertThat(user.getInitialKey(), not(""));
Manager stored = Datastore.get(Manager.class, user.getUid());
assertThat(stored, instanceOf(Manager.class));
manager = (Manager)stored;
assertThat(manager.getName(), is(name));
assertThat(manager.getMail().getEmail(), is(mail));
assertThat(manager.getPhone().getNumber(), is(phone));
assertThat(manager.getZipcode(), is(zipcode));
assertThat(manager.getAddress().getAddress(), is(address));
assertThat(stored.getRegisteredDate(), is(stored.getUpdatedDate()));
// パスワードを保存する
service.savePassword(uid, "password");
final String name2 = "Test User2";
final String mail2 = "testuser2@mail.com";
final String phone2 = "052-551-1862";
final String zipcode2 = "450-0003";
final String address2 = "架空の住所2";
user = service.put(uid, name2, mail2, phone2, zipcode2, address2);
assertThat(user, is(notNullValue()));
assertThat(user, instanceOf(Manager.class));
assertThat(user.getName(), is(name2));
assertThat(user.getMail().getEmail(), is(mail2));
assertThat(user.getInitialKey(), is(""));
stored = Datastore.get(Manager.class, user.getUid());
assertThat(stored, instanceOf(Manager.class));
manager = (Manager)stored;
assertThat(manager.getName(), is(name2));
assertThat(manager.getMail().getEmail(), is(mail2));
assertThat(manager.getPhone().getNumber(), is(phone2));
assertThat(manager.getZipcode(), is(zipcode2));
assertThat(manager.getAddress().getAddress(), is(address2));
assertTrue(stored.getRegisteredDate().before(stored.getUpdatedDate()));
}