Skip to content

Commit 1439a3a

Browse files
committed
With prefix makes it more readable
1 parent f26433c commit 1439a3a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

creational/fluent_builder.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ func NewEmployeeBuilder() *EmployeeBuilder {
3131
return &EmployeeBuilder{}
3232
}
3333

34-
func (c *EmployeeBuilder) Called(name string) *EmployeeBuilder {
34+
func (c *EmployeeBuilder) WithName(name string) *EmployeeBuilder {
3535
c.name = name
3636
return c
3737
}
38-
func (c *EmployeeBuilder) WorksAt(company string) *EmployeeBuilder {
38+
func (c *EmployeeBuilder) WithCompany(company string) *EmployeeBuilder {
3939
c.company = company
4040
return c
4141
}
42-
func (c *EmployeeBuilder) At(address string) *EmployeeBuilder {
42+
func (c *EmployeeBuilder) WithAddress(address string) *EmployeeBuilder {
4343
c.address = address
4444
return c
4545
}

creational/fluent_builder_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ func TestFluentBuilder(t *testing.T) {
2727
tc = tc
2828
builder := NewEmployeeBuilder()
2929
got := builder.
30-
Called(tc.name).
31-
WorksAt(tc.company).
32-
At(tc.address).
30+
WithName(tc.name).
31+
WithCompany(tc.company).
32+
WithAddress(tc.address).
3333
Build()
3434
assert.Equal(t, tc.expected, got)
3535
}

0 commit comments

Comments
 (0)