Compare commits
No commits in common. "b64917bb5acac53901a086dcabed692bbd21fec0" and "65f4ba4a002512d3bdf281da88d0b9d13b3d721e" have entirely different histories.
b64917bb5a
...
65f4ba4a00
9 changed files with 70 additions and 66 deletions
|
|
@ -1,13 +0,0 @@
|
||||||
package org.example;
|
|
||||||
|
|
||||||
public class Accounting {
|
|
||||||
private String accounting;
|
|
||||||
|
|
||||||
public Accounting(String pAccounting) {
|
|
||||||
this.accounting = pAccounting;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void process(String contenu) {
|
|
||||||
System.out.println("comptabilité:" + contenu.toString().toLowerCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
package org.example;
|
|
||||||
|
|
||||||
public class Cart {
|
|
||||||
private StockManagement stock;
|
|
||||||
private Accounting accounting;
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
public Cart(StockManagement pStock, Accounting pAccounting) {
|
|
||||||
this.stock = pStock;
|
|
||||||
this.accounting = pAccounting;
|
|
||||||
this.content = new String ("Contenu du panier");
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getContent() {
|
|
||||||
return this.content;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initiateOrder() {
|
|
||||||
this.stock.process(this.content);
|
|
||||||
this.accounting.process(this.content);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
14
panier/src/main/java/org/example/Comptabilite.java
Normal file
14
panier/src/main/java/org/example/Comptabilite.java
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Comptabilite {
|
||||||
|
private String comptabilite;
|
||||||
|
|
||||||
|
public Comptabilite(String pComptabilite) {
|
||||||
|
this.comptabilite = pComptabilite;
|
||||||
|
}
|
||||||
|
public void traite(String contenu) {
|
||||||
|
System.out.println("comptabilité:" + contenu.toString().toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
15
panier/src/main/java/org/example/GestionDeStock.java
Normal file
15
panier/src/main/java/org/example/GestionDeStock.java
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
package org.example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class GestionDeStock {
|
||||||
|
private String gestionStock;
|
||||||
|
|
||||||
|
public GestionDeStock(String pGestionStock) {
|
||||||
|
this.gestionStock = pGestionStock;
|
||||||
|
}
|
||||||
|
public void traite(String contenu) {
|
||||||
|
|
||||||
|
System.out.println("G.DES.STOCKS:" + contenu.toString().toUpperCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
23
panier/src/main/java/org/example/Panier.java
Normal file
23
panier/src/main/java/org/example/Panier.java
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.example;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
public class Panier {
|
||||||
|
private GestionDeStock stock;
|
||||||
|
private Comptabilite compta;
|
||||||
|
private String contenu;
|
||||||
|
|
||||||
|
public Panier (GestionDeStock pStock, Comptabilite pCompta) {
|
||||||
|
this.stock = pStock;
|
||||||
|
this.compta = pCompta;
|
||||||
|
this.contenu = new String ("Contenu du panier");
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContenu() {
|
||||||
|
return this.contenu;
|
||||||
|
};
|
||||||
|
|
||||||
|
public void declencherCommande() {
|
||||||
|
this.stock.traite(this.contenu);
|
||||||
|
this.compta.traite(this.contenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
package org.example;
|
|
||||||
|
|
||||||
public class StockManagement {
|
|
||||||
private String stockManagement;
|
|
||||||
|
|
||||||
public StockManagement(String pStockManagement) {
|
|
||||||
this.stockManagement = pStockManagement;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void process(String contenu) {
|
|
||||||
System.out.println("G.DES.STOCKS:" + contenu.toString().toUpperCase());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -7,15 +7,15 @@ import java.io.PrintStream;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class AccountingTest {
|
class ComptabiliteTest {
|
||||||
@Test
|
@Test
|
||||||
void testProcess() {
|
void testTraite() {
|
||||||
Accounting compta = new Accounting("Compta1");
|
Comptabilite compta = new Comptabilite("Compta1");
|
||||||
|
|
||||||
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
||||||
System.setOut(new PrintStream(outContent));
|
System.setOut(new PrintStream(outContent));
|
||||||
|
|
||||||
compta.process("Test Contenu");
|
compta.traite("Test Contenu");
|
||||||
|
|
||||||
assertEquals("comptabilité:test contenu\n", outContent.toString());
|
assertEquals("comptabilité:test contenu\n", outContent.toString());
|
||||||
|
|
||||||
|
|
@ -7,15 +7,15 @@ import java.io.PrintStream;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class StockManagementTest {
|
class GestionDeStockTest {
|
||||||
@Test
|
@Test
|
||||||
void testProcess() {
|
void testTraite() {
|
||||||
StockManagement stock = new StockManagement("Stock1");
|
GestionDeStock stock = new GestionDeStock("Stock1");
|
||||||
|
|
||||||
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
||||||
System.setOut(new PrintStream(outContent));
|
System.setOut(new PrintStream(outContent));
|
||||||
|
|
||||||
stock.process("Test Contenu");
|
stock.traite("Test Contenu");
|
||||||
|
|
||||||
assertEquals("G.DES.STOCKS:TEST CONTENU\n", outContent.toString());
|
assertEquals("G.DES.STOCKS:TEST CONTENU\n", outContent.toString());
|
||||||
|
|
||||||
|
|
@ -7,26 +7,26 @@ import java.io.PrintStream;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
class CartTest {
|
class PanierTest {
|
||||||
@Test
|
@Test
|
||||||
void testGetContenu() {
|
void testGetContenu() {
|
||||||
StockManagement stock = new StockManagement("Stock1");
|
GestionDeStock stock = new GestionDeStock("Stock1");
|
||||||
Accounting compta = new Accounting("Compta1");
|
Comptabilite compta = new Comptabilite("Compta1");
|
||||||
Cart cart = new Cart(stock, compta);
|
Panier panier = new Panier(stock, compta);
|
||||||
|
|
||||||
assertEquals("Contenu du panier", cart.getContent());
|
assertEquals("Contenu du panier", panier.getContenu());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testInitiateOrder() {
|
void testDeclencherCommande() {
|
||||||
StockManagement stock = new StockManagement("Stock1");
|
GestionDeStock stock = new GestionDeStock("Stock1");
|
||||||
Accounting compta = new Accounting("Compta1");
|
Comptabilite compta = new Comptabilite("Compta1");
|
||||||
Cart cart = new Cart(stock, compta);
|
Panier panier = new Panier(stock, compta);
|
||||||
|
|
||||||
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
ByteArrayOutputStream outContent = new ByteArrayOutputStream();
|
||||||
System.setOut(new PrintStream(outContent));
|
System.setOut(new PrintStream(outContent));
|
||||||
|
|
||||||
cart.initiateOrder();
|
panier.declencherCommande();
|
||||||
|
|
||||||
String expectedOutput = "G.DES.STOCKS:CONTENU DU PANIER\ncomptabilité:contenu du panier\n";
|
String expectedOutput = "G.DES.STOCKS:CONTENU DU PANIER\ncomptabilité:contenu du panier\n";
|
||||||
assertEquals(expectedOutput, outContent.toString());
|
assertEquals(expectedOutput, outContent.toString());
|
||||||
Loading…
Add table
Reference in a new issue