...
1 package emperror
2
3 import (
4 "errors"
5 "testing"
6 )
7
8 func TestCompositeHandler(t *testing.T) {
9 handler1 := NewTestHandler()
10 handler2 := NewTestHandler()
11
12 handler := NewCompositeHandler(handler1, handler2)
13
14 err := errors.New("error")
15
16 handler.Handle(err)
17
18 if got, want := handler1.LastError(), err; got != want {
19 t.Errorf("error does not match the expected one\nactual: %s\nexpected: %s", got, want)
20 }
21
22 if got, want := handler1.LastError(), err; got != want {
23 t.Errorf("error does not match the expected one\nactual: %s\nexpected: %s", got, want)
24 }
25 }
26
View as plain text