forked from makiuchi-d/gozxing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchecksum_exception_test.go
41 lines (35 loc) · 1011 Bytes
/
checksum_exception_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
package gozxing
import (
"errors"
"testing"
)
func TestChecksumException(t *testing.T) {
var e error = GetChecksumExceptionInstance()
if _, ok := e.(ChecksumException); !ok {
t.Fatalf("Type is not ChecksumException")
}
if _, ok := e.(ReaderException); !ok {
t.Fatalf("Type is not ReaderException")
}
if _, ok := e.(NotFoundException); ok {
t.Fatalf("Type must not be NotFoundException")
}
e.(ChecksumException).ChecksumException()
e.(ChecksumException).ReaderException()
}
func TestNewChecksumException(t *testing.T) {
base := errors.New("newchecksumexceptionstring")
var e error = NewChecksumExceptionInstance(base)
if _, ok := e.(ChecksumException); !ok {
t.Fatalf("Type is not ChecksumException")
}
if _, ok := e.(ReaderException); !ok {
t.Fatalf("Type is not ReaderException")
}
if _, ok := e.(NotFoundException); ok {
t.Fatalf("Type must not be NotFoundException")
}
if e.Error() != base.Error() {
t.Fatalf("e.Error() = %v, expect %v", e.Error(), base.Error())
}
}