package com.openxc.remote;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import org.junit.Test;

public class RawMeasurementTest {
    RawMeasurement measurement;

    @Test
    public void testValue() {
        measurement = new RawMeasurement(new Double(42.0));
    }

    @Test
    public void testValidity() {
        measurement = new RawMeasurement(new Double(42));
        assertTrue(measurement.isValid());

        measurement = new RawMeasurement();
        assertFalse(measurement.isValid());
   }

   @Test
   public void testHasAge() {
        measurement = new RawMeasurement(new Double(42));
        assertTrue(measurement.getTimestamp() > 0);
   }
}

@@ -108,16 +108,61 @@
 tFalse;%0A
+import static org.junit.Assert.assertEquals;%0A
 import o
@@ -587,19 +587,21 @@
 ());%0A   
+ 
 %7D%0A%0A
+ 
    @Test
@@ -601,16 +601,17 @@
   @Test%0A
+ 
    publi
@@ -742,15 +742,399 @@
 ) %3E 0);%0A
+    %7D%0A%0A    @Test%0A    public void testStopsAging() %7B%0A        measurement = new RawMeasurement(new Double(42));%0A        double timestamp = measurement.getTimestamp();%0A        pause(10);%0A        assertEquals(timestamp, measurement.getTimestamp(), 0);%0A    %7D%0A%0A    private void pause(int millis) %7B%0A        try %7B%0A            Thread.sleep(millis);%0A        %7D catch(InterruptedException e) %7B%7D%0A 
    %7D%0A%7D%0A

Test that RawMeasurement timestamps never change.