github.com/cloudfoundry/cli@v7.1.0+incompatible/actor/actionerror/service_not_found_error_test.go (about) 1 package actionerror_test 2 3 import ( 4 "code.cloudfoundry.org/cli/actor/actionerror" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 ) 8 9 var _ = Describe("ServiceNotFoundError", func() { 10 It("returns a message with the service offering and broker name", func() { 11 err := actionerror.ServiceNotFoundError{ 12 Name: "some-service-offering", 13 Broker: "some-broker", 14 } 15 Expect(err.Error()).To(Equal("Service offering 'some-service-offering' for service broker 'some-broker' not found.")) 16 }) 17 18 When("there is no broker name", func() { 19 It("does not mention the broker in the message", func() { 20 err := actionerror.ServiceNotFoundError{ 21 Name: "some-service-offering", 22 } 23 Expect(err.Error()).To(Equal("Service offering 'some-service-offering' not found.")) 24 }) 25 }) 26 27 When("there is no service offering name", func() { 28 It("does not mention the service offering in the message", func() { 29 err := actionerror.ServiceNotFoundError{ 30 Broker: "some-broker", 31 } 32 Expect(err.Error()).To(Equal("No service offerings found for service broker 'some-broker'.")) 33 }) 34 }) 35 36 When("there are no names", func() { 37 It("does not mention any names in the message", func() { 38 err := actionerror.ServiceNotFoundError{} 39 Expect(err.Error()).To(Equal("No service offerings found.")) 40 }) 41 }) 42 })