package junitparams;

import static junitparams.JUnitParamsRunner.*;
import static org.junit.Assert.*;

import org.junit.*;
import org.junit.runner.*;

@RunWith(JUnitParamsRunner.class)
public class JustParamsTest {

    @Test
    @Parameters({ "1", "2" })
    public void singleParam(int number) throws Exception {
        assertTrue(number > 0);
    }

    @Test
    @Parameters
    public void oneParamDifferentTypes(int number, String a) throws Exception {
        assertTrue(number > 0);
    }

    private Object[] parametersForOneParamDifferentTypes() {
        return $($(1, "a"));
    }

    @Test
    @Parameters(source = SingleParamSetProvider.class)
    public void oneParamSetFromClass(String a, String b) throws Exception {
    }

    static class SingleParamSetProvider {
        public static Object[] provideOneParamSetSameTypes() {
            return $($("a", "b"));
        }
    }

    @Test
    @Parameters
    public void oneParamSetOneNull(String a, String b) throws Exception {
    }

    private Object[] parametersForOneParamSetOneNull() {
        return $($(null, "b"));
    }

    @Test
    @Parameters
    public void noToString(NoToStringObject o) throws Exception {
    }

    private Object[] parametersForNoToString() {
        return $($(new NoToStringObject()));
    }

    public class NoToStringObject {
    }

    @Test
    @Parameters({ "a \n b", "a(asdf)" })
    public void specialCharsInParam(String a) throws Exception {
    }

    @Test
    @Parameters({ "1, false", "2, true" })
    public void multipleParams(int number, boolean what) throws Exception {
        assertEquals(what, number > 1);
    }

    @Test
    @Parameters(source = OneIntegerProvider.class)
    public void providedPrimitiveParams(int integer) {
        assertTrue(integer < 4);
    }

    public static class OneIntegerProvider {
        public static Object[] provideTwoNumbers() {
            return $($(1), $(2));
        }

        public static Object[] provideOneNumber() {
            return new Object[] { $(3) };
        }
    }

    @Test
    @Parameters(source = DomainObjectProvider.class)
    public void providedDomainParams(DomainClass object1, DomainClass object2) {
        assertEquals("dupa1", object1.toString());
        assertEquals("dupa2", object2.toString());
    }

    public static class DomainObjectProvider {
        public static Object[] provideDomainObject() {
            return new Object[] { new Object[] {
                    new DomainClass("dupa1"),
                    new DomainClass("dupa2") } };
        }
    }

    public static class DomainClass {
        private final String name;

        public DomainClass(String name) {
            this.name = name;
        }

        @Override
        public String toString() {
            return name;
        }
    }

}

@@ -289,36 +289,19 @@
  number)
- throws Exception
  %7B%0A
+
         
@@ -417,33 +417,16 @@
 tring a)
- throws Exception
  %7B%0A     
@@ -677,33 +677,16 @@
 tring b)
- throws Exception
  %7B%0A    %7D
@@ -924,33 +924,16 @@
 tring b)
- throws Exception
  %7B%0A    %7D
@@ -1048,32 +1048,32 @@
     @Parameters%0A
+
     public void 
@@ -1102,33 +1102,16 @@
 bject o)
- throws Exception
  %7B%0A    %7D
@@ -2734,10 +2734,168 @@
 %0A    %7D%0A%0A
+    @Test%0A    @Parameters%0A    public void emptyParamset() %7B%0A    %7D%0A%0A    private Object%5B%5D parametersForEmptyParamset() %7B%0A        return new Object%5B%5D %7B%7D;%0A    %7D%0A%0A
 %7D%0A

Enable parameterised methods with no params.