-
Notifications
You must be signed in to change notification settings - Fork 0
/
environment_test.go
36 lines (30 loc) · 1.52 KB
/
environment_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
package core
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestStandardEnvironment_ContainsProperty(t *testing.T) {
standardEnvironment := NewStandardEnvironment()
standardEnvironment.GetPropertySources().Add(NewSimpleCommandLinePropertySource(getTestApplicationArguments()))
assert.True(t, standardEnvironment.ContainsProperty("procyon.application.name"))
assert.False(t, standardEnvironment.ContainsProperty("procyon.server.timeout"))
}
func TestStandardEnvironment_GetProperty(t *testing.T) {
standardEnvironment := NewStandardEnvironment()
standardEnvironment.GetPropertySources().Add(NewSimpleCommandLinePropertySource(getTestApplicationArguments()))
assert.NotNil(t, standardEnvironment.GetProperty("procyon.application.name", "default value"))
assert.Equal(t, "default value", standardEnvironment.GetProperty("procyon.server.timeout", "default value"))
}
func TestStandardEnvironment_GetPropertySources(t *testing.T) {
standardEnvironment := NewStandardEnvironment()
standardEnvironment.GetPropertySources().Add(NewSimpleCommandLinePropertySource(getTestApplicationArguments()))
assert.Equal(t, 1, standardEnvironment.GetPropertySources().GetSize())
}
func TestStandardEnvironment_GetSystemEnvironment(t *testing.T) {
standardEnvironment := NewStandardEnvironment()
assert.NotNil(t, standardEnvironment.GetSystemEnvironment())
}
func TestStandardEnvironment_GetTypeConverterService(t *testing.T) {
standardEnvironment := NewStandardEnvironment()
assert.NotNil(t, standardEnvironment.GetTypeConverterService())
}