Ejemplo n.º 1
0
  public void testFailedSync() {
    // Creazione dati di test
    accountDao.remove();
    UUID testToken = new UUID(0, 0); // token errato
    Account tempAccount = Account.createTempAccount(testToken);
    accountDao.set(tempAccount);
    List<Performance> randPerformance = new ArrayList<>();

    for (int i = 0; i < 10; i++) {
      randPerformance.add(new PerformanceDaoImplTest().randomPerformance());
    }
    performanceDao.add(randPerformance, true);

    // Sincronizzazione
    WebConnectionManager.Result result = WebConnectionManager.sync(mContext);
    assertEquals(WebConnectionManager.Result.UNLINKED, result);
  }
Ejemplo n.º 2
0
  public void testSync() throws Exception {
    // Creazione dati di test
    accountDao.remove();
    UUID testToken = UUID.fromString("790b9ab1-5c5c-4579-8c70-b9f433fcfbf8");
    Account tempAccount = Account.createTempAccount(testToken);
    accountDao.set(tempAccount);
    List<Performance> randPerformance = new ArrayList<>();

    for (int i = 0; i < 10; i++) {
      randPerformance.add(new PerformanceDaoImplTest().randomPerformance());
    }
    performanceDao.add(randPerformance, true);

    // Sincronizzazione
    WebConnectionManager.Result result = WebConnectionManager.sync(mContext);

    assertEquals(WebConnectionManager.Result.SUCCESS, result);
  }