Writer.java

1
package com.github.dakusui.actionunit.io;
2
3
import org.slf4j.Logger;
4
import org.slf4j.LoggerFactory;
5
6
import java.util.ArrayList;
7
import java.util.Iterator;
8
import java.util.List;
9
10
/**
11
 * An interface that abstracts various destinations to which {@link com.github.dakusui.actionunit.visitors.ActionPrinter}'s
12
 * output goes.
13
 */
14
public interface Writer {
15
  void writeLine(String s);
16
17
  class Impl implements Writer, Iterable<String> {
18
    List<String> arr = new ArrayList<>();
19
20
    @Override
21
    public void writeLine(String s) {
22
      arr.add(s);
23
    }
24
25
    @Override
26
    public Iterator<String> iterator() {
27 1 1. iterator : replaced return value with null for com/github/dakusui/actionunit/io/Writer$Impl::iterator → KILLED
      return this.arr.iterator();
28
    }
29
  }
30
31
  enum Std implements Writer {
32
    OUT {
33
      @Override
34
      public void writeLine(String s) {
35 1 1. writeLine : removed call to java/io/PrintStream::println → SURVIVED
        System.out.println(s);
36
      }
37
    },
38
    ERR {
39
      @Override
40
      public void writeLine(String s) {
41 1 1. writeLine : removed call to java/io/PrintStream::println → SURVIVED
        System.err.println(s);
42
      }
43
    };
44
45
    @Override
46
    public abstract void writeLine(String s);
47
  }
48
49
  enum Slf4J implements Writer {
50
    TRACE {
51
      @Override
52
      public void writeLine(String s) {
53
        LOGGER.trace(s);
54
      }
55
    },
56
    DEBUG {
57
      @Override
58
      public void writeLine(String s) {
59
        LOGGER.debug(s);
60
      }
61
    },
62
    INFO {
63
      @Override
64
      public void writeLine(String s) {
65
        LOGGER.info(s);
66
      }
67
    },
68
    WARN {
69
      @Override
70
      public void writeLine(String s) {
71
        LOGGER.warn(s);
72
      }
73
    },
74
    ERROR {
75
      @Override
76
      public void writeLine(String s) {
77
        LOGGER.error(s);
78
      }
79
    };
80
    private static final Logger LOGGER = LoggerFactory.getLogger(Slf4J.class);
81
  }
82
}

Mutations

27

1.1
Location : iterator
Killed by : com.github.dakusui.actionunit.scenarios.ActionPrinterTest$SimpleTest.givenNew(com.github.dakusui.actionunit.scenarios.ActionPrinterTest$SimpleTest)
replaced return value with null for com/github/dakusui/actionunit/io/Writer$Impl::iterator → KILLED

35

1.1
Location : writeLine
Killed by : none
removed call to java/io/PrintStream::println → SURVIVED

41

1.1
Location : writeLine
Killed by : none
removed call to java/io/PrintStream::println → SURVIVED

Active mutators

Tests examined


Report generated by PIT 1.7.3