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

Add the beer krush #54

Open
wants to merge 3 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
21 changes: 21 additions & 0 deletions src/main/java/ch/heigvd/res/chill/domain/lohaheigvd/ClubMate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ch.heigvd.res.chill.domain.lohaheigvd;

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

import java.math.BigDecimal;

public class ClubMate implements IProduct {

public final static String NAME = "ClubMate";
public final static BigDecimal PRICE = new BigDecimal(2.0);

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

@Override
public BigDecimal getPrice() {
return PRICE;
}
}
21 changes: 21 additions & 0 deletions src/main/java/ch/heigvd/res/chill/domain/lohaheigvd/Fifty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ch.heigvd.res.chill.domain.lohaheigvd;

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

import java.math.BigDecimal;

public class Fifty implements IProduct {

public final static String NAME = "Fifty";
public final static BigDecimal PRICE = new BigDecimal(2.0);

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

@Override
public BigDecimal getPrice() {
return PRICE;
}
}
21 changes: 21 additions & 0 deletions src/main/java/ch/heigvd/res/chill/domain/lohaheigvd/Krush.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ch.heigvd.res.chill.domain.lohaheigvd;

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

import java.math.BigDecimal;

public class Krush implements IProduct {

public final static String NAME = "Krush";
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,31 @@
package ch.heigvd.res.chill.domain.lohaheigvd;

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 ClubMateTest {

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

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

}
31 changes: 31 additions & 0 deletions src/test/java/ch/heigvd/res/chill/domain/lohaheigvd/FiftyTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package ch.heigvd.res.chill.domain.lohaheigvd;

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 FiftyTest {

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

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

}
31 changes: 31 additions & 0 deletions src/test/java/ch/heigvd/res/chill/domain/lohaheigvd/KrushTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package ch.heigvd.res.chill.domain.lohaheigvd;

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 KrushTest {

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

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

}