This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
2019_2020:s2:td:td8 [2020/03/04 17:16] blay [Questions] |
2019_2020:s2:td:td8 [2020/03/04 17:20] blay [Pour vous aider] |
||
---|---|---|---|
Line 204: | Line 204: | ||
<code java> | <code java> | ||
- | @Test | + | void testClosestPoint() throws InterruptedException { |
- | void testClosestPoint() throws InterruptedException { | + | |
Date currentDate1 = new Date(); | Date currentDate1 = new Date(); | ||
- | DatedPoint currentPoint1 = new DatedPoint(5,5,currentDate1) ; | + | DatedPoint currentPoint1 = new DatedPoint(5,5,currentDate1,"domicile") ; |
Thread.sleep(1000); | Thread.sleep(1000); | ||
Date currentDate2 = new Date(); | Date currentDate2 = new Date(); | ||
- | DatedPoint currentPoint2 = new DatedPoint(7,7,currentDate2) ; | + | DatedPoint currentPoint2 = new DatedPoint(7,7,currentDate2,"p1") ; |
Thread.sleep(1000); | Thread.sleep(1000); | ||
- | DatedPoint currentPoint3 = new DatedPoint(10,10,new Date()) ; | + | DatedPoint currentPoint3 = new DatedPoint(10,10,new Date(),"p2") ; |
Thread.sleep(1000); | Thread.sleep(1000); | ||
- | Date currentDate3 = new Date(); | ||
Journey path = new Journey(currentPoint1); | Journey path = new Journey(currentPoint1); | ||
path.addPoint(currentPoint2); | path.addPoint(currentPoint2); | ||
path.addPoint(currentPoint3); | path.addPoint(currentPoint3); | ||
+ | System.out.println(path); | ||
assertEquals(currentPoint1.getDate(), path.whenWasYouHere(currentPoint1)); | assertEquals(currentPoint1.getDate(), path.whenWasYouHere(currentPoint1)); | ||
assertEquals(currentPoint2.getDate(), path.whenWasYouHere(currentPoint2)); | assertEquals(currentPoint2.getDate(), path.whenWasYouHere(currentPoint2)); | ||
assertEquals(currentPoint3.getDate(), path.whenWasYouHere(currentPoint3)); | assertEquals(currentPoint3.getDate(), path.whenWasYouHere(currentPoint3)); | ||
- | assertEquals(currentPoint3.getDate(), path.whenWasYouHere(new DatedPoint(12,12,new Date()))); | + | assertEquals(currentPoint3.getDate(), path.whenWasYouHere(new Point(12,12))); |
- | assertEquals(currentPoint1.getDate(), path.whenWasYouHere(new DatedPoint(4,4,new Date()))); | + | assertEquals(currentPoint1.getDate(), path.whenWasYouHere(new Point(4,4))); |
- | assertEquals(currentPoint2.getDate(), path.whenWasYouHere(new DatedPoint(8,8,new Date()))); | + | assertEquals(currentPoint2.getDate(), path.whenWasYouHere(new Point(8,8))); |
} | } |