func TestGetter(t *testing.T) { ctx := &Context{ Params: imageserver.Params{}, } var data []byte dest := groupcache.AllocatingByteSliceSink(&data) gt := &Getter{ Server: &imageserver.StaticServer{ Image: testdata.Medium, }, } err := gt.Get(ctx, "foo", dest) if err != nil { t.Fatal(err) } im := new(imageserver.Image) err = im.UnmarshalBinary(data) if err != nil { t.Fatal(err) } if !imageserver.ImageEqual(im, testdata.Medium) { t.Fatal("not equal") } }