-
Notifications
You must be signed in to change notification settings - Fork 1
/
fields_key_spec_test.go
47 lines (35 loc) · 1.01 KB
/
fields_key_spec_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
package native
import (
"testing"
"github.com/echocat/slf4g/fields"
"github.com/echocat/slf4g/internal/test/assert"
)
func Test_FieldKeysSpecImpl_GetLocation_specified(t *testing.T) {
instance := &FieldKeysSpecImpl{Location: "foo"}
actual := instance.GetLocation()
assert.ToBeEqual(t, "foo", actual)
}
func Test_FieldKeysSpecImpl_GetLocation_default(t *testing.T) {
instance := &FieldKeysSpecImpl{}
actual := instance.GetLocation()
assert.ToBeEqual(t, "location", actual)
}
func Test_NewFieldKeysSpecFacade(t *testing.T) {
delegate := &FieldKeysSpecImpl{
KeysSpecImpl: fields.KeysSpecImpl{
Timestamp: "a",
Message: "b",
Logger: "c",
Error: "d",
},
Location: "e",
}
actual := NewFieldKeysSpecFacade(func() FieldKeysSpec {
return delegate
})
assert.ToBeEqual(t, "a", actual.GetTimestamp())
assert.ToBeEqual(t, "b", actual.GetMessage())
assert.ToBeEqual(t, "c", actual.GetLogger())
assert.ToBeEqual(t, "d", actual.GetError())
assert.ToBeEqual(t, "e", actual.GetLocation())
}