Skip to content

Commit f61b023

Browse files
committed
fix(test): fix test
1 parent 6405def commit f61b023

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

agent/src/main/java/com/intergral/deep/agent/poll/DriftAwareThread.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ public void run() {
144144
}
145145

146146
private void trace(final String msg) {
147-
LOGGER.trace(msg);
147+
LOGGER.trace(this.getName() + " - " + msg);
148148
}
149149

150150

151-
private void error(final String msg, final Throwable throwable) {
151+
void error(final String msg, final Throwable throwable) {
152152
LOGGER.error(this.getName() + " - " + msg, throwable);
153153
}
154154

agent/src/test/java/com/intergral/deep/agent/poll/DriftAwareThreadTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import java.util.concurrent.CountDownLatch;
2424
import org.junit.jupiter.api.BeforeEach;
2525
import org.junit.jupiter.api.Test;
26+
import org.mockito.Mockito;
2627

2728
class DriftAwareThreadTest {
2829

@@ -65,6 +66,12 @@ public long callback(final long duration, final long next) {
6566
assertTrue((lwrap.now + 10000) >= currentTimeMillis);
6667
}
6768

69+
@Test
70+
void errorLogs() {
71+
final DriftAwareThread spy = Mockito.spy(task);
72+
spy.error("test error", new RuntimeException("test exception"));
73+
Mockito.verify(spy, Mockito.times(1)).getName();
74+
}
6875

6976
@Test
7077
public void testCheckForEarlyWakeUp() throws Exception {

0 commit comments

Comments
 (0)