private IssueUpdater updater;
private PropertiesDao propertiesDao;
private Settings settings;
-
private Actions actions;
private ActionService actionService;
@Before
- public void before(){
+ public void before() {
finder = mock(DefaultIssueFinder.class);
issueStorage = mock(IssueStorage.class);
updater = mock(IssueUpdater.class);
actions.add("link-to-jira").setConditions(new AlwaysMatch()).setFunctions(function);
try {
- actionService.execute("ABCD", "link-to-jira", mock(UserSession.class));
- } catch (Exception e){
- assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Issue is not found : ABCD");
+ actionService.execute("ABCD", "link-to-jira", mock(UserSession.class));
+ fail();
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("No issue");
}
verifyZeroInteractions(function);
}
actions.add("link-to-jira").setConditions(new AlwaysMatch()).setFunctions(function);
try {
actionService.execute("ABCD", "tweet", mock(UserSession.class));
- } catch (Exception e){
+ fail();
+ } catch (Exception e) {
assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Action is not found : tweet");
}
verifyZeroInteractions(function);
actions.add("link-to-jira").setConditions(new NeverMatch()).setFunctions(function);
try {
actionService.execute("ABCD", "link-to-jira", mock(UserSession.class));
- } catch (Exception e){
+ fail();
+ } catch (Exception e) {
assertThat(e).isInstanceOf(IllegalStateException.class).hasMessage("A condition is not respected");
}
verifyZeroInteractions(function);
try {
actionService.listAvailableActions("ABCD");
fail();
- } catch (Exception e){
- assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("Issue is not found : ABCD");
+ } catch (Exception e) {
+ assertThat(e).isInstanceOf(IllegalArgumentException.class).hasMessage("No issue");
}
}
public class TweetFunction implements Function {
@Override
public void execute(Context context) {
- context.addComment("New tweet on issue "+ context.issue().key());
+ context.addComment("New tweet on issue " + context.issue().key());
context.setAttribute("tweet", "tweet sent");
}
}