@Test public void testCoastTimeout() { class CoastHelper implements BroadcastListener<TaggedTelemetryEvent> { boolean coastDetected = false; public void receiveMessage(TaggedTelemetryEvent event) { if (!(event instanceof CoastDetectedEvent)) { return; } coastDetected = true; } } FilteredBroadcastMessenger<TaggedTelemetryEvent> bus = new FilteredBroadcastMessenger<TaggedTelemetryEvent>(); CoastEventTrigger<PowerOnlyDecodable> decoder = new CoastEventTrigger<>(bus); CoastHelper listener = new CoastHelper(); bus.addListener(TaggedTelemetryEvent.class, listener); decoder.update(new PowerOnlyDecodable() { public long getSumPowerDelta(PowerOnlyDecodable old) { return 0; } public long getEventCountDelta(CounterBasedDecodable old) { return 0; } public int getSumPower() { return 0; } public int getEventCount() { return 0; } public boolean isValidDelta(CounterBasedDecodable old) { return true; } public int getInstantPower() { return 0; } public long getTimestamp() { return 0; } }); decoder.update(new PowerOnlyDecodable() { public long getSumPowerDelta(PowerOnlyDecodable old) { return 0; } public long getEventCountDelta(CounterBasedDecodable old) { return 0; } public int getSumPower() { return 0; } public int getEventCount() { return 0; } public boolean isValidDelta(CounterBasedDecodable old) { return true; } public int getInstantPower() { return 0; } public long getTimestamp() { return CoastDetector.COAST_WINDOW; } }); assertTrue(listener.coastDetected); }
@Override @SuppressWarnings("unchecked") public void update(T newPage) { helper.update(newPage); }
CoastEventTrigger implements Decoder<T> { @Override @SuppressWarnings("unchecked") public void update(T newPage) { helper.update(newPage); } }
CoastEventTrigger implements Decoder<T> { @Override @SuppressWarnings("unchecked") public void update(T newPage) { helper.update(newPage); } CoastEventTrigger(FilteredBroadcastMessenger<TaggedTelemetryEvent> updateHub); }
CoastEventTrigger implements Decoder<T> { @Override @SuppressWarnings("unchecked") public void update(T newPage) { helper.update(newPage); } CoastEventTrigger(FilteredBroadcastMessenger<TaggedTelemetryEvent> updateHub); @Override @SuppressWarnings("unchecked") void update(T newPage); @Override void invalidate(); @Override void reset(); }
CoastEventTrigger implements Decoder<T> { @Override @SuppressWarnings("unchecked") public void update(T newPage) { helper.update(newPage); } CoastEventTrigger(FilteredBroadcastMessenger<TaggedTelemetryEvent> updateHub); @Override @SuppressWarnings("unchecked") void update(T newPage); @Override void invalidate(); @Override void reset();  }