Skip to content

Commit

Permalink
#113 tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 1, 2021
1 parent 3edd659 commit fc86070
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<parent>
<groupId>com.jcabi</groupId>
<artifactId>jcabi</artifactId>
<version>1.26.0</version>
<version>1.29.0</version>
</parent>
<artifactId>jcabi-log</artifactId>
<version>1.0-SNAPSHOT</version>
Expand Down Expand Up @@ -83,6 +83,11 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<version>5.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand All @@ -98,6 +103,7 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<systemPropertyVariables>
<file.encoding>Cp1251</file.encoding>
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/jcabi/log/VerboseRunnable.java
Original file line number Diff line number Diff line change
Expand Up @@ -191,22 +191,22 @@ public void run() {
// @checkstyle IllegalCatch (1 line)
} catch (final RuntimeException ex) {
if (this.rethrow) {
Logger.warn(this, "escalated exception: %s", this.tail(ex));
Logger.warn(this, "Escalated exception: %s", this.tail(ex));
throw ex;
}
Logger.warn(this, "swallowed exception: %s", this.tail(ex));
Logger.warn(this, "Swallowed exception: %s", this.tail(ex));
// @checkstyle IllegalCatch (1 line)
} catch (final Error error) {
if (this.rethrow) {
Logger.error(this, "escalated error: %s", this.tail(error));
Logger.error(this, "Escalated error: %s", this.tail(error));
throw error;
}
Logger.error(this, "swallowed error: %s", this.tail(error));
Logger.error(this, "Swallowed error: %s", this.tail(error));
}
if (Thread.currentThread().isInterrupted()) {
Thread.currentThread().interrupt();
throw new IllegalStateException(
"the thread has been interrupted"
"The thread has been interrupted"
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/jcabi/log/VerboseRunnableTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ public void preservesInterruptedStatus() throws Exception {
thread.get().interrupt();
TimeUnit.SECONDS.sleep(1L);
svc.shutdown();
MatcherAssert.assertThat(runs.get(), Matchers.is(1));
MatcherAssert.assertThat(
svc.awaitTermination(1L, TimeUnit.SECONDS),
Matchers.is(true)
);
MatcherAssert.assertThat(runs.get(), Matchers.is(1));
}

}

0 comments on commit fc86070

Please sign in to comment.