mirror of
https://github.com/crazybber/go-pattern-examples.git
synced 2024-11-26 13:46:03 +03:00
24 lines
470 B
Go
24 lines
470 B
Go
package builder
|
|
|
|
import "testing"
|
|
|
|
func TestBuilder1(t *testing.T) {
|
|
builder := &Builder1{}
|
|
director := NewDirector(builder)
|
|
director.Construct()
|
|
res := builder.GetResult()
|
|
if res != "123" {
|
|
t.Fatalf("Builder1 fail expect 123 acture %s", res)
|
|
}
|
|
}
|
|
|
|
func TestBuilder2(t *testing.T) {
|
|
builder := &Builder2{}
|
|
director := NewDirector(builder)
|
|
director.Construct()
|
|
res := builder.GetResult()
|
|
if res != 6 {
|
|
t.Fatalf("Builder2 fail expect 6 acture %d", res)
|
|
}
|
|
}
|