@Test
public void testFormat() {

    // formatowane obiekty
    Object[] objects = {
        new Integer("123"),
        new Integer("123"),
        new String[]{"A", "B", "C"},
        new BigDecimal("1.23")
    };
    // formattery
    Formatter[] formatters = {
        null,
        new Formatter() {
            @Override
            public String format(Object obj) {
                return "#" + obj + "#";
            }
        },
        null,
        null
    };
    // oczekiwane wyniki
    String[] expectedResults = {
        "123",
        "#123#",
        "[A, B, C]",
        "1.23"
    };
    // wykonanie testow
    for (int i = 0; i < objects.length; i++) {
        Object obj = objects[i];
        Formatter formatter = formatters[i];
        String expectedResult = expectedResults[i];
        String result = Printer.format(obj, formatter);
        assertEquals(expectedResult, result);
    }
}