test_class.declarator: outContent = new ByteArrayOutputStream()
test_class.modifier: private final
test_class.original_string: private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
test_class.type: ByteArrayOutputStream
test_class.var_name: outContent
test_class.declarator: originalOut = System.out
test_class.modifier: private static final
test_class.original_string: private static final PrintStream originalOut = System.out;
test_class.type: PrintStream
test_class.var_name: originalOut
test_class.declarator: errStream = System.err
test_class.modifier: private static final
test_class.original_string: private static final PrintStream errStream = System.err;
test_class.type: PrintStream
test_class.var_name: errStream
test_class.file: cli/ballerina-cli-module/src/test/java/org/ballerinalang/cli/module/SearchTest.java
test_class.identifier: SearchTest
test_case.body: @Test(description = "Test printing search results table for different terminal widths",
              dataProvider = "searchResultsWithTerminalWidth")
      public void testPrintModules(ArrayValue modules, String terminalWidth, String outputFile) throws IOException {
          printModules(modules, terminalWidth);
          Path outputFilePath = Paths.get("src", "test", "resources", "test-resources", "search", outputFile);
          String expectedOutput = new String(Files.readAllBytes(outputFilePath), StandardCharsets.UTF_8);
  
          if (!(outContent.toString().contains(expectedOutput))) {
              errStream.println("expected output not contains in output stream");
              errStream.println("expected output:\n" + expectedOutput);
              errStream.println("print stream:" + outContent.toString());
              Assert.fail();
          }
      }
test_case.class_method_signature: SearchTest.testPrintModules(ArrayValue modules, String terminalWidth, String outputFile)
test_case.full_signature: @Test(description = "Test printing search results table for different terminal widths", dataProvider = "searchResultsWithTerminalWidth") public void testPrintModules(ArrayValue modules, String terminalWidth, String outputFile)
test_case.identifier: testPrintModules
test_case.invocations: printModules get readAllBytes contains toString println println println toString fail
test_case.modifiers: @Test(description = "Test printing search results table for different terminal widths", dataProvider = "searchResultsWithTerminalWidth") public
test_case.parameters: (ArrayValue modules, String terminalWidth, String outputFile)
test_case.return: void
test_case.signature: void testPrintModules(ArrayValue modules, String terminalWidth, String outputFile)
focal_class.declarator: outStream = System.out
focal_class.modifier: private static
focal_class.original_string: private static PrintStream outStream = System.out;
focal_class.type: PrintStream
focal_class.var_name: outStream
focal_class.file: cli/ballerina-cli-module/src/main/java/org/ballerinalang/cli/module/Search.java
focal_class.identifier: Search
focal_class.class_method_signature: Search.Search()
focal_class.full_signature: private  Search()
focal_class.identifier: Search
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.signature:  Search()
focal_class.class_method_signature: Search.execute(String url, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword,
              String terminalWidth)
focal_class.full_signature: public static void execute(String url, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword,
              String terminalWidth)
focal_class.identifier: execute
focal_class.modifiers: public static
focal_class.parameters: (String url, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword,
              String terminalWidth)
focal_class.return: void
focal_class.signature: void execute(String url, String proxyHost, int proxyPort, String proxyUsername, String proxyPassword,
              String terminalWidth)
focal_class.class_method_signature: Search.handleResponse(HttpURLConnection conn, int statusCode, String terminalWidth)
focal_class.full_signature: private static void handleResponse(HttpURLConnection conn, int statusCode, String terminalWidth)
focal_class.identifier: handleResponse
focal_class.modifiers: private static
focal_class.parameters: (HttpURLConnection conn, int statusCode, String terminalWidth)
focal_class.return: void
focal_class.signature: void handleResponse(HttpURLConnection conn, int statusCode, String terminalWidth)
focal_class.class_method_signature: Search.printModules(ArrayValue modules, String terminalWidth)
focal_class.full_signature: public static void printModules(ArrayValue modules, String terminalWidth)
focal_class.identifier: printModules
focal_class.modifiers: public static
focal_class.parameters: (ArrayValue modules, String terminalWidth)
focal_class.return: void
focal_class.signature: void printModules(ArrayValue modules, String terminalWidth)
focal_class.class_method_signature: Search.printModule(MapValue module, int dateColWidth, int versionColWidth, int authorsColWidth,
              int nameColWidth, int descColWidth, int minDescColWidth)
focal_class.full_signature: private static void printModule(MapValue module, int dateColWidth, int versionColWidth, int authorsColWidth,
              int nameColWidth, int descColWidth, int minDescColWidth)
focal_class.identifier: printModule
focal_class.modifiers: private static
focal_class.parameters: (MapValue module, int dateColWidth, int versionColWidth, int authorsColWidth,
              int nameColWidth, int descColWidth, int minDescColWidth)
focal_class.return: void
focal_class.signature: void printModule(MapValue module, int dateColWidth, int versionColWidth, int authorsColWidth,
              int nameColWidth, int descColWidth, int minDescColWidth)
focal_class.class_method_signature: Search.printTitle()
focal_class.full_signature: private static void printTitle()
focal_class.identifier: printTitle
focal_class.modifiers: private static
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void printTitle()
focal_class.class_method_signature: Search.printInCLI(String element, int charactersAllowed)
focal_class.full_signature: private static void printInCLI(String element, int charactersAllowed)
focal_class.identifier: printInCLI
focal_class.modifiers: private static
focal_class.parameters: (String element, int charactersAllowed)
focal_class.return: void
focal_class.signature: void printInCLI(String element, int charactersAllowed)
focal_class.class_method_signature: Search.printCharacter(String element, int charactersAllowed, String separator, boolean isDashElement)
focal_class.full_signature: private static void printCharacter(String element, int charactersAllowed, String separator, boolean isDashElement)
focal_class.identifier: printCharacter
focal_class.modifiers: private static
focal_class.parameters: (String element, int charactersAllowed, String separator, boolean isDashElement)
focal_class.return: void
focal_class.signature: void printCharacter(String element, int charactersAllowed, String separator, boolean isDashElement)
focal_class.class_method_signature: Search.getDateCreated(long timeInMillis)
focal_class.full_signature: private static String getDateCreated(long timeInMillis)
focal_class.identifier: getDateCreated
focal_class.modifiers: private static
focal_class.parameters: (long timeInMillis)
focal_class.return: String
focal_class.signature: String getDateCreated(long timeInMillis)
focal_class.class_method_signature: Search.printTableHeader(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.full_signature: private static void printTableHeader(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.identifier: printTableHeader
focal_class.modifiers: private static
focal_class.parameters: (int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.return: void
focal_class.signature: void printTableHeader(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.class_method_signature: Search.printHeadingRow(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.full_signature: private static void printHeadingRow(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.identifier: printHeadingRow
focal_class.modifiers: private static
focal_class.parameters: (int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.return: void
focal_class.signature: void printHeadingRow(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.class_method_signature: Search.printDashRow(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.full_signature: private static void printDashRow(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.identifier: printDashRow
focal_class.modifiers: private static
focal_class.parameters: (int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_class.return: void
focal_class.signature: void printDashRow(int dateColWidth, int versionColWidth, int nameColWidth, int descColWidth,
              int minDescColWidth, int authorsColWidth)
focal_method.body: public static void printModules(ArrayValue modules, String terminalWidth) {
          int rightMargin = 3;
          int width = Integer.parseInt(terminalWidth) - rightMargin;
          int dateColWidth = 15;
          int versionColWidth = 8;
          int authorsColWidth = 15;
          double nameColFactor = 9.0;
          double descColFactor = 16.0;
          int additionalSpace = 7;
          double remainingWidth = (double) width - (dateColWidth + versionColWidth + additionalSpace);
          int nameColWidth = (int) Math.round(remainingWidth * (nameColFactor / (nameColFactor + descColFactor)));
          int descColWidth = (int) Math.round(remainingWidth * (descColFactor / (nameColFactor + descColFactor)));
          int minDescColWidth = 60;
  
          printTitle();
          printTableHeader(dateColWidth, versionColWidth, nameColWidth, descColWidth, minDescColWidth, authorsColWidth);
  
          int i = 0;
          while (i < modules.size()) {
              printModule((MapValue) modules.get(i), dateColWidth, versionColWidth, authorsColWidth, nameColWidth,
                      descColWidth, minDescColWidth);
              i = i + 1;
              outStream.println();
          }
          outStream.println();
          outStream.println(modules.size() + " modules found");
      }
focal_method.class_method_signature: Search.printModules(ArrayValue modules, String terminalWidth)
focal_method.full_signature: public static void printModules(ArrayValue modules, String terminalWidth)
focal_method.identifier: printModules
focal_method.invocations: parseInt round round printTitle printTableHeader size printModule get println println println size
focal_method.modifiers: public static
focal_method.parameters: (ArrayValue modules, String terminalWidth)
focal_method.return: void
focal_method.signature: void printModules(ArrayValue modules, String terminalWidth)