Ejemplo n.º 1
0
 /**
  * @param beacon the beacon whose fields we should copy to this beacon builder
  * @return
  */
 public Builder copyBeaconFields(Beacon beacon) {
   setIdentifiers(beacon.getIdentifiers());
   setBeaconTypeCode(beacon.getBeaconTypeCode());
   setDataFields(beacon.getDataFields());
   setBluetoothAddress(beacon.getBluetoothAddress());
   setBluetoothName(beacon.getBluetoothName());
   setExtraDataFields(beacon.getExtraDataFields());
   setManufacturer(beacon.getManufacturer());
   setTxPower(beacon.getTxPower());
   setRssi(beacon.getRssi());
   setServiceUuid(beacon.getServiceUuid());
   return this;
 }
 @Test
 public void gattBeaconExtraDataAreNotOverwritten() {
   Beacon beacon = getGattBeacon();
   Beacon extraDataBeacon = getGattBeaconExtraData();
   GattBeaconTracker tracker = new GattBeaconTracker();
   tracker.track(beacon);
   tracker.track(extraDataBeacon);
   Beacon trackedBeacon = tracker.track(beacon);
   assertEquals(
       "extra data should not be overwritten",
       extraDataBeacon.getDataFields(),
       trackedBeacon.getExtraDataFields());
 }
 @Test
 public void gattBeaconExtraDataGetUpdated() {
   Beacon beacon = getGattBeacon();
   Beacon extraDataBeacon = getGattBeaconExtraData();
   Beacon extraDataBeacon2 = getGattBeaconExtraData2();
   GattBeaconTracker tracker = new GattBeaconTracker();
   tracker.track(beacon);
   tracker.track(extraDataBeacon);
   tracker.track(extraDataBeacon2);
   Beacon trackedBeacon = tracker.track(beacon);
   assertEquals(
       "extra data is updated",
       extraDataBeacon2.getDataFields(),
       trackedBeacon.getExtraDataFields());
 }