github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/api/cloudcontroller/ccerror/service_offering_not_found_error_test.go (about) 1 package ccerror_test 2 3 import ( 4 "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" 5 . "github.com/onsi/ginkgo" 6 . "github.com/onsi/gomega" 7 ) 8 9 var _ = Describe("ServiceOfferingNotFoundError", func() { 10 It("returns a message with the service offering and broker name", func() { 11 err := ccerror.ServiceOfferingNotFoundError{ 12 ServiceOfferingName: "some-service-offering", 13 ServiceBrokerName: "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 := ccerror.ServiceOfferingNotFoundError{ 21 ServiceOfferingName: "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 := ccerror.ServiceOfferingNotFoundError{ 30 ServiceBrokerName: "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 := ccerror.ServiceOfferingNotFoundError{} 39 Expect(err.Error()).To(Equal("No service offerings found.")) 40 }) 41 }) 42 })