Routes: routes, } b, err := json.Marshal(update) Expect(err).NotTo(HaveOccurred()) err = json.Unmarshal(b, &aJson) Expect(err).NotTo(HaveOccurred()) b, err = proto.Marshal(&update) Expect(err).NotTo(HaveOccurred()) err = proto.Unmarshal(b, &aProto) Expect(err).NotTo(HaveOccurred()) }) It("marshals JSON properly", func() { Expect(update.Equal(&aJson)).To(BeTrue()) Expect(update).To(Equal(aJson)) }) It("marshals Proto properly", func() { Expect(update.Equal(&aProto)).To(BeTrue()) Expect(update).To(Equal(aProto)) }) } itSerializes(nil) itSerializes(&models.Routes{ "abc": &(json.RawMessage{'"', 'd', '"'}), "def": &(json.RawMessage{'"', 'g', '"'}), }) })