View Javadoc
1   package net.avcompris.base.testutil.processes;
2   
3   public class SystemOutReport extends Report {
4   
5       public void send() {
6   
7           System.out.println("Report #" + index + "/" + count + " for " + name + ": Done.");
8       }
9   
10      public SystemOutReport(final String name, final int index, final int count) {
11  
12          this.name = name;
13          this.index = index;
14          this.count = count;
15  
16          System.out.println("Report #" + index + "/" + count + " for " + name + "...");
17      }
18  
19      private final int index;
20      private final int count;
21  
22      private final String name;
23  
24      public void info(final Object... objects) {
25  
26          line("  ", objects);
27      }
28  
29      private static void line(final String indent, final Object[] objects) {
30  
31          if (objects.length == 1) {
32  
33              System.out.println(indent + objects[0]);
34  
35          } else {
36  
37              System.out.print(indent);
38              
39              boolean start = true;
40              
41              for (final Object o : objects) {
42              
43                  if (start) {
44                      
45                      start= false;
46                      
47                  } else {
48                      
49                      System.out.print("  --  ");
50                  }
51                  
52                  System.out.print(o);
53              }
54              
55              System.out.println();
56          }
57      }
58  
59      public void infoDetail(final Object... objects) {
60  
61          line("    ", objects);
62      }
63  
64      public void error(final Object... objects) {
65  
66          line("  ", objects);
67      }
68  
69      public void errorDetail(final Object... objects) {
70  
71          line("    ", objects);
72      }
73  }