Skip to content

Instantly share code, notes, and snippets.

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