use of java.time.LocalDate in project SmartCity-Market by TechnionYP5777.
the class UpdateProductPicturesCustomerTest method updateIsNotNeededTest.
@Test
public void updateIsNotNeededTest() {
try {
LocalDate currentPicturesDate = PictureManager.getCurrentDate();
Mockito.when(clientRequestHandler.sendRequestWithRespond((new CommandWrapper(c.getId(), CommandDescriptor.UPDATE_PRODUCTS_PICTURES, Serialization.serialize(currentPicturesDate))).serialize())).thenReturn(new CommandWrapper(ResultDescriptor.SM_NO_UPDATE_NEEDED, Serialization.serialize(null)).serialize());
} catch (IOException ¢) {
fail();
}
try {
updateProductPicturesThread.start();
updateProductPicturesThread.join();
} catch (Exception e) {
System.out.println(e + "");
fail();
}
}
use of java.time.LocalDate in project Synthese_2BIN by TheYoungSensei.
the class ListeTarifs method deserialize.
@SuppressWarnings("unchecked")
public static boolean deserialize() {
Assembly.getInstance().getListeTarifs();
Path p = FileSystems.getDefault().getPath(ListeTarifs.NOM_FICHIER);
try (InputStream in = Files.newInputStream(p);
ObjectInputStream o = new ObjectInputStream(in)) {
Assembly.getInstance().getListeTarifs().tarifs = (TreeMap<LocalDate, Tarif>) o.readObject();
return true;
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
return false;
}
}
use of java.time.LocalDate in project Synthese_2BIN by TheYoungSensei.
the class GestionEncheres method fournirEncherisseurDuJour.
// renvoie un ensemble vide s'il n'y a pas d'enchere
public Set<Utilisateur> fournirEncherisseurDuJour() {
LocalDate aujourdhui = LocalDate.now();
Set<Utilisateur> encherisseurs = new HashSet<Utilisateur>();
SortedSet<Enchere> enchereDuJour = encheres.get(aujourdhui);
if (enchereDuJour == null)
return encherisseurs;
enchereDuJour.forEach((e) -> encherisseurs.add(e.getEncherisseur()));
// déjà cloné dans Enchère
return encherisseurs;
}
use of java.time.LocalDate in project SmartCity-Market by TechnionYP5777.
the class ProductPackageTest method ProductPackageTestMethod.
@Test
public void ProductPackageTestMethod() {
LocalDate ld = LocalDate.of(2016, 12, 11);
SmartCode sc = new SmartCode(123, ld);
Location lo = new Location(1, 1, PlaceInMarket.WAREHOUSE);
ProductPackage pp = new ProductPackage(sc, 2, lo);
if (!sc.equals(pp.getSmartCode()) || pp.getAmount() != 2 || !lo.equals(pp.getLocation()))
fail();
sc.setBarcode(111);
lo.setX(2);
pp.setSmartCode(sc);
pp.setAmount(1);
pp.setLocation(lo);
if (!sc.equals(pp.getSmartCode()) || pp.getAmount() != 1 || !lo.equals(pp.getLocation()))
fail();
LocalDate ld2 = LocalDate.of(2015, 12, 12);
SmartCode sc2 = new SmartCode(111, ld2);
ProductPackage pp2 = new ProductPackage(sc2, 1, lo);
if (pp2.equals(pp))
fail();
sc2.setExpirationDate(sc.getExpirationDate());
pp.setSmartCode(sc2);
if (!pp2.equals(pp))
fail();
}
use of java.time.LocalDate in project SmartCity-Market by TechnionYP5777.
the class SmartCodeTest method SmartCodeTestMethod.
@Test
public void SmartCodeTestMethod() {
LocalDate ld = LocalDate.of(2016, 12, 11);
SmartCode sc = new SmartCode(123, ld);
if (sc.getBarcode() != 123 || !sc.getExpirationDate().equals(ld))
fail();
sc.setBarcode(111);
ld.plusDays(1);
sc.setExpirationDate(ld);
if (sc.getBarcode() != 111 || !sc.getExpirationDate().equals(ld))
fail();
LocalDate ld2 = LocalDate.of(2015, 12, 12);
SmartCode sc2 = new SmartCode(111, ld2);
if (sc2.equals(sc))
fail();
sc2.setExpirationDate(sc.getExpirationDate());
if (!sc2.equals(sc))
fail();
}
Aggregations