This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftedsw.testingbuilders; | |
import static org.hamcrest.Matchers.is; | |
import static org.junit.Assert.assertThat; | |
import static org.mockito.Matchers.anyString; | |
import static org.mockito.Mockito.verify; | |
import static org.mockito.Mockito.when; | |
import org.junit.Before; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Feature: Convert decimal numbers to roman numerals | |
Scenario Outline: Generate a roman numeral | |
Given a decimal number equal to <decimal_number> | |
When the roman numeral is generated | |
Then roman numeral should be <roman_numeral> | |
Examples: | |
| decimal_number | roman_numeral | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Story: Account Holder withdraws cash | |
As an Account Holder | |
I want to withdraw cash from an ATM | |
So that I can get money when the bank is closed | |
Scenario 1: Account has sufficient funds | |
Given the account balance is $100 | |
And the card is valid | |
And the machine contains enough money |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The Rules | |
1. One level of indentation per method | |
2. Don’t use the ELSE keyword | |
3. Wrap all primitives and Strings | |
4. First class collections | |
5. One dot per line | |
6. Don’t abbreviate | |
7. Keep all entities small (50 lines) | |
8. No classes with more than two instance variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Item { | |
private String name; | |
private int sellIn; | |
private int quality; | |
public Item(String name, int sellIn, int quality) { | |
this.setName(name); | |
this.setSellIn(sellIn); | |
this.setQuality(quality); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftedsw.gildedrose; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.Random; | |
import org.approvaltests.Approvals; | |
import org.junit.Before; | |
import org.junit.Test; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftedsw.testingbuilders; | |
import static org.craftedsw.testingbuilders.TradeBuilder.aTrade; | |
import static org.hamcrest.Matchers.is; | |
import static org.junit.Assert.assertThat; | |
import static org.mockito.Mockito.verify; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.mockito.Mock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftedsw.testingbuilders; | |
public class TradeBuilder { | |
private String inboundMessage; | |
private ReportabilityDecision reportabilityDecision; | |
public static TradeBuilder aTrade() { | |
return new TradeBuilder(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftedsw.testingbuilders; | |
public class Trade { | |
private String inboundMessage; | |
private ReportabilityDecision reportabilityDecision; | |
public String getInboundMessage() { | |
return this.inboundMessage; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.craftedsw.testingbuilders; | |
import static org.mockito.BDDMockito.given; | |
import static org.mockito.Mockito.verify; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.mockito.InjectMocks; | |
import org.mockito.Mock; | |
import org.mockito.Spy; |
NewerOlder