package tddmicroexercises.leaderboard;

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

import java.util.Map;

public class LeaderboardTest
{

    @Test
    public void itShouldSumThePoints()
    {
        Map<String, Integer> results = TestData.sampleLeaderboard1.driverResults();
        Assert.assertTrue("results " + results, results.containsKey("Lewis Hamilton"));
        Assert.assertEquals(18+18+25, (int)results.get("Lewis Hamilton"));
    }

    @Test
    public void isShouldFindTheWinner()
    {
        Assert.assertEquals("Lewis Hamilton", TestData.sampleLeaderboard1.driverRankings().get(0));
    }
}

@@ -32,32 +32,39 @@
 rboard;%0A%0Aimport 
+static 
 org.junit.Assert
@@ -63,16 +63,29 @@
 t.Assert
+.assertEquals
 ;%0Aimport
@@ -85,16 +85,23 @@
 %0Aimport 
+static 
 org.juni
@@ -106,35 +106,306 @@
 nit.
-Test;%0A%0Aimport java.util.Map
+Assert.assertTrue;%0Aimport static tddmicroexercises.leaderboard.TestData.driver1;%0Aimport static tddmicroexercises.leaderboard.TestData.driver2;%0Aimport static tddmicroexercises.leaderboard.TestData.driver3;%0A%0Aimport java.util.Arrays;%0Aimport java.util.List;%0Aimport java.util.Map;%0A%0Aimport org.junit.Test
 ;%0A%0Ap
@@ -578,31 +578,24 @@
 ();%0A        
-Assert.
 assertTrue(%22
@@ -655,39 +655,32 @@
 ton%22));%0A        
-Assert.
 assertEquals(18+
@@ -682,12 +682,16 @@
 s(18
-+18+
+ + 18 + 
 25, 
@@ -695,16 +695,17 @@
 5, (int)
+ 
 results.
@@ -799,23 +799,16 @@
         
-Assert.
 assertEq
@@ -890,10 +890,641 @@
 ;%0A    %7D%0A
+%0A    @Test%0A    public void itShouldKeepAllDriversWhenSamePoints()%0A    %7B%0A        // bug, drops drivers with same points%0A        Race winDriver1 = new Race(%22Australian Grand Prix%22, driver1, driver2, driver3);%0A        Race winDriver2 = new Race(%22Malaysian Grand Prix%22, driver2, driver1, driver3);%0A        Leaderboard exEquoLeaderBoard = new Leaderboard(winDriver1, winDriver2);%0A%0A        List%3CString%3E rankings = exEquoLeaderBoard.driverRankings();%0A        assertEquals(Arrays.asList(driver1.getName(), driver2.getName(), driver3.getName()), rankings);%0A        // note: the order of driver1 and driver2 is JDK/platform dependent%0A    %7D%0A%0A
 %7D%0A

add test for bug in Java version, it drops drivers of same points