Search in sources :

Example 1 with CdmaBatch

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);
}
Also used : CdmaMastSegment(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaMastSegment) CdmaBatchDevice(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice) CdmaBatch(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch) Test(org.junit.jupiter.api.Test)

Example 2 with CdmaBatch

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();
}
Also used : CdmaBatch(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch) Test(org.junit.jupiter.api.Test)

Example 3 with CdmaBatch

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();
}
Also used : CdmaMastSegment(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaMastSegment) CdmaBatchDevice(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice) CdmaBatch(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch) Test(org.junit.jupiter.api.Test)

Example 4 with CdmaBatch

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);
}
Also used : CdmaBatch(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch) Test(org.junit.jupiter.api.Test)

Example 5 with CdmaBatch

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);
}
Also used : CdmaBatchDevice(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice) CdmaBatch(org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)5 CdmaBatch (org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatch)5 CdmaBatchDevice (org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaBatchDevice)3 CdmaMastSegment (org.opensmartgridplatform.adapter.domain.publiclighting.application.valueobjects.CdmaMastSegment)2