Skip to content

Commit

Permalink
makes stub struct public by changing its name to StubElement, fixes b…
Browse files Browse the repository at this point in the history
…uild error created by dot import of responses package
  • Loading branch information
alperkose committed Feb 8, 2016
1 parent 37e301b commit a91371d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
14 changes: 7 additions & 7 deletions builders/imposter.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
package builders

type Imposter struct {
Protocol string `json:"protocol"`
Port int `json:"port,omitempty"`
Name string `json:"name,omitempty"`
Mode string `json:"mode,omitempty"`
Stubs []stub `json:"stubs,omitempty"`
Protocol string `json:"protocol"`
Port int `json:"port,omitempty"`
Name string `json:"name,omitempty"`
Mode string `json:"mode,omitempty"`
Stubs []StubElement `json:"stubs,omitempty"`
}

type ImposterBuilder struct {
protocol string
port int
name string
mode string
stubs []stub
stubs []StubElement
}

func (builder *ImposterBuilder) Protocol(protocol string) *ImposterBuilder {
Expand All @@ -40,7 +40,7 @@ func (builder *ImposterBuilder) Mode(mode string) *ImposterBuilder {
return builder
}

func (builder *ImposterBuilder) Stubs(stubs ...stub) *ImposterBuilder {
func (builder *ImposterBuilder) Stubs(stubs ...StubElement) *ImposterBuilder {
builder.stubs = stubs

return builder
Expand Down
32 changes: 17 additions & 15 deletions builders/stub.go
Original file line number Diff line number Diff line change
@@ -1,39 +1,41 @@
package builders

import . "github.com/durmaze/gobank/predicates"
import . "github.com/durmaze/gobank/responses"

type stub struct {
Responses []Response `json:"responses"`
Predicates []Predicate `json:"predicates"`
import (
"github.com/durmaze/gobank/predicates"
"github.com/durmaze/gobank/responses"
)

type StubElement struct {
Responses []responses.Response `json:"responses"`
Predicates []predicates.Predicate `json:"predicates"`
}

type stubBuilder struct {
responses []Response
predicates []Predicate
responses []responses.Response
predicates []predicates.Predicate
}

type StubBuilder interface {
Responses(...Response) StubBuilder
Predicates(...Predicate) StubBuilder
Responses(...responses.Response) StubBuilder
Predicates(...predicates.Predicate) StubBuilder

Build() stub
Build() StubElement
}

func (builder *stubBuilder) Responses(responses ...Response) StubBuilder {
func (builder *stubBuilder) Responses(responses ...responses.Response) StubBuilder {
builder.responses = responses

return builder
}

func (builder *stubBuilder) Predicates(predicates ...Predicate) StubBuilder {
func (builder *stubBuilder) Predicates(predicates ...predicates.Predicate) StubBuilder {
builder.predicates = predicates

return builder
}

func (builder *stubBuilder) Build() stub {
return stub{
func (builder *stubBuilder) Build() StubElement {
return StubElement{
Responses: builder.responses,
Predicates: builder.predicates,
}
Expand Down

0 comments on commit a91371d

Please sign in to comment.