-
Notifications
You must be signed in to change notification settings - Fork 0
/
LabRats_for_test.go
47 lines (38 loc) · 1020 Bytes
/
LabRats_for_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 gosoon_test
import (
"gosoon"
)
type OnePrivateField struct {
phrase string
}
func (s OnePrivateField) getField() string {
return s.phrase
}
type ParsedJsonMockFactory struct {
NullValuedAttributes []string
AttributeToValueMappings map[string]string
}
func (self ParsedJsonMockFactory) Build() gosoon.ParsedJson {
return ParsedJsonMock{
attributeToValueMappings: self.AttributeToValueMappings,
nullValuedAttributes: self.NullValuedAttributes }
}
type ParsedJsonMock struct {
nullValuedAttributes []string
attributeToValueMappings map[string]string
}
func (self ParsedJsonMock) AttributeValue(key string) string {
item, ok := self.attributeToValueMappings[key]
if ok {
return item
}
return ""
}
func (self ParsedJsonMock) AttributeIsNull(attributeName string) bool {
for _, nullAttribute := range self.nullValuedAttributes {
if attributeName == nullAttribute {
return true
}
}
return false
}