Expect(fakeCloudControllerClient.GetSharedDomainCallCount()).To(Equal(1)) Expect(fakeCloudControllerClient.GetSharedDomainArgsForCall(0)).To(Equal("shared-domain-guid")) }) }) Context("when the domain exists and is a private domain", func() { var expectedDomain ccv2.Domain BeforeEach(func() { expectedDomain = ccv2.Domain{ GUID: "private-domain-guid", Name: "private-domain", } fakeCloudControllerClient.GetSharedDomainReturns(ccv2.Domain{}, nil, ccv2.ResourceNotFoundError{}) fakeCloudControllerClient.GetPrivateDomainReturns(expectedDomain, nil, nil) }) It("returns the private domain", func() { domain, _, err := actor.GetDomain("private-domain-guid") Expect(err).NotTo(HaveOccurred()) Expect(domain).To(Equal(Domain(expectedDomain))) Expect(fakeCloudControllerClient.GetSharedDomainCallCount()).To(Equal(1)) Expect(fakeCloudControllerClient.GetSharedDomainArgsForCall(0)).To(Equal("private-domain-guid")) Expect(fakeCloudControllerClient.GetPrivateDomainCallCount()).To(Equal(1)) Expect(fakeCloudControllerClient.GetPrivateDomainArgsForCall(0)).To(Equal("private-domain-guid")) }) }) Context("when the domain does not exist", func() {