github.com/mantzas/incata@v0.3.0/mocks/serializer.go (about) 1 package mocks 2 3 import ( 4 "errors" 5 ) 6 7 // TestSerializer mock 8 type TestSerializer struct { 9 Failure bool 10 } 11 12 // Serialize mock 13 func (s TestSerializer) Serialize(value interface{}) (ret interface{}, err error) { 14 15 if s.Failure { 16 err = errors.New("serialization error") 17 } else { 18 ret = "Test Value" 19 } 20 return 21 }