Wed, 31 Dec 2014 07:22:50 +0100
Correct previous dual key logic pending first delivery installment.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 package org.mozilla.gecko.background.sync.helpers;
6 import static junit.framework.Assert.assertEquals;
7 import static junit.framework.Assert.assertNotNull;
8 import junit.framework.AssertionFailedError;
10 public class ExpectStoredDelegate extends DefaultStoreDelegate {
11 String expectedGUID;
12 String storedGuid;
14 public ExpectStoredDelegate(String guid) {
15 this.expectedGUID = guid;
16 }
18 @Override
19 public synchronized void onStoreCompleted(long storeEnd) {
20 try {
21 assertNotNull(storedGuid);
22 performNotify();
23 } catch (AssertionFailedError e) {
24 performNotify("GUID " + this.expectedGUID + " was not stored", e);
25 }
26 }
28 @Override
29 public synchronized void onRecordStoreSucceeded(String guid) {
30 this.storedGuid = guid;
31 try {
32 if (this.expectedGUID != null) {
33 assertEquals(this.expectedGUID, guid);
34 }
35 } catch (AssertionFailedError e) {
36 performNotify(e);
37 }
38 }
39 }