Skip to content

Commit

Permalink
fix(test): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Umaaz committed Sep 25, 2023
1 parent 6405def commit f61b023
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ public void run() {
}

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


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.concurrent.CountDownLatch;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

class DriftAwareThreadTest {

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

@Test
void errorLogs() {
final DriftAwareThread spy = Mockito.spy(task);
spy.error("test error", new RuntimeException("test exception"));
Mockito.verify(spy, Mockito.times(1)).getName();
}

@Test
public void testCheckForEarlyWakeUp() throws Exception {
Expand Down

0 comments on commit f61b023

Please sign in to comment.