use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch in project open-smart-grid-platform by OSGP.
the class CdmaMastSegmentTest method newBatchNumberNull.
@Test
public void newBatchNumberNull() {
final CdmaMastSegment mastSegment = new CdmaMastSegment("200/1");
final CdmaBatchDevice cd1 = new CdmaBatchDevice("cd1", this.loopbackAddress);
mastSegment.addCdmaBatchDevice(null, cd1);
final CdmaBatch cdmaBatch = mastSegment.popCdmaBatch();
assertThat(cdmaBatch.getBatchNumber()).withFailMessage("Batch should get maximum batch number").isEqualTo(CdmaBatch.MAX_BATCH_NUMBER);
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch in project open-smart-grid-platform by OSGP.
the class CdmaBatchTest method largerWhenBatchNumberLarger.
@Test
public void largerWhenBatchNumberLarger() {
final CdmaBatch batch3 = new CdmaBatch((short) 3);
final CdmaBatch batch2 = new CdmaBatch((short) 2);
assertThat(batch3).withFailMessage("Batches with different batch numbers should not be equal").isNotEqualTo(batch2);
assertThat(batch3.compareTo(batch2) > 0).isTrue();
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch in project open-smart-grid-platform by OSGP.
the class CdmaMastSegmentTest method popCdmaBatch.
@Test
public void popCdmaBatch() {
final CdmaMastSegment mastSegment = new CdmaMastSegment("200/1");
final CdmaBatchDevice cd1 = new CdmaBatchDevice("cd1", this.loopbackAddress);
mastSegment.addCdmaBatchDevice((short) 1, cd1);
final CdmaBatchDevice cd2 = new CdmaBatchDevice("cd2", this.loopbackAddress);
mastSegment.addCdmaBatchDevice((short) 1, cd2);
final CdmaBatch batch = mastSegment.popCdmaBatch();
assertThat(batch.getCdmaBatchDevices().size()).isEqualTo(2);
// popCdmaBatch should remove the batch from the mast segment,
// there should be no more batch left in the mast segment.
assertThat(mastSegment.empty()).withFailMessage("MastSegment should not contain any devices").isTrue();
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch in project open-smart-grid-platform by OSGP.
the class CdmaBatchTest method equalsWhenBatchNumbersMatch.
@Test
public void equalsWhenBatchNumbersMatch() {
final CdmaBatch batch1 = new CdmaBatch((short) 7);
final CdmaBatch batch2 = new CdmaBatch((short) 7);
assertThat(batch1).withFailMessage("Batches with the same batch number should be equal").isEqualTo(batch2);
}
use of org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch in project open-smart-grid-platform by OSGP.
the class CdmaBatchTest method newCdmaBatch.
@Test
public void newCdmaBatch() {
final CdmaBatch batch = new CdmaBatch((short) 1);
final CdmaBatchDevice cd1 = new CdmaBatchDevice("cd1", this.loopbackAddress);
batch.addCdmaBatchDevice(cd1);
final CdmaBatchDevice cd2 = new CdmaBatchDevice("cd2", this.loopbackAddress);
batch.addCdmaBatchDevice(cd2);
assertThat(batch.getBatchNumber()).isEqualTo(Short.valueOf((short) 1));
assertThat(batch.getCdmaBatchDevices().size()).withFailMessage("Batch should contain 2 devices").isEqualTo(2);
}
Aggregations