use of com.paulhammant.buildradiator.radiator.model.RadiatorDoesntExist in project BuildRadiator by BuildRadiator.
the class RadiatorStore method get.
Radiator get(final String radCode, String ipAddress) {
Radiator radiator = this.actualRadiators.get(radCode);
if (radiator == null) {
radiator = getFromDataService(radCode);
if (radiator != null) {
actualRadiators.put(radCode, radiator);
radiatorLastSavedTimes.put(radCode, radiator.lastUpdated);
}
}
if (radiator != null) {
radiator.verifyIP(ipAddress);
} else {
throw new RadiatorDoesntExist();
}
return radiator;
}
use of com.paulhammant.buildradiator.radiator.model.RadiatorDoesntExist in project BuildRadiator by BuildRadiator.
the class RadiatorStoreUnitTest method radiatorCanBeRetrieved.
@Test
public void radiatorCanBeRetrieved() {
RadiatorStore rs = new RadiatorStore();
Radiator rad = null;
try {
rad = rs.get("AAA", "127.0.0.1");
fail();
} catch (RadiatorDoesntExist e) {
// expected
}
rs.createRadiator(new TestRandomGenerator("AAA", "sseeccrreett"), "A");
rad = rs.get("AAA", "127.0.0.1");
assertThat(rad.code, equalTo("AAA"));
}
Aggregations