Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fb second beer eve litchi #318

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/main/java/ch/heigvd/res/chill/domain/Otabiel/Eve_Litchi.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ch.heigvd.res.chill.domain.Otabiel;

import ch.heigvd.res.chill.domain.IProduct;

import java.math.BigDecimal;

public class Eve_Litchi implements IProduct {
public final static String NAME = "Eve Litchi";
public final static BigDecimal PRICE = new BigDecimal(2.5);

@Override
public String getName() {return NAME;}

@Override
public BigDecimal getPrice() {return PRICE;}

}
17 changes: 17 additions & 0 deletions src/main/java/ch/heigvd/res/chill/domain/Otabiel/Swaf.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package ch.heigvd.res.chill.domain.Otabiel;

import ch.heigvd.res.chill.domain.IProduct;

import java.math.BigDecimal;

public class Swaf implements IProduct {
public final static String NAME = "Swaf";
public final static BigDecimal PRICE = new BigDecimal(2.0);

@Override
public String getName() {return NAME;}

@Override
public BigDecimal getPrice() {return PRICE;}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ch.heigvd.res.chill.domain.Otabiel;

import ch.heigvd.res.chill.domain.Bartender;
import ch.heigvd.res.chill.protocol.OrderRequest;
import ch.heigvd.res.chill.protocol.OrderResponse;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;

import static org.junit.jupiter.api.Assertions.assertEquals;

class Eve_LitchiTest {

@Test
void thePriceAndNameForEve_LitchiShouldBeCorrect() {
Eve_Litchi beer = new Eve_Litchi();
assertEquals(beer.getName(), Eve_Litchi.NAME);
assertEquals(beer.getPrice(), Eve_Litchi.PRICE);
}

@Test
void aBartenderShouldAcceptAnOrderForEve_Litchi() {
Bartender jane = new Bartender();
String productName = "ch.heigvd.res.chill.domain.Otabiel.Eve_Litchi";
OrderRequest request = new OrderRequest(3, productName);
OrderResponse response = jane.order(request);
BigDecimal expectedTotalPrice = Eve_Litchi.PRICE.multiply(new BigDecimal(3));
assertEquals(expectedTotalPrice, response.getTotalPrice());
}
}
30 changes: 30 additions & 0 deletions src/test/java/ch/heigvd/res/chill/domain/Otabiel/SwafTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package ch.heigvd.res.chill.domain.Otabiel;

import ch.heigvd.res.chill.domain.Bartender;
import ch.heigvd.res.chill.protocol.OrderRequest;
import ch.heigvd.res.chill.protocol.OrderResponse;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;

import static org.junit.jupiter.api.Assertions.assertEquals;

class SwafTest {

@Test
void thePriceAndNameForSwafShouldBeCorrect() {
Swaf beer = new Swaf();
assertEquals(beer.getName(), Swaf.NAME);
assertEquals(beer.getPrice(), Swaf.PRICE);
}

@Test
void aBartenderShouldAcceptAnOrderForSwaf() {
Bartender jane = new Bartender();
String productName = "ch.heigvd.res.chill.domain.Otabiel.Swaf";
OrderRequest request = new OrderRequest(3, productName);
OrderResponse response = jane.order(request);
BigDecimal expectedTotalPrice = Swaf.PRICE.multiply(new BigDecimal(3));
assertEquals(expectedTotalPrice, response.getTotalPrice());
}
}