From fadd22148a7b8dbc55c8dc32e6353d7ec4fb0bb6 Mon Sep 17 00:00:00 2001 From: Lode Hoste Date: Tue, 24 Mar 2015 22:26:17 +0100 Subject: [PATCH] Check current state (and wait a bit longer) in the SyncthingService unit test --- .../test/syncthing/SyncthingServiceTest.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java b/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java index 06630a0c..45853592 100644 --- a/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java +++ b/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java @@ -66,10 +66,11 @@ public class SyncthingServiceTest extends ServiceTestCase { getService().registerOnApiChangeListener(new SyncthingService.OnApiChangeListener() { @Override public void onApiChange(SyncthingService.State currentState) { - latch.countDown(); + if (currentState == SyncthingService.State.ACTIVE) + latch.countDown(); } }); - latch.await(1, TimeUnit.SECONDS); + latch.await(10, TimeUnit.SECONDS); assertNotNull(getService().getApi()); assertNotNull(getService().getWebGuiUrl()); }