TestLoggerQueue.java

1
package com.renomad.minum.logging;
2
3
4
import java.io.Serial;
5
import java.util.ArrayDeque;
6
import java.util.concurrent.locks.ReentrantLock;
7
8
/**
9
 * Used in {@link TestLogger} as a circular queue to store
10
 * the most recent log statements for analysis.
11
 */
12
public final class TestLoggerQueue extends ArrayDeque<String> {
13
14
    @Serial
15
    private static final long serialVersionUID = -149106325553645154L;
16
17
    private final ReentrantLock queueLock;
18
    private final int capacity;
19
20
    public TestLoggerQueue(int capacity){
21
        this.capacity = capacity;
22
        this.queueLock = new ReentrantLock();
23
    }
24
25
    @Override
26
    public boolean add(String e) {
27 1 1. add : removed call to java/util/concurrent/locks/ReentrantLock::lock → KILLED
        queueLock.lock();
28
        try {
29
            if (size() >= capacity)
30
                removeFirst();
31 2 1. add : replaced boolean return with true for com/renomad/minum/logging/TestLoggerQueue::add → KILLED
2. add : replaced boolean return with false for com/renomad/minum/logging/TestLoggerQueue::add → KILLED
            return super.add(e);
32
        } finally {
33 1 1. add : removed call to java/util/concurrent/locks/ReentrantLock::unlock → TIMED_OUT
            queueLock.unlock();
34
        }
35
    }
36
}

Mutations

27

1.1
Location : add
Killed by : com.renomad.minum.logging.TestLoggerTests.test_testLoggerQueue_Basic(com.renomad.minum.logging.TestLoggerTests)
removed call to java/util/concurrent/locks/ReentrantLock::lock → KILLED

31

1.1
Location : add
Killed by : com.renomad.minum.database.DbTests.test_Db_Delete_EdgeCase_FileGone(com.renomad.minum.database.DbTests)
replaced boolean return with true for com/renomad/minum/logging/TestLoggerQueue::add → KILLED

2.2
Location : add
Killed by : com.renomad.minum.logging.TestLoggerTests.test_testLoggerQueue_Basic(com.renomad.minum.logging.TestLoggerTests)
replaced boolean return with false for com/renomad/minum/logging/TestLoggerQueue::add → KILLED

33

1.1
Location : add
Killed by : none
removed call to java/util/concurrent/locks/ReentrantLock::unlock → TIMED_OUT

Active mutators

Tests examined


Report generated by PIT 1.17.0