-
Notifications
You must be signed in to change notification settings - Fork 0
/
event_test.go
38 lines (32 loc) · 1.4 KB
/
event_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
package context
import (
"github.com/stretchr/testify/assert"
"testing"
)
func testApplicationContextEvent(t *testing.T, event ApplicationContextEvent, eventId ApplicationEventId, parentEventId ApplicationEventId) {
assert.Equal(t, eventId, event.GetEventId())
assert.Equal(t, parentEventId, event.GetParentEventId())
assert.NotEqual(t, 0, event.GetTimestamp())
assert.NotNil(t, event.GetSource())
assert.NotNil(t, event.GetApplicationContext())
}
func TestApplicationContextStartedEvent(t *testing.T) {
context := &testContext{}
event := NewApplicationContextStartedEvent(context)
testApplicationContextEvent(t, event, ApplicationContextStartedEventId(), ApplicationContextEventId())
}
func TestApplicationContextRefreshedEvent(t *testing.T) {
context := &testContext{}
event := NewApplicationContextRefreshedEvent(context)
testApplicationContextEvent(t, event, ApplicationContextRefreshedEventId(), ApplicationContextEventId())
}
func TestApplicationContextStoppedEvent(t *testing.T) {
context := &testContext{}
event := NewApplicationContextStoppedEvent(context)
testApplicationContextEvent(t, event, ApplicationContextStoppedEventId(), ApplicationContextEventId())
}
func TestApplicationContextClosedEvent(t *testing.T) {
context := &testContext{}
event := NewApplicationContextClosedEvent(context)
testApplicationContextEvent(t, event, ApplicationContextClosedEventId(), ApplicationContextEventId())
}