From 284c1530a15fce030a8fa7df6b51ce89c478f625 Mon Sep 17 00:00:00 2001 From: Mihai Andronache Date: Tue, 22 Aug 2017 21:15:56 +0300 Subject: [PATCH] fixes --- .../amihaiemil/charles/github/StepsTree.java | 23 ++++--------------- .../charles/github/StepsTestCase.java | 2 +- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/amihaiemil/charles/github/StepsTree.java b/src/main/java/com/amihaiemil/charles/github/StepsTree.java index 7be5e07..55802d8 100644 --- a/src/main/java/com/amihaiemil/charles/github/StepsTree.java +++ b/src/main/java/com/amihaiemil/charles/github/StepsTree.java @@ -48,12 +48,7 @@ public final class StepsTree implements Steps { * Initial command. */ private Command com; - - /** - * Action logger. - */ - private Logger logger; - + /** * Message to send in case some step fails. */ @@ -67,7 +62,7 @@ public final class StepsTree implements Steps { */ public StepsTree(Step steps, Command command, LogsLocation logs) { this( - steps, command, logs, + steps, command, new SendReply( new TextReply( command, @@ -88,20 +83,12 @@ public StepsTree(Step steps, Command command, LogsLocation logs) { * @param logs Logs' location. * @param fm Failure message. */ - public StepsTree(Step steps, Command command, LogsLocation logs, SendReply fm) { + public StepsTree(Step steps, Command command, SendReply fm) { this.steps = steps; this.com = command; this.failureMessage = fm; } - /** - * Return the steps to perform. - * @return - */ - public Step getStepsToPerform() { - return this.steps; - } - /** * Perform all the given steps. * @param logger Action logger. @@ -110,11 +97,11 @@ public Step getStepsToPerform() { public void perform(Logger logger) throws IOException { try { String commandBody = this.com.json().getString("body"); - this.logger.info("Received command: " + commandBody); + logger.info("Received command: " + commandBody); this.steps.perform(this.com, logger); } catch (Exception ex) { logger.error("An exception occured, sending failure comment...", ex); - this.failureMessage.perform(this.com, this.logger); + this.failureMessage.perform(this.com, logger); } } diff --git a/src/test/java/com/amihaiemil/charles/github/StepsTestCase.java b/src/test/java/com/amihaiemil/charles/github/StepsTestCase.java index 9b3889f..083f6b1 100644 --- a/src/test/java/com/amihaiemil/charles/github/StepsTestCase.java +++ b/src/test/java/com/amihaiemil/charles/github/StepsTestCase.java @@ -84,7 +84,7 @@ public void stepsFail() throws Exception { Mockito.doThrow(new IllegalStateException("for test")) .when(s).perform(com, logger); - Steps steps = new StepsTree(s, com, Mockito.mock(LogsLocation.class), sr); + Steps steps = new StepsTree(s, com, sr); steps.perform(logger); List comments = Lists.newArrayList(com.issue().comments().iterate());