Skip to content

Instantly share code, notes, and snippets.

@codingricky
codingricky / dius_shopping_coding.md
Last active June 25, 2019 17:09
DiUS Shopping Coding Exercise

DiUS is starting a computer store. You have been engaged to build the checkout system. We will start with the following products in our catalogue

SKU Name Price
ipd Super iPad $549.99
mbp MacBook Pro $1399.99
atv Apple TV $109.50
vga VGA adapter $30.00
@codingricky
codingricky / dius_bowling.md
Last active December 13, 2018 04:33
DiUS Bowling Exercise

DiUS is starting a bowling club. To help with the club, we have engaged you to program a scoring system.

The features on the system are:

  • One player only
  • In each frame, the bowler has 2 tries to knock down all the pins
  • If in 2 tries, the bowler fails to knock down all the pins, their score is the sum of the number of pins they've knocked down in the 2 attempts

E.g, if a bowler rolls, 4,4

@codingricky
codingricky / gist:6502931
Last active February 8, 2019 14:14
DiUS Tennis Exercise

DiUS is hosting a tennis tournament. To aid with this, we're developing a scoring system.

The scoring system for tennis works like this.

  • A match has one set and a set has many games

  • A game is won by the first player to have won at least 4 points in total and at least 2 points more than the opponent.

    • The running score of each game is described in a manner peculiar to tennis: scores from zero to three points are described as 0, 15, 30, 40, respectively
name := "sample-with-cucumber"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache
"info.cukes" % "cucumber-java" % "1.1.5" % "test",
"info.cukes" % "cucumber-junit" % "1.1.5" % "test"
)
name := "sample-with-cucumber"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache
"info.cukes" % "cucumber-java" % "1.1.5" % "test",
"info.cukes" % "cucumber-junit" % "1.1.5" % "test"
)
Feature: Testing Cucumber Integration
Scenario: Cucumber Integration
Given I have setup Play
When I go to the landing page
Then the title should be "Cucumber"
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
@RunWith(Cucumber.class)
@Cucumber.Options(format = {"pretty"})
public class RunCucumber {
}
...
You can implement missing steps with the snippets below:
@Given("^I have setup Play$")
public void I_have_setup_Play() throws Throwable {
// Express the Regexp above with the code you wish you had
throw new PendingException();
}
@When("^I go to the landing page$")