package com.mistraltech.bog.core.picker;


import org.junit.Test;

import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;

import static com.mistraltech.bog.core.picker.EnumValuePicker.enumPicker;

public class EnumValuePickerTest {

    @Test(expected = NullPointerException.class)
    public void cannotConstructWithNullEnumClass() {
        enumPicker(null);
    }

    @Test(expected = IllegalArgumentException.class)
    public void cannotConstructWithEmptyEnum() {
        enumPicker(X.class);
    }

    @Test(timeout = 1000L)
    public void picksAllValuesFromEnumEventually() {
        EnumValuePicker<Y> picker = enumPicker(Y.class);
        Set<Y> remaining = new TreeSet<>(Arrays.asList(Y.values()));

        while (remaining.size() > 0) {
            remaining.remove(picker.pick());
        }
    }
}

enum X {
}

enum Y {
    A, B, C;
}
@@ -829,23 +829,49 @@
   %7D%0A
-%7D%0A%0Aenum X %7B%0A%7D%0A%0A
+%0A    private enum X %7B%0A    %7D%0A%0A    private 
 enum
@@ -879,16 +879,20 @@
 Y %7B%0A    
+ 
+   
 A, B, C;
@@ -892,9 +892,16 @@
 , B, C;%0A
-%7D
+    %7D%0A%7D%0A

Move enums to be privately nested within EnumValuePickerTest.