/** * Creates a new object initialized with the given values. * * @return new object initialized with the given values */ public static SetKey ofUnset() { return new SetKey(null); } }
@Test public void setKey() throws Exception { ZoneFixtures.withUpdateableZone(client(), zone -> { final String newKey = randomKey(); assertThat(zone.getKey()).isNotEqualTo(newKey); final ZoneUpdateCommand command = ZoneUpdateCommand.of(zone, SetKey.of(newKey)); final Zone updatedZone = client().executeBlocking(command); assertThat(updatedZone.getKey()).isEqualTo(newKey); return updatedZone; }, CountryCode.AM); }
@Test public void updateByKey() throws Exception { ZoneFixtures.withUpdateableZone(client(), zone -> { final String newKey = randomKey(); assertThat(zone.getKey()).isNotEqualTo(newKey); final ZoneUpdateCommand command = ZoneUpdateCommand.of(zone, SetKey.of(newKey)); final Zone updatedZone = client().executeBlocking(command); assertThat(updatedZone.getKey()).isEqualTo(newKey); final String newKey2 = randomKey(); final ZoneUpdateCommand commandByKey = ZoneUpdateCommand.ofKey(updatedZone.getKey(),updatedZone.getVersion(), SetKey.of(newKey2)); final Zone updatedZone2 = client().executeBlocking(commandByKey); assertThat(updatedZone2.getKey()).isEqualTo(newKey2); return updatedZone2; }, CountryCode.AM); }
/** * Creates a new object initialized with the given values. * * @param key initial value for the {@link Zone#getKey()} property * @return new object initialized with the given values */ public static SetKey of(@Nullable final String key) { return new SetKey(key); }