Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#15539 closed enhancement (fixed)

[PATCH] use awaitility in MinimapDialogTest rather than Thread.sleep()

Reported by: ris Owned by: team
Priority: normal Milestone: 17.11
Component: Unit tests Version:
Keywords: jmapviewer tileloader awaitility minimapdialog Cc:


A few things in these patches.

Firstly, the background changes are some additions & cleanups to MinimapDialogTest.

I've had a go at using Awaitility in response to sonar's nagging instead of Thread.sleep(). As such the topmost patch (6/6) in this series depends on awaitility-3.0.0.jar being added to test/lib/. Obviously it would be dumb of me to include that in my patches - you can do that yourselves.

To be anything other than a fancy Thread.sleep(), Awaitility also needs to be provided with a callback to be able to check whether the expected operation has completed. I had some trouble in doing this for these tests.

In the end I found myself adding a new method, hasOutstandingTasks() to JMapViewer's TileLoader interface. It may be going a bit far, but tile loading is something that could do with a lot more testing across the suite, and this would give us the mechanism to test that asynchronous task "safely". To lessen the impact on any external implementers of TileLoader, I included a default implementation (which raises UnsupportedOperationException) to remove the immediate need to implement it. I realize this belongs to a separate repository so have kept the patch separate (patch 4/6).

This set of changes is browsable at

Patches based on top of r13110

Change History (9)

comment:1 by Don-vip, 6 years ago

Milestone: 17.11

comment:2 by Don-vip, 6 years ago

Resolution: fixed
Status: newclosed

In 13112/josm:

fix #15539 - use awaitility in MinimapDialogTest rather than Thread.sleep() (patch by ris)

comment:3 by Don-vip, 6 years ago

Thanks! The solution is very clean, I'm sure it will help us a lot in other tests as well.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.