@Test public void testStop() throws DataSinkException { VehicleMessage measurement = new SimpleVehicleMessage("first", true); sink.receive(measurement); measurement = new SimpleVehicleMessage("second", false); sink.receive(measurement); sink.stop(); measurement = new SimpleVehicleMessage("third", true); try { sink.receive(measurement); fail("Expected a DataSinkException"); } catch(DataSinkException e) { } String[] records = outputString.toString().split("\n"); assertEquals(2, records.length); assertTrue(records[0].indexOf("first") != -1); assertTrue(records[1].indexOf("second") != -1); }
@Override public synchronized void stop() { close(); Log.i(TAG, "Shutting down"); }
FileRecorderSink implements VehicleDataSink { @Override public synchronized void stop() { close(); Log.i(TAG, "Shutting down"); } }
FileRecorderSink implements VehicleDataSink { @Override public synchronized void stop() { close(); Log.i(TAG, "Shutting down"); } FileRecorderSink(FileOpener fileOpener); }
FileRecorderSink implements VehicleDataSink { @Override public synchronized void stop() { close(); Log.i(TAG, "Shutting down"); } FileRecorderSink(FileOpener fileOpener); @Override synchronized void receive(VehicleMessage message); @Override synchronized void stop(); synchronized void flush(); }
FileRecorderSink implements VehicleDataSink { @Override public synchronized void stop() { close(); Log.i(TAG, "Shutting down"); } FileRecorderSink(FileOpener fileOpener); @Override synchronized void receive(VehicleMessage message); @Override synchronized void stop(); synchronized void flush();  }