@Test
public void testWrite() {

    TestResourceStringData[] testData = {
            new TestResourceStringData("minestrone", "Minestrone", 2),
            new TestResourceStringData("pizza", "Pizza", 3),
            new TestResourceStringData("spaghetti", "Spaghetti", 1)
    };
    String[] expectedLines = {
            "key,value",
            "spaghetti,Spaghetti",
            "minestrone,Minestrone",
            "pizza,Pizza"
    };
    LanguageBundle bundle = TestUtils.createLanguageBundle(testData);
    ResourceFilter filter = ResourceFilterFactory.getResourceFilter(CSVFilter.ID);
    try (ByteArrayOutputStream outStream = new ByteArrayOutputStream()) {
        filter.write(outStream, bundle, new FilterOptions(Locale.ENGLISH));
        TestUtils.compareLines(expectedLines, outStream.toByteArray());
    } catch (IOException e) {
        fail(e.getMessage());
    } catch (ResourceFilterException e) {
        fail(e.getMessage());
    }
}