package nl.yacht.lakesideresort.domain;

import org.junit.Assert;
import org.junit.Test;

import java.time.Duration;

public class TripTest {

    private Trip trip;

    @Test
    public void testGetDuration() {

        this.trip = new Trip(3);

        try {
            Thread.sleep(2000);

            this.trip.end();

            Duration duration = this.trip.getDuration();

            long aantalSeconden = duration.getSeconds();

            aantalSeconden -=2;

            aantalSeconden = Math.abs(aantalSeconden);

            Assert.assertTrue(aantalSeconden < 1);

        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}

@@ -59,16 +59,41 @@
 Assert;%0A
+import org.junit.Before;%0A
 import o
@@ -107,16 +107,16 @@
 t.Test;%0A
-
 %0Aimport 
@@ -185,16 +185,95 @@
  trip;%0A%0A
+%0A    @Before%0A    public void setUp() %7B%0A        this.trip = new Trip(3);%0A    %7D%0A%0A
     @Tes
@@ -315,41 +315,8 @@
  %7B%0A%0A
-        this.trip = new Trip(3);%0A
 %0A   

Add @Before method