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 math; | |
class Counter { | |
private int counter; | |
Counter() { | |
counter = 0; | |
} |
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
@Test | |
public void whenDecrementTwice_thenCounterIsMinusTwo() { | |
final int expected = -2; | |
final int actual = sut.decrement().decrement().getCounter(); | |
assertEquals(expected, actual); | |
} |
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 pet; | |
class Dog { | |
private static final String DEFAULT_NAME = "Spot"; | |
private String name; | |
Dog(String name) { | |
if (null == name) { |
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
Dog(String name) { | |
this.name = DEFAULT_NAME; | |
} |
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
class Coordinate | |
attr_accessor :id, :x, :y, :area, :blacklisted | |
def initialize(x, y, id) | |
@id = id | |
@x = x | |
@y = y | |
@area = 0 | |
@blacklisted = false |
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
class Coordinate | |
attr_accessor :id, :x, :y, :area, :blacklisted | |
def initialize(x, y, id) | |
@id = id | |
@x = x | |
@y = y | |
@area = 0 | |
@blacklisted = false |