Documentation ¶
Index ¶
- Variables
- type Beach
- type BeachService
- type BeachServiceMock
- func (mock *BeachServiceMock) Broker() string
- func (mock *BeachServiceMock) BrokerCalls() []struct{}
- func (mock *BeachServiceMock) GetAll(ctx context.Context) []Beach
- func (mock *BeachServiceMock) GetAllCalls() []struct{ ... }
- func (mock *BeachServiceMock) GetByID(ctx context.Context, id string) (*Beach, error)
- func (mock *BeachServiceMock) GetByIDCalls() []struct{ ... }
- func (mock *BeachServiceMock) Refresh(contextMoqParam context.Context) (int, error)
- func (mock *BeachServiceMock) RefreshCalls() []struct{ ... }
- func (mock *BeachServiceMock) Shutdown(contextMoqParam context.Context)
- func (mock *BeachServiceMock) ShutdownCalls() []struct{ ... }
- func (mock *BeachServiceMock) Start(contextMoqParam context.Context)
- func (mock *BeachServiceMock) StartCalls() []struct{ ... }
- func (mock *BeachServiceMock) Tenant() string
- func (mock *BeachServiceMock) TenantCalls() []struct{}
- type WaterQuality
Constants ¶
This section is empty.
Variables ¶
var ErrNoSuchBeach error = errors.New("no such beach")
Functions ¶
This section is empty.
Types ¶
type Beach ¶
type Beach struct { ID string `json:"id"` Name string `json:"name"` Location domain.MultiPolygon `json:"location"` WaterQuality *[]WaterQuality `json:"waterquality,omitempty"` Description *string `json:"description,omitempty"` SeeAlso *[]string `json:"seeAlso,omitempty"` Source *string `json:"source,omitempty"` }
type BeachService ¶
type BeachService interface { Broker() string Tenant() string GetAll(ctx context.Context) []Beach GetByID(ctx context.Context, id string) (*Beach, error) Start(context.Context) Refresh(context.Context) (int, error) Shutdown(context.Context) }
func NewBeachService ¶
func NewBeachService(ctx context.Context, contextBrokerURL, tenant string, maxWQODistance int, wqsvc waterquality.WaterQualityService) BeachService
type BeachServiceMock ¶
type BeachServiceMock struct { // BrokerFunc mocks the Broker method. BrokerFunc func() string // GetAllFunc mocks the GetAll method. GetAllFunc func(ctx context.Context) []Beach // GetByIDFunc mocks the GetByID method. GetByIDFunc func(ctx context.Context, id string) (*Beach, error) // RefreshFunc mocks the Refresh method. RefreshFunc func(contextMoqParam context.Context) (int, error) // ShutdownFunc mocks the Shutdown method. ShutdownFunc func(contextMoqParam context.Context) // StartFunc mocks the Start method. StartFunc func(contextMoqParam context.Context) // TenantFunc mocks the Tenant method. TenantFunc func() string // contains filtered or unexported fields }
BeachServiceMock is a mock implementation of BeachService.
func TestSomethingThatUsesBeachService(t *testing.T) { // make and configure a mocked BeachService mockedBeachService := &BeachServiceMock{ BrokerFunc: func() string { panic("mock out the Broker method") }, GetAllFunc: func(ctx context.Context) []Beach { panic("mock out the GetAll method") }, GetByIDFunc: func(ctx context.Context, id string) (*Beach, error) { panic("mock out the GetByID method") }, RefreshFunc: func(contextMoqParam context.Context) (int, error) { panic("mock out the Refresh method") }, ShutdownFunc: func(contextMoqParam context.Context) { panic("mock out the Shutdown method") }, StartFunc: func(contextMoqParam context.Context) { panic("mock out the Start method") }, TenantFunc: func() string { panic("mock out the Tenant method") }, } // use mockedBeachService in code that requires BeachService // and then make assertions. }
func (*BeachServiceMock) Broker ¶
func (mock *BeachServiceMock) Broker() string
Broker calls BrokerFunc.
func (*BeachServiceMock) BrokerCalls ¶
func (mock *BeachServiceMock) BrokerCalls() []struct { }
BrokerCalls gets all the calls that were made to Broker. Check the length with:
len(mockedBeachService.BrokerCalls())
func (*BeachServiceMock) GetAll ¶
func (mock *BeachServiceMock) GetAll(ctx context.Context) []Beach
GetAll calls GetAllFunc.
func (*BeachServiceMock) GetAllCalls ¶
func (mock *BeachServiceMock) GetAllCalls() []struct { Ctx context.Context }
GetAllCalls gets all the calls that were made to GetAll. Check the length with:
len(mockedBeachService.GetAllCalls())
func (*BeachServiceMock) GetByIDCalls ¶
func (mock *BeachServiceMock) GetByIDCalls() []struct { Ctx context.Context ID string }
GetByIDCalls gets all the calls that were made to GetByID. Check the length with:
len(mockedBeachService.GetByIDCalls())
func (*BeachServiceMock) Refresh ¶
func (mock *BeachServiceMock) Refresh(contextMoqParam context.Context) (int, error)
Refresh calls RefreshFunc.
func (*BeachServiceMock) RefreshCalls ¶
func (mock *BeachServiceMock) RefreshCalls() []struct { ContextMoqParam context.Context }
RefreshCalls gets all the calls that were made to Refresh. Check the length with:
len(mockedBeachService.RefreshCalls())
func (*BeachServiceMock) Shutdown ¶
func (mock *BeachServiceMock) Shutdown(contextMoqParam context.Context)
Shutdown calls ShutdownFunc.
func (*BeachServiceMock) ShutdownCalls ¶
func (mock *BeachServiceMock) ShutdownCalls() []struct { ContextMoqParam context.Context }
ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:
len(mockedBeachService.ShutdownCalls())
func (*BeachServiceMock) Start ¶
func (mock *BeachServiceMock) Start(contextMoqParam context.Context)
Start calls StartFunc.
func (*BeachServiceMock) StartCalls ¶
func (mock *BeachServiceMock) StartCalls() []struct { ContextMoqParam context.Context }
StartCalls gets all the calls that were made to Start. Check the length with:
len(mockedBeachService.StartCalls())
func (*BeachServiceMock) Tenant ¶
func (mock *BeachServiceMock) Tenant() string
Tenant calls TenantFunc.
func (*BeachServiceMock) TenantCalls ¶
func (mock *BeachServiceMock) TenantCalls() []struct { }
TenantCalls gets all the calls that were made to Tenant. Check the length with:
len(mockedBeachService.TenantCalls())
type WaterQuality ¶
type WaterQuality struct { Temperature float64 `json:"temperature"` DateObserved string `json:"dateObserved"` Source *string `json:"source,omitempty"` }
func (WaterQuality) Age ¶
func (w WaterQuality) Age() time.Duration