blob: 1abbb55d107b526ec78db8f3b6df8c773c010d61 (
plain)
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
|
package amqp
import (
json "github.com/json-iterator/go"
"github.com/spiral/roadrunner/service"
"github.com/stretchr/testify/assert"
"testing"
)
type mockCfg struct{ cfg string }
func (cfg *mockCfg) Get(name string) service.Config { return nil }
func (cfg *mockCfg) Unmarshal(out interface{}) error { return json.Unmarshal([]byte(cfg.cfg), out) }
func Test_Config_Hydrate_Error(t *testing.T) {
cfg := &mockCfg{`{"dead`}
c := &Config{}
assert.Error(t, c.Hydrate(cfg))
}
func Test_Config_Hydrate_Error2(t *testing.T) {
cfg := &mockCfg{`{"addr":""}`}
c := &Config{}
assert.Error(t, c.Hydrate(cfg))
}
|