Exemple #1
0
  public void refresh() {
    final List<Contact> birthdayContacts = getContacts();

    List<Contact> systemContacts =
        ContactFactory.getInstance().createSystemContacts(mApplicationContext);

    // first time using the app
    if (birthdayContacts.size() == 0) {
      writeAllContacts(systemContacts);
    } else if (birthdayContacts.size() < systemContacts.size()) {
      addContact(birthdayContacts, systemContacts);
    } else if (birthdayContacts.size() > systemContacts.size()) {
      deleteContact(birthdayContacts, systemContacts);
    } else {
      updateContact(birthdayContacts, systemContacts);
    }
  }
  //    @Test
  public void create() throws Exception {

    Contact contact = ContactFactory.createContact("*****@*****.**", "7550");
    Address_location address_location = AddressFactory.createAddress("1 Hens rd", "7945");
    CorporateClient corporateClient =
        CorporateClientFactory.createCorpClient(
            "Groote schuur", "Riyaaz", "Rawoot", address_location, contact);
    IndividualClient individualClient =
        IndividualClientFactory.createIndividualClient(
            "Rawoot", "Riyaaz", address_location, contact);
    Machine machine = MachineFactory.createMachine("Washing machine");

    corpClients.add(corporateClient);
    indivClients.add(individualClient);
    machines.add(machine);

    Orders orders =
        OrderFactory.createOrder(
            (long) 23434, new Date(), true, 32.00, corpClients, indivClients, machines);
    repository.save(orders);

    id = orders.getOrderID();
    Assert.assertNotNull(orders.getOrderID());
  }