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

First version of bartender greetings #231

Open
wants to merge 1 commit 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
7 changes: 7 additions & 0 deletions chill.iml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,12 @@
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.4.0" level="project" />
<orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.2" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.0.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.1.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-engine:5.4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-engine:1.4.0" level="project" />
</component>
</module>
23 changes: 2 additions & 21 deletions src/main/java/ch/heigvd/res/chill/domain/Bartender.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
package ch.heigvd.res.chill.domain;

import ch.heigvd.res.chill.protocol.GreetingsRequest;
import ch.heigvd.res.chill.protocol.GreetingsResponse;
import ch.heigvd.res.chill.protocol.OrderRequest;
import ch.heigvd.res.chill.protocol.OrderResponse;

import java.math.BigDecimal;

public class Bartender {

public GreetingsResponse greet(GreetingsRequest request) {
return new GreetingsResponse("hello, how can I help you?");
}

public OrderResponse order(OrderRequest request) {
String productName = request.getProductName();

try {
// let Java reflection do its magic
IProduct product = (IProduct) Class.forName(productName).newInstance();
BigDecimal totalPrice = product.getPrice().multiply(new BigDecimal(request.getQuantity()));
return new OrderResponse(totalPrice);
} catch (Exception e) {
return null;
public String great(String message) {
return "hello, how can help you?";
}
}

}
21 changes: 0 additions & 21 deletions src/main/java/ch/heigvd/res/chill/domain/wasadigi/Boxer.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/ch/heigvd/res/chill/domain/wasadigi/Duvel.java

This file was deleted.

21 changes: 0 additions & 21 deletions src/main/java/ch/heigvd/res/chill/domain/wasadigi/PunkIPA.java

This file was deleted.

10 changes: 0 additions & 10 deletions src/main/java/ch/heigvd/res/chill/protocol/GreetingsRequest.java

This file was deleted.

10 changes: 0 additions & 10 deletions src/main/java/ch/heigvd/res/chill/protocol/GreetingsResponse.java

This file was deleted.

11 changes: 0 additions & 11 deletions src/main/java/ch/heigvd/res/chill/protocol/OrderRequest.java

This file was deleted.

12 changes: 0 additions & 12 deletions src/main/java/ch/heigvd/res/chill/protocol/OrderResponse.java

This file was deleted.

18 changes: 7 additions & 11 deletions src/test/java/ch/heigvd/res/chill/domain/BartenderTest.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
package ch.heigvd.res.chill.domain;

import ch.heigvd.res.chill.protocol.GreetingsRequest;
import ch.heigvd.res.chill.protocol.GreetingsResponse;
import org.junit.jupiter.api.Test;

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

class BartenderTest {

@Test
void aBartenderShouldReplyToGreetings() {
Bartender john = new Bartender();
GreetingsRequest request = new GreetingsRequest("Hi there");
GreetingsResponse response = john.greet(request);
assertEquals("hello, how can I help you?", response.getText());
}

@Test
void aBartenderShouldReplyToGreetings() {
Bartender jhon = new Bartender();
String response = jhon.great("hello");
assertEquals("hello, how can help you?", response);
}
}
31 changes: 0 additions & 31 deletions src/test/java/ch/heigvd/res/chill/domain/wasadigi/BoxerTest.java

This file was deleted.

31 changes: 0 additions & 31 deletions src/test/java/ch/heigvd/res/chill/domain/wasadigi/DuvelTest.java

This file was deleted.

31 changes: 0 additions & 31 deletions src/test/java/ch/heigvd/res/chill/domain/wasadigi/PunkIPATest.java

This file was deleted.