@Test(dataProvider = "getSetInvalidStateParams") public void testSetInvalidState(AvailabilityZoneState originalState, AvailabilityZoneState newState) throws Exception { AvailabilityZoneEntity availabilityZone = new AvailabilityZoneEntity(); availabilityZone.setState(originalState); try { availabilityZone.setState(newState); fail("setState should throw exception"); } catch (IllegalStateException ex) { assertThat(ex.getMessage(), is(String.format("%s -> %s", originalState, newState))); } }
public void setState(AvailabilityZoneState state) { if (this.getState() != null && state != null) { EntityStateValidator.validateStateChange(this.getState(), state, AvailabilityZoneState.PRECONDITION_STATES); } this.state = state; }
AvailabilityZoneEntity extends BaseEntity implements Named { public void setState(AvailabilityZoneState state) { if (this.getState() != null && state != null) { EntityStateValidator.validateStateChange(this.getState(), state, AvailabilityZoneState.PRECONDITION_STATES); } this.state = state; } }
AvailabilityZoneEntity extends BaseEntity implements Named { public void setState(AvailabilityZoneState state) { if (this.getState() != null && state != null) { EntityStateValidator.validateStateChange(this.getState(), state, AvailabilityZoneState.PRECONDITION_STATES); } this.state = state; } AvailabilityZoneEntity();  AvailabilityZoneEntity(String name); }
AvailabilityZoneEntity extends BaseEntity implements Named { public void setState(AvailabilityZoneState state) { if (this.getState() != null && state != null) { EntityStateValidator.validateStateChange(this.getState(), state, AvailabilityZoneState.PRECONDITION_STATES); } this.state = state; } AvailabilityZoneEntity();  AvailabilityZoneEntity(String name); @Override String getKind(); String getName(); void setName(String name); AvailabilityZoneState getState(); void setState(AvailabilityZoneState state); AvailabilityZone toApiRepresentation(); }
AvailabilityZoneEntity extends BaseEntity implements Named { public void setState(AvailabilityZoneState state) { if (this.getState() != null && state != null) { EntityStateValidator.validateStateChange(this.getState(), state, AvailabilityZoneState.PRECONDITION_STATES); } this.state = state; } AvailabilityZoneEntity();  AvailabilityZoneEntity(String name); @Override String getKind(); String getName(); void setName(String name); AvailabilityZoneState getState(); void setState(AvailabilityZoneState state); AvailabilityZone toApiRepresentation();  }