Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
amihaiemil committed Aug 22, 2017
1 parent f4e0b9f commit 284c153
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 19 deletions.
23 changes: 5 additions & 18 deletions src/main/java/com/amihaiemil/charles/github/StepsTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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,
Expand All @@ -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.
Expand All @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Comment> comments = Lists.newArrayList(com.issue().comments().iterate());
Expand Down

0 comments on commit 284c153

Please sign in to comment.