Skip to content

Commit

Permalink
test: add reproduce test case for issue #361, test should fail
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Mar 8, 2022
1 parent fb515e1 commit 9a83306
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/test/java/com/alibaba/ttl/threadpool/TtlExecutorsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,21 @@ class TtlExecutorsTest {
msg1 == e.message || e.message!!.startsWith(msg2)
)
}

/**
* https://github.com/alibaba/transmittable-thread-local/issues/361
*/
@Test
fun test_fixed_ClassCastException_of_issue_361() {
val queue = PriorityBlockingQueue<Int>()
queue.put(1)
queue.put(100)
queue.put(2)

assertEquals(1, queue.poll())
assertEquals(2, queue.poll())
assertEquals(100, queue.poll())
}
}

private class BizComparableTask : Runnable, Comparable<Runnable> {
Expand Down

0 comments on commit 9a83306

Please sign in to comment.