package me.grdryn.lisztomania;

import static net.java.quickcheck.generator.CombinedGeneratorsIterables.someLists;
import static net.java.quickcheck.generator.PrimitiveGenerators.integers;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

import java.util.Arrays;
import java.util.List;

import org.junit.Test;

public class BalancedSubListTest {

    @Test
    public void testHundredPercent() {
        final int percent = 100;
        final List<Integer> originalList = Arrays.asList(0, 1, 2, 3, 4, 5, 6,
                7, 8, 9);

        final BalancedSubList<Integer> listUnderTest = new BalancedSubList<>(
                originalList, percent);

        System.out.println("Sublist: " + listUnderTest);
        assertEquals(originalList, listUnderTest);
    }

    @Test
    public void testFiftyPercentListSizeGreaterThanTwo() {
        final int percent = 50;

        for (final List<Integer> originalList : someLists(integers(), 2)) {

            final BalancedSubList<Integer> listUnderTest = new BalancedSubList<>(
                    originalList, percent);

            assertFalse("50% sublist should not equal original",
                    originalList.equals(listUnderTest));

            assertEquals(String.format(
                    "Failed with original %s and sublist %s", originalList,
                    listUnderTest),
                    Math.round(originalList.size() / 2.0), listUnderTest.size());
        }
    }

    @Test
    public void testZeroPercentGivesOne() {
        final List<Integer> originalList = Arrays.asList(0, 1, 2, 3, 4, 5, 6,
                7, 8, 9);

        final BalancedSubList<Integer> listUnderTest = new BalancedSubList<>(
                originalList, 0);
        System.out.println("Sublist: " + listUnderTest);
        assertEquals(1, listUnderTest.size());
    }

}

@@ -321,16 +321,55 @@
 .List;%0A%0A
+import net.java.quickcheck.Generator;%0A%0A
 import o
@@ -1513,32 +1513,615 @@
        %7D%0A    %7D%0A%0A
+    @Test%0A    public void testListSizeOne() %7B%0A        final Generator%3CInteger%3E integerGenerator = integers(1, 100);%0A        for (final List%3CInteger%3E originalList : someLists(integers(), 1, 1)) %7B%0A            final int percentage = integerGenerator.next();%0A%0A            System.out.print(percentage + %22 : %22 + originalList);%0A%0A            final BalancedSubList%3CInteger%3E listUnderTest = new BalancedSubList%3C%3E(%0A                    originalList, percentage);%0A%0A            assertEquals(%22Sublist should be 1 when list size is 1%22, 1,%0A                    listUnderTest.size());%0A        %7D%0A    %7D%0A%0A
     @Test%0A    pu

Prove sublist 1 when list 1