mobile/android/tests/background/junit3/src/testhelpers/MockClientsDatabaseAccessor.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/tests/background/junit3/src/testhelpers/MockClientsDatabaseAccessor.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,76 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +package org.mozilla.gecko.background.testhelpers;
     1.8 +
     1.9 +import java.util.Collection;
    1.10 +import java.util.List;
    1.11 +import java.util.Map;
    1.12 +
    1.13 +import org.mozilla.gecko.sync.CommandProcessor.Command;
    1.14 +import org.mozilla.gecko.sync.repositories.NullCursorException;
    1.15 +import org.mozilla.gecko.sync.repositories.android.ClientsDatabaseAccessor;
    1.16 +import org.mozilla.gecko.sync.repositories.domain.ClientRecord;
    1.17 +
    1.18 +public class MockClientsDatabaseAccessor extends ClientsDatabaseAccessor {
    1.19 +  public boolean storedRecord = false;
    1.20 +  public boolean dbWiped = false;
    1.21 +  public boolean clientsTableWiped = false;
    1.22 +  public boolean closed = false;
    1.23 +  public boolean storedArrayList = false;
    1.24 +  public boolean storedCommand;
    1.25 +
    1.26 +  @Override
    1.27 +  public void store(ClientRecord record) {
    1.28 +    storedRecord = true;
    1.29 +  }
    1.30 +
    1.31 +  @Override
    1.32 +  public void store(Collection<ClientRecord> records) {
    1.33 +    storedArrayList = false;
    1.34 +  }
    1.35 +
    1.36 +  @Override
    1.37 +  public void store(String accountGUID, Command command) throws NullCursorException {
    1.38 +    storedCommand = true;
    1.39 +  }
    1.40 +
    1.41 +  @Override
    1.42 +  public ClientRecord fetchClient(String profileID) throws NullCursorException {
    1.43 +    return null;
    1.44 +  }
    1.45 +
    1.46 +  @Override
    1.47 +  public Map<String, ClientRecord> fetchAllClients() throws NullCursorException {
    1.48 +    return null;
    1.49 +  }
    1.50 +
    1.51 +  @Override
    1.52 +  public List<Command> fetchCommandsForClient(String accountGUID) throws NullCursorException {
    1.53 +    return null;
    1.54 +  }
    1.55 +
    1.56 +  @Override
    1.57 +  public int clientsCount() {
    1.58 +    return 0;
    1.59 +  }
    1.60 +
    1.61 +  @Override
    1.62 +  public void wipeDB() {
    1.63 +    dbWiped = true;
    1.64 +  }
    1.65 +
    1.66 +  @Override
    1.67 +  public void wipeClientsTable() {
    1.68 +    clientsTableWiped = true;
    1.69 +  }
    1.70 +
    1.71 +  @Override
    1.72 +  public void close() {
    1.73 +    closed = true;
    1.74 +  }
    1.75 +
    1.76 +  public void resetVars() {
    1.77 +    storedRecord = dbWiped = clientsTableWiped = closed = storedArrayList = false;
    1.78 +  }
    1.79 +}
    1.80 \ No newline at end of file

mercurial