diff --git a/.classpath b/.classpath index 9b67660..bcadf55 100644 --- a/.classpath +++ b/.classpath @@ -3,13 +3,9 @@ - - + + + + - - - - - - diff --git a/bin/halterman/command/Client.class b/bin/halterman/command/Client.class deleted file mode 100644 index e0e9024..0000000 Binary files a/bin/halterman/command/Client.class and /dev/null differ diff --git a/bin/halterman/command/Command.class b/bin/halterman/command/Command.class deleted file mode 100644 index a4d8382..0000000 Binary files a/bin/halterman/command/Command.class and /dev/null differ diff --git a/bin/halterman/command/CommandPatternTest.class b/bin/halterman/command/CommandPatternTest.class deleted file mode 100644 index eb109d6..0000000 Binary files a/bin/halterman/command/CommandPatternTest.class and /dev/null differ diff --git a/bin/halterman/command/Light.class b/bin/halterman/command/Light.class deleted file mode 100644 index fe45db9..0000000 Binary files a/bin/halterman/command/Light.class and /dev/null differ diff --git a/bin/halterman/command/LightOffCommand.class b/bin/halterman/command/LightOffCommand.class deleted file mode 100644 index 72f5198..0000000 Binary files a/bin/halterman/command/LightOffCommand.class and /dev/null differ diff --git a/bin/halterman/command/LightOnCommand.class b/bin/halterman/command/LightOnCommand.class deleted file mode 100644 index eb568fa..0000000 Binary files a/bin/halterman/command/LightOnCommand.class and /dev/null differ diff --git a/bin/halterman/command/Switch.class b/bin/halterman/command/Switch.class deleted file mode 100644 index 369c23e..0000000 Binary files a/bin/halterman/command/Switch.class and /dev/null differ diff --git a/build.gradle b/build.gradle index e142c04..0149d4f 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ sourceCompatibility = 1.5 version = '1.0' jar { manifest { - attributes 'Implementation-Title': 'Spring Vending Machine kata', 'Implementation-Version': version + attributes 'Implementation-Title': 'Design Patterns Gradle file', 'Implementation-Version': version } } diff --git a/src/halterman/command/Command.java b/src/halterman/command/Command.java deleted file mode 100644 index 9b8899a..0000000 --- a/src/halterman/command/Command.java +++ /dev/null @@ -1,6 +0,0 @@ -package halterman.command; - -//Command -public interface Command { - public void execute(); -} diff --git a/src/halterman/command/Light.java b/src/halterman/command/Light.java deleted file mode 100644 index 81428b9..0000000 --- a/src/halterman/command/Light.java +++ /dev/null @@ -1,17 +0,0 @@ -package halterman.command; - -//Receiver -public class Light { - private boolean on; - - public void switchOn() { - on = true; - System.out.println("Turned Light On."); - } - - public void switchOff() { - on = false; - System.out.println("Turned Light Off."); - } - -} diff --git a/src/halterman/command/LightOffCommand.java b/src/halterman/command/LightOffCommand.java deleted file mode 100644 index 61c9641..0000000 --- a/src/halterman/command/LightOffCommand.java +++ /dev/null @@ -1,19 +0,0 @@ -package halterman.command; - -//Concrete Command -public class LightOffCommand implements Command -{ - //reference to the light - Light light; - - public LightOffCommand(Light light) - { - this.light = light; - } - - public void execute() - { - light.switchOff(); - } - -} diff --git a/src/halterman/command/LightOnCommand.java b/src/halterman/command/LightOnCommand.java deleted file mode 100644 index 47697fd..0000000 --- a/src/halterman/command/LightOnCommand.java +++ /dev/null @@ -1,16 +0,0 @@ -package halterman.command; - -//Concrete Command -public class LightOnCommand implements Command { - // reference to the light - Light light; - - public LightOnCommand(Light light) { - this.light = light; - } - - public void execute() { - light.switchOn(); - } - -} diff --git a/src/halterman/command/RemoteControl.java b/src/halterman/command/RemoteControl.java deleted file mode 100644 index b170df9..0000000 --- a/src/halterman/command/RemoteControl.java +++ /dev/null @@ -1,15 +0,0 @@ -package halterman.command; - -//Invoker -public class RemoteControl { - private Command command; - - public void setCommand(Command command) { - this.command = command; - } - - public void pressButton() { - command.execute(); - } - -} diff --git a/src/halterman/command/Switch.java b/src/halterman/command/Switch.java deleted file mode 100644 index 790d2d2..0000000 --- a/src/halterman/command/Switch.java +++ /dev/null @@ -1,15 +0,0 @@ -package halterman.command; - -//Invoker -public class Switch { - private Command command; - - public void setCommand(Command command) { - this.command = command; - } - - public void pressButton() { - command.execute(); - } - -} diff --git a/test/halterman/command/CommandPatternTest.java b/test/halterman/command/CommandPatternTest.java index 3378b24..4842746 100644 --- a/test/halterman/command/CommandPatternTest.java +++ b/test/halterman/command/CommandPatternTest.java @@ -1,38 +1,6 @@ package halterman.command; -import static org.mockito.Mockito.verify; - -import org.junit.Before; -import org.junit.Test; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.Spy; - public class CommandPatternTest { - @InjectMocks - private Switch lightSwitch; - - @Mock - Light light; - - @Spy - Command lightsOn = new LightOnCommand(light); - - @Before - public void setUp() { - MockitoAnnotations.initMocks(this); - lightSwitch = new Switch(); - lightSwitch.setCommand(lightsOn); - } - - @Test - public void shouldTurnOnLight() { - lightSwitch.pressButton(); - - verify(light).switchOn(); - } - }