java-hamcrest icon indicating copy to clipboard operation
java-hamcrest copied to clipboard

Failure of unit-test: testCancelledMismatchFormatting

Open spkrka opened this issue 6 years ago • 3 comments

I consistently get this test failure on master build.

Java version:

$ java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

Test failure:

testCancelledMismatchFormatting(com.spotify.hamcrest.future.ExceptionallyCompletedBlockingFutureTest)  Time elapsed: 0.003 sec  <<< FAILURE!
java.lang.AssertionError: 
Expected: is "a future that was cancelled"
     but: was "a future that was interrupted"
	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18)
	at org.junit.Assert.assertThat(Assert.java:956)
	at org.junit.Assert.assertThat(Assert.java:923)
	at com.spotify.hamcrest.future.ExceptionallyCompletedBlockingFutureTest.testCancelledMismatchFormatting(ExceptionallyCompletedBlockingFutureTest.java:100)

spkrka avatar Jan 25 '19 14:01 spkrka

This fixes it for me: https://github.com/spotify/java-hamcrest/pull/35

spkrka avatar Jan 25 '19 14:01 spkrka

Though that PR doesn't really address the root issue... If I add assertFalse(Thread.currentThread().isInterrupted()); as the first line of each test, it fails on that itself.

Thus, I think it's a case of test interference since it depends on the interrupted state being unset.

spkrka avatar Jan 25 '19 14:01 spkrka

Proper fix here instead: https://github.com/spotify/java-hamcrest/pull/37

spkrka avatar Jan 25 '19 14:01 spkrka