func TestUrlBasedRetrieve_InvalidResponseFailure(t *testing.T) {
	defer gock.Off()
	gock.New("http://localhost").
		Get("/endpoint/__ids").
		Reply(200).BodyString("Invalid response")
	expectedError := errors.New("ERROR - invalid character 'I' looking for beginning of value")

	retriever := newURLBasedIDListRetriever("http://localhost/endpoint/", http.DefaultClient)
	var idsChan = make(chan string)
	var errChan = make(chan error)

	go retriever.Retrieve(idsChan, errChan)

	for idsChan != nil {
		select {
		case _, ok := <-idsChan:
			if !ok {
				idsChan = nil
			}
		case actualError := <-errChan:
			if expectedError != actualError {
				st.Expect(t, expectedError, actualError)
			}
			return
		}
	}

	st.Expect(t, gock.IsDone(), true)
}
func TestUrlBasedRetrieve_Success(t *testing.T) {
	defer gock.Off()
	gock.New("http://localhost").
		Get("/endpoint/__ids").
		Reply(200).
		JSON(map[string]string{"id": "c0de16de-00e6-3d52-aca5-c2a300cd1144"})

	var expectedIds []string
	expectedIds = append(expectedIds, "c0de16de-00e6-3d52-aca5-c2a300cd1144")

	retriever := newURLBasedIDListRetriever("http://localhost/endpoint/", http.DefaultClient)
	var idsChan = make(chan string)
	var errChan = make(chan error)
	var actualIds = make(map[string]struct{})

	go retriever.Retrieve(idsChan, errChan)

	for idsChan != nil {
		select {
		case id, ok := <-idsChan:
			if !ok {
				idsChan = nil
			} else {
				actualIds[id] = struct{}{}
			}
		case err := <-errChan:
			t.Errorf("Error not expected: %s", err)
			return
		}
	}

	for _, id := range expectedIds {
		if _, found := actualIds[id]; !found {
			st.Expect(t, true, found)
			return
		}
	}

	st.Expect(t, gock.IsDone(), true)
}