Skip to content

Commit

Permalink
Update tests with new fields
Browse files Browse the repository at this point in the history
These fields were added in #621.
  • Loading branch information
cupakromer committed Dec 15, 2017
1 parent d956b84 commit deaa42d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
12 changes: 10 additions & 2 deletions src/test/java/org/altbeacon/beacon/AltBeaconTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public void testCanSerializeParcelable() {
.setServiceUuid(13)
.setTxPower(14)
.build();
original.setPacketCount(15);
original.setRssiMeasurementCount(16);

aParcel = Parcel.obtain();
original.writeToParcel(aParcel, 0);
Expand All @@ -101,7 +103,9 @@ public void testCanSerializeParcelable() {
hasProperty("runningAverageRssi", equalTo(-12.3)),
hasProperty("serviceUuid", equalTo(13)),
hasProperty("txPower", equalTo(14)),
hasProperty("mfgReserved", equalTo(2))
hasProperty("mfgReserved", equalTo(2)),
hasProperty("packetCount", equalTo(15)),
hasProperty("measurementCount", equalTo(16))
)
);
}
Expand All @@ -125,6 +129,8 @@ public void copyingBeaconTransfersAllFields() {
.setServiceUuid(13)
.setTxPower(14)
.build();
original.setPacketCount(15);
original.setRssiMeasurementCount(16);
final AltBeacon copied = new AltBeacon(original);
assertThat(
copied,
Expand All @@ -143,7 +149,9 @@ public void copyingBeaconTransfersAllFields() {
hasProperty("rssi", equalTo(-11)),
hasProperty("runningAverageRssi", equalTo(-12.3)),
hasProperty("serviceUuid", equalTo(13)),
hasProperty("txPower", equalTo(14))
hasProperty("txPower", equalTo(14)),
hasProperty("packetCount", equalTo(15)),
hasProperty("measurementCount", equalTo(16))
)
);
}
Expand Down
12 changes: 10 additions & 2 deletions src/test/java/org/altbeacon/beacon/BeaconTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ public void parcelingBeaconContainsAllFields() {
.setServiceUuid(13)
.setTxPower(14)
.build();
original.setPacketCount(15);
original.setRssiMeasurementCount(16);

aParcel = Parcel.obtain();
original.writeToParcel(aParcel, 0);
Expand All @@ -264,7 +266,9 @@ public void parcelingBeaconContainsAllFields() {
hasProperty("rssi", equalTo(-11)),
hasProperty("runningAverageRssi", equalTo(-12.3)),
hasProperty("serviceUuid", equalTo(13)),
hasProperty("txPower", equalTo(14))
hasProperty("txPower", equalTo(14)),
hasProperty("packetCount", equalTo(15)),
hasProperty("measurementCount", equalTo(16))
)
);
}
Expand All @@ -287,6 +291,8 @@ public void copyingBeaconContainsAllFields() {
.setServiceUuid(13)
.setTxPower(14)
.build();
original.setPacketCount(15);
original.setRssiMeasurementCount(16);

final Beacon copied = new Beacon(original);
assertThat(
Expand All @@ -306,7 +312,9 @@ public void copyingBeaconContainsAllFields() {
hasProperty("rssi", equalTo(-11)),
hasProperty("runningAverageRssi", equalTo(-12.3)),
hasProperty("serviceUuid", equalTo(13)),
hasProperty("txPower", equalTo(14))
hasProperty("txPower", equalTo(14)),
hasProperty("packetCount", equalTo(15)),
hasProperty("measurementCount", equalTo(16))
)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public void testSerialization() throws Exception {
.setTxPower(-50)
.setBluetoothAddress("01:02:03:04:05:06")
.build();
beacon.setRssiMeasurementCount(1);
beacon.setPacketCount(2);
for (int i=0; i < 10; i++) {
beacons.add(beacon);
}
Expand All @@ -60,6 +62,8 @@ public void testSerialization() throws Exception {
assertEquals("RSSI is restored", -1, restoredBeacon.getRssi());
assertEquals("Average RSSI is restored", -2.0, restoredBeacon.getRunningAverageRssi(), 0.0);
assertEquals("TXPower is restored", -50, restoredBeacon.getTxPower());
assertEquals("Measurement count is restored", 1, restoredBeacon.getMeasurementCount());
assertEquals("Packet count is restored", 2, restoredBeacon.getPacketCount());
}

@Test
Expand Down

0 comments on commit deaa42d

Please sign in to comment.