-
Notifications
You must be signed in to change notification settings - Fork 11
/
err_test.go
39 lines (34 loc) · 1009 Bytes
/
err_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package easyfsm
import (
"strconv"
"testing"
)
func TestUnKnownBusinessError_Error(t *testing.T) {
businessName := BusinessName("order")
e := UnKnownBusinessError{businessName: businessName}
if e.Error() != string(businessName)+"is not registered" {
t.Error("UnKnownBusinessError mismatch")
}
}
func TestUnKnownEventError_Error(t *testing.T) {
businessName := BusinessName("order")
state := State(1)
event := EventName("pay")
e := UnKnownEventError{businessName: businessName, state: state, event: event}
if e.Error() != string(businessName)+"Not included event:"+
string(event)+" in state:"+strconv.Itoa(int(state)) {
t.Errorf("UnKnownEventError mismatch")
}
}
func TestUnKnownStateError_Error(t *testing.T) {
businessName := BusinessName("order")
state := State(1)
e := UnKnownStateError{
businessName: businessName,
state: state,
}
if e.Error() != string(businessName)+"Not included state:"+
strconv.Itoa(int(state)) {
t.Errorf("UnKnownStateError mismatch")
}
}