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 add yukimidaifuku #489

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

This file was deleted.

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

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

import java.math.BigDecimal;

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

@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,16 @@
package ch.heigvd.res.chill.domain.RengokuryuuHonokaCrimsonflame;

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

import java.math.BigDecimal;

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

@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,32 @@
package ch.heigvd.res.chill.domain.RengokuryuuHonokaCrimsonFlame;

import ch.heigvd.res.chill.domain.Bartender;
import ch.heigvd.res.chill.domain.RengokuryuuHonokaCrimsonflame.Crackers;
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 CrackersTest {

@Test
void thePriceAndTheNameForCrackersShouldBeCorrect(){
Crackers snack = new Crackers();
assertEquals(snack.getName(), Crackers.NAME);
assertEquals(snack.getPrice(), Crackers.PRICE);
}

@Test
void aBartenderShouldAcceptAnOrderForCrackers(){
Bartender rikako = new Bartender();
String productName = "ch.heigvd.res.chill.domain.RengokuryuuHonokaCrimsonflame.Crackers";
OrderRequest request = new OrderRequest(10, productName);
OrderResponse response = rikako.order(request);
BigDecimal exceptedTotalPrice = Crackers.PRICE.multiply(new BigDecimal(10));
assertEquals(exceptedTotalPrice,response.getTotalPrice());
}

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

import ch.heigvd.res.chill.domain.Bartender;
import ch.heigvd.res.chill.domain.RengokuryuuHonokaCrimsonflame.Yukimidaifuku;
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 YukimidaifukuTest {

@Test
void thePriceAndTheNameForYukimidaifukuShouldBeCorrect(){
Yukimidaifuku snack = new Yukimidaifuku();
assertEquals(snack.getName(), Yukimidaifuku.NAME);
assertEquals(snack.getPrice(), Yukimidaifuku.PRICE);
}

@Test
void aBartenderShouldAcceptAnOrderForYukimidaifuku(){
Bartender nanaka = new Bartender();
String productName = "ch.heigvd.res.chill.domain.RengokuryuuHonokaCrimsonflame.Yukimidaifuku";
OrderRequest request = new OrderRequest(12, productName);
OrderResponse response = nanaka.order(request);
BigDecimal exceptedTotalPrice = Yukimidaifuku.PRICE.multiply(new BigDecimal(12));
assertEquals(exceptedTotalPrice,response.getTotalPrice());
}

}