Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Edvard Fonsell committed Dec 2, 2014
1 parent 84e4f5a commit 3677865
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected AbstractWorkflowDefinition(String type, S initialState, S errorState)

protected AbstractWorkflowDefinition(String type, S initialState, S errorState, WorkflowSettings settings) {
Assert.notNull(initialState, "initialState must not be null");
Assert.isTrue(initialState.getType() == WorkflowStateType.start, "initial state must be a start state");
Assert.isTrue(initialState.getType() == WorkflowStateType.start, "initialState must be a start state");
Assert.notNull(errorState, "errorState must not be null");
Assert.isTrue(isStateFinal(errorState), "errorState must be a final state");
this.type = type;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ public void initialStateIsRequired() {
};
}

@Test
public void initialStateMustBeStartState() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("initialState must be a start state");
new WorkflowDefinition<TestDefinition.TestState>("nonStartInitialState", TestState.done, TestState.error) {
};
}

@Test
public void errorStateIsRequired() {
thrown.expect(IllegalArgumentException.class);
Expand All @@ -45,7 +53,7 @@ public void errorStateIsRequired() {
}

@Test
public void errorStateMustBeFinal() {
public void errorStateMustBeFinalState() {
thrown.expect(IllegalArgumentException.class);
thrown.expectMessage("errorState must be a final state");
new WorkflowDefinition<TestDefinition.TestState>("nonFinalErrorState", TestState.start1, TestState.start1) {
Expand Down

0 comments on commit 3677865

Please sign in to comment.