test_class.declarator: processListWriter
test_class.modifier: private
test_class.original_string: private AsynchronousProcessListWriter processListWriter;
test_class.type: AsynchronousProcessListWriter
test_class.var_name: processListWriter
test_class.file: everrest-core/src/test/java/org/everrest/core/impl/async/AsynchronousProcessListWriterTest.java
test_class.identifier: AsynchronousProcessListWriterTest
test_case.body: @Test
      public void writesListOfAsynchronousProcessAsPlainText() throws Exception {
          List<AsynchronousProcess> processes = newArrayList(new AsynchronousProcess("andrew", 1L, "/a", "running"),
                                                             new AsynchronousProcess("user", 2L, "/b", "done"));
  
          List<List<String>> expectedProcessesTable = newArrayList(newArrayList("USER", "ID", "STAT", "PATH"),
                                                                   newArrayList("andrew", "1", "running", "/a"),
                                                                   newArrayList("user", "2", "done", "/b"));
  
          ByteArrayOutputStream bout = new ByteArrayOutputStream();
          processListWriter.writeTo(processes, List.class,
                                    newParameterizedType(List.class, AsynchronousProcess.class),
                                    new Annotation[0],
                                    MediaType.TEXT_PLAIN_TYPE,
                                    new MultivaluedHashMap<>(),
                                    bout);
  
          List<String> lines = CharStreams.readLines(new StringReader(bout.toString()));
          assertEquals(3, lines.size());
  
          Pattern pattern = Pattern.compile("(\\w+)\\s+(\\w+)\\s+(\\w+)\\s+(/?\\w+)");
  
          List<List<String>> processesTable = newArrayList();
          for (String line : lines) {
              Matcher matcher = pattern.matcher(line);
              assertTrue(String.format("String '%s' is not matched to pattern", line), matcher.matches());
              processesTable.add(getAllGroups(matcher));
          }
  
          assertEquals(expectedProcessesTable, processesTable);
      }
test_case.class_method_signature: AsynchronousProcessListWriterTest.writesListOfAsynchronousProcessAsPlainText()
test_case.full_signature: @Test public void writesListOfAsynchronousProcessAsPlainText()
test_case.identifier: writesListOfAsynchronousProcessAsPlainText
test_case.invocations: newArrayList newArrayList newArrayList newArrayList newArrayList writeTo newParameterizedType readLines toString assertEquals size compile newArrayList matcher assertTrue format matches add getAllGroups assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void writesListOfAsynchronousProcessAsPlainText()
focal_class.declarator: OUTPUT_FORMAT = "%-30s%-10s%-10s%s%n"
focal_class.modifier: private static final
focal_class.original_string: private static final String OUTPUT_FORMAT = "%-30s%-10s%-10s%s%n";
focal_class.type: String
focal_class.var_name: OUTPUT_FORMAT
focal_class.file: everrest-core/src/main/java/org/everrest/core/impl/async/AsynchronousProcessListWriter.java
focal_class.identifier: AsynchronousProcessListWriter
focal_class.interfaces: implements MessageBodyWriter<Iterable<AsynchronousProcess>>
focal_class.class_method_signature: AsynchronousProcessListWriter.isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.full_signature: @Override public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.identifier: isWriteable
focal_class.modifiers: @Override public
focal_class.parameters: (Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.return: boolean
focal_class.signature: boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType)
focal_class.class_method_signature: AsynchronousProcessListWriter.getSize(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType)
focal_class.full_signature: @Override public long getSize(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType)
focal_class.identifier: getSize
focal_class.modifiers: @Override public
focal_class.parameters: (Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType)
focal_class.return: long
focal_class.signature: long getSize(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type,
                          Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType)
focal_class.class_method_signature: AsynchronousProcessListWriter.writeTo(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.full_signature: @Override public void writeTo(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.identifier: writeTo
focal_class.modifiers: @Override public
focal_class.parameters: (Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_class.return: void
focal_class.signature: void writeTo(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_method.body: @Override
      public void writeTo(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream) throws IOException, WebApplicationException {
          PrintWriter writer = new PrintWriter(new OutputStreamWriter(entityStream));
          try {
              writer.format(OUTPUT_FORMAT, "USER", "ID", "STAT", "PATH");
              for (AsynchronousProcess process : asynchronousProcesses) {
                  writer.format(OUTPUT_FORMAT, process.getOwner() == null ? "unknown" : process.getOwner(), process.getId(), process.getStatus(), process.getPath());
              }
          } finally {
              writer.flush();
          }
      }
focal_method.class_method_signature: AsynchronousProcessListWriter.writeTo(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_method.full_signature: @Override public void writeTo(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_method.identifier: writeTo
focal_method.invocations: format format getOwner getOwner getId getStatus getPath flush
focal_method.modifiers: @Override public
focal_method.parameters: (Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)
focal_method.return: void
focal_method.signature: void writeTo(Iterable<AsynchronousProcess> asynchronousProcesses,
                          Class<?> type, Type genericType,
                          Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<String, Object> httpHeaders,
                          OutputStream entityStream)