Skip to main content

All Questions

Filter by
Sorted by
Tagged with
7 votes
2 answers
6k views

Unit test code with WatchService

Below is a short simple example of using a WatchService to keep data in sync with a file. My question is how to reliably test the code. The test fails occasionally, probably because of a race ...
user2133814's user avatar
  • 2,621
0 votes
1 answer
595 views

Testing code using a watch service

I'm trying to unit test a small piece of logic that is using WatchService (Java 7). Although, this is proving to be more difficult than anticipated because of the infinite loop: watchService.take(); ...
user avatar