test_class.file: csv-res-filter/src/test/java/com/ibm/g11n/pipeline/resfilter/csv/TestMultiBundleCSVFilter.java
test_class.identifier: TestMultiBundleCSVFilter
test_case.body: @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());
          }
      }
test_case.class_method_signature: TestMultiBundleCSVFilter.testWrite()
test_case.full_signature: @Test public void testWrite()
test_case.identifier: testWrite
test_case.invocations: put createLanguageBundle put createLanguageBundle getMultiBundleResourceFilter write compareLines toByteArray fail getMessage fail getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testWrite()
focal_class.declarator: ID = "CSV-MULTI"
focal_class.modifier: public static final
focal_class.original_string: public static final String ID = "CSV-MULTI";
focal_class.type: String
focal_class.var_name: ID
focal_class.declarator: TYPE = Type.MULTI
focal_class.modifier: public static final
focal_class.original_string: public static final Type TYPE = Type.MULTI;
focal_class.type: Type
focal_class.var_name: TYPE
focal_class.file: csv-res-filter/src/main/java/com/ibm/g11n/pipeline/resfilter/csv/MultiBundleCSVFilter.java
focal_class.identifier: MultiBundleCSVFilter
focal_class.class_method_signature: MultiBundleCSVFilter.parse(InputStream inStream, FilterOptions options)
focal_class.full_signature: @Override public Map<String, LanguageBundle> parse(InputStream inStream, FilterOptions options)
focal_class.identifier: parse
focal_class.modifiers: @Override public
focal_class.parameters: (InputStream inStream, FilterOptions options)
focal_class.return: Map<String, LanguageBundle>
focal_class.signature: Map<String, LanguageBundle> parse(InputStream inStream, FilterOptions options)
focal_class.class_method_signature: MultiBundleCSVFilter.write(OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
focal_class.full_signature: @Override public void write(OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
focal_class.identifier: write
focal_class.modifiers: @Override public
focal_class.parameters: (OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
focal_class.return: void
focal_class.signature: void write(OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
focal_class.class_method_signature: MultiBundleCSVFilter.merge(InputStream baseStream, OutputStream outStream, Map<String, LanguageBundle> languageBundles,
              FilterOptions options)
focal_class.full_signature: @Override public void merge(InputStream baseStream, OutputStream outStream, Map<String, LanguageBundle> languageBundles,
              FilterOptions options)
focal_class.identifier: merge
focal_class.modifiers: @Override public
focal_class.parameters: (InputStream baseStream, OutputStream outStream, Map<String, LanguageBundle> languageBundles,
              FilterOptions options)
focal_class.return: void
focal_class.signature: void merge(InputStream baseStream, OutputStream outStream, Map<String, LanguageBundle> languageBundles,
              FilterOptions options)
focal_class.superclass: extends MultiBundleResourceFilter
focal_method.body: @Override
      public void write(OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
              throws IOException, ResourceFilterException {
          BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outStream, StandardCharsets.UTF_8));
          CSVPrinter printer = CSVFormat.RFC4180.withHeader("module", "key", "value").print(writer);
  
          // Sort by bundle
          TreeMap<String, LanguageBundle> sortedBundles = new TreeMap<>(languageBundles);
  
          for (Entry<String, LanguageBundle> bundleEntry: sortedBundles.entrySet()) {
              String module = bundleEntry.getKey();
              LanguageBundle languageBundle = bundleEntry.getValue();
              for (ResourceString resString : languageBundle.getSortedResourceStrings()) {
                  printer.printRecord(module, resString.getKey(), resString.getValue());
              }
          }
          printer.flush();
      }
focal_method.class_method_signature: MultiBundleCSVFilter.write(OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
focal_method.full_signature: @Override public void write(OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
focal_method.identifier: write
focal_method.invocations: print withHeader entrySet getKey getValue getSortedResourceStrings printRecord getKey getValue flush
focal_method.modifiers: @Override public
focal_method.parameters: (OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)
focal_method.return: void
focal_method.signature: void write(OutputStream outStream, Map<String, LanguageBundle> languageBundles, FilterOptions options)