package peter.mathclock;

import com.google.common.collect.Sets;

import org.junit.Test;

import java.util.Collections;

import static org.junit.Assert.assertEquals;

public class ClosestSelectorTest {

    @Test
    public void fallbackToZeroForEmptySet() throws Exception {
        assertEquals(0, ClosestSelector.getClosest(Collections.<Integer>emptySet(), 1));
    }

    @Test
    public void selectsTheExisting() throws Exception {
        assertEquals(1, ClosestSelector.getClosest(Collections.singleton(1), 1));
    }

    @Test
    public void selectsTheExistingFromMore() throws Exception {
        assertEquals(2, ClosestSelector.getClosest(Sets.newHashSet(1,2,3), 2));
    }

    @Test
    public void selectsTheNextIfMissing() throws Exception {
        assertEquals(3, ClosestSelector.getClosest(Sets.newHashSet(1,3), 2));
        assertEquals(1, ClosestSelector.getClosest(Sets.newHashSet(1,3), 6));
    }
}
@@ -249,36 +249,19 @@
 ptySet()
- throws Exception
  %7B%0A
+
         
@@ -394,33 +394,16 @@
 isting()
- throws Exception
  %7B%0A     
@@ -540,33 +540,16 @@
 omMore()
- throws Exception
  %7B%0A     
@@ -632,32 +632,32 @@
    %7D%0A%0A    @Test%0A
+
     public void 
@@ -685,25 +685,8 @@
 ng()
- throws Exception
  %7B%0A 

remove unneeded exceptions