@Test
public void testDecode() {

    // oczekiwany wynik dekodowania stringa
    Date date = d("27-04-2012");
    // przypadki testowe
    Object[][] testCases = {
        {"27-04-2012", date},
        {"27.04.2012", date},
        {"27/04/2012", date},
        {"2012-04-27", date},
        {"2012.04.27", date},
        {"2012/04/27", date},
        {" 2012/04/27 ", date},
        {"  ", null},
        {null, null}
    };
    // wykonanie testow
    for (Object[] testCase : testCases) {
        String text = (String) testCase[0];
        Date expectedDate = (Date) testCase[1];
        DateHolder result = type.decode(text);
        assertEquals(expectedDate, result.getValue());
        assertEquals(expectedDate, result.getDate());
        assertEquals(new DateHolder(expectedDate), result);
    }
}