@Test
public void testWrite() {

    TestResourceStringData[] testDataJapanese = {
            new TestResourceStringData("sushi", "Sushi", 1),
            new TestResourceStringData("ramen", "Ramen", 2)
    };
    TestResourceStringData[] testDataItalian = {
            new TestResourceStringData("minestrone", "Minestrone", 2),
            new TestResourceStringData("pizza", "Pizza", 3),
            new TestResourceStringData("spaghetti", "Spaghetti", 1)
    };
    String[] expectedLines = {
            "module,key,value",
            "Italian Foods,spaghetti,Spaghetti",
            "Italian Foods,minestrone,Minestrone",
            "Italian Foods,pizza,Pizza",
            "Japanese Foods,sushi,Sushi",
            "Japanese Foods,ramen,Ramen"
    };
    Map<String, LanguageBundle> testDataMap = new LinkedHashMap<>();
    testDataMap.put("Japanese Foods", TestUtils.createLanguageBundle(testDataJapanese));
    testDataMap.put("Italian Foods", TestUtils.createLanguageBundle(testDataItalian));
    MultiBundleResourceFilter filter = ResourceFilterFactory.getMultiBundleResourceFilter(MultiBundleCSVFilter.ID);
    try (ByteArrayOutputStream outStream = new ByteArrayOutputStream()) {
        filter.write(outStream, testDataMap, new FilterOptions(Locale.ENGLISH));
        TestUtils.compareLines(expectedLines, outStream.toByteArray());
    } catch (IOException e) {
        fail(e.getMessage());
    } catch (ResourceFilterException e) {
        fail(e.getMessage());
    }
}