mobile/android/tests/background/junit3/src/sync/helpers/ExpectStoredDelegate.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

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 }

mercurial