-
Notifications
You must be signed in to change notification settings - Fork 21
/
errors_test.go
58 lines (45 loc) · 1.19 KB
/
errors_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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package goselenium
import (
"errors"
"testing"
)
func communicationError() error {
return newCommunicationError(errors.New(":<"), "Test", "", nil)
}
func sessionError() error {
return newSessionIDError("Test")
}
func unmarshallingError() error {
return newUnmarshallingError(errors.New(":<"), "Test", "")
}
func marshallingError() error {
return newMarshallingError(errors.New(":<"), "Test", "test")
}
func Test_Errors_CommunicationErrorCanBeCastSuccessfully(t *testing.T) {
e := communicationError()
back, ok := e.(CommunicationError)
if !ok || back.method != "Test" {
t.Errorf("Could not assert error")
}
}
func Test_Errors_SessionErrorCanBeCastSuccessfully(t *testing.T) {
e := sessionError()
_, ok := e.(SessionIDError)
if !ok {
t.Errorf("Could not assert error")
}
}
func Test_Errors_UnmarshallingErrorCanBeCastSuccessfully(t *testing.T) {
e := unmarshallingError()
body, ok := e.(UnmarshallingError)
if !ok || body.method != "Test" {
t.Errorf("Could not assert error")
}
}
func Test_Errors_MarshallingErrorCanBeCastSuccessfully(t *testing.T) {
e := marshallingError()
body, ok := e.(MarshallingError)
if !ok || body.method != "Test" {
t.Errorf("Could not assert error")
}
}