-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproperty_test.go
63 lines (55 loc) · 2.52 KB
/
property_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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package core
import (
"github.com/stretchr/testify/assert"
"testing"
)
func TestPropertySources_Add(t *testing.T) {
propertySources := NewPropertySources()
argPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Add(argPropertySource)
assert.Equal(t, argPropertySource, propertySources.GetPropertyResources()[0])
assert.Equal(t, 1, propertySources.GetSize())
}
func TestPropertySources_Get(t *testing.T) {
propertySources := NewPropertySources()
argPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Add(argPropertySource)
propertySource, ok := propertySources.Get(ProcyonApplicationCommandLinePropertySource)
assert.True(t, ok)
assert.Equal(t, argPropertySource, propertySource)
}
func TestPropertySources_GetSize(t *testing.T) {
propertySources := NewPropertySources()
argPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Add(argPropertySource)
assert.Equal(t, 1, propertySources.GetSize())
}
func TestPropertySources_Remove(t *testing.T) {
propertySources := NewPropertySources()
argPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Add(argPropertySource)
propertySources.Remove(ProcyonApplicationCommandLinePropertySource)
assert.Equal(t, 0, propertySources.GetSize())
}
func TestPropertySources_Replace(t *testing.T) {
propertySources := NewPropertySources()
argPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Add(argPropertySource)
anotherArgPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Replace(ProcyonApplicationCommandLinePropertySource, anotherArgPropertySource)
propertySource, _ := propertySources.Get(ProcyonApplicationCommandLinePropertySource)
assert.Equal(t, anotherArgPropertySource, propertySource)
}
func TestPropertySources_RemoveIfPresent(t *testing.T) {
propertySources := NewPropertySources()
argPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Add(argPropertySource)
propertySources.RemoveIfPresent(argPropertySource)
assert.Equal(t, 0, propertySources.GetSize())
}
func TestPropertySources_GetPropertyResources(t *testing.T) {
propertySources := NewPropertySources()
argPropertySource := NewSimpleCommandLinePropertySource(getTestApplicationArguments())
propertySources.Add(argPropertySource)
assert.Equal(t, 1, len(propertySources.GetPropertyResources()))
}