forked from pierront/mylibrary-template
Passer commande #4
@@ -2,9 +2,10 @@ package fr.iut_fbleau.but3.dev62.mylibrary.commande.entity;
|
||||
|
||||
import fr.iut_fbleau.but3.dev62.mylibrary.commande.LigneCommandeInfo;
|
||||
import fr.iut_fbleau.but3.dev62.mylibrary.commande.ModePaiement;
|
||||
import fr.iut_fbleau.but3.dev62.mylibrary.customer.entity.Customer;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -67,13 +68,35 @@ public class CommandeTest {
|
||||
Commande commande = Commande.builder().build();
|
||||
UUID originalId = commande.getCommandeId();
|
||||
|
||||
commande.setRandomUUIDCommand();
|
||||
commande.setRandomUUIDCommande();
|
||||
|
||||
assertNotNull(commande.getCommandeId());
|
||||
assertNotEquals(originalId, commande.getCommandeId());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
void testConvertPointsFideliteGagnes(){
|
||||
Commande commande = Commande.builder()
|
||||
.montantTotal(14.34)
|
||||
.build();
|
||||
Integer point = commande.convertPointsFidelite();
|
||||
|
||||
assertEquals(point,(int) Math.ceil(commande.getMontantTotal()));
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(doubles = {-1.9,0.0})
|
||||
void testConvertPointsFideliteGagnesWhenMontantTotalIsNotGood(){
|
||||
Commande commande = Commande.builder()
|
||||
.montantTotal(14.34)
|
||||
.build();
|
||||
Integer point = commande.convertPointsFidelite();
|
||||
|
||||
assertEquals(point,(int) Math.ceil(commande.getMontantTotal()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user