BeforeEach(func() {
				allVersions = []string{"1.2.3#abc", "1.3.2#def"}
				version = "1.3.2"
			})

			It("returns the newest version", func() {
				versions, _ := versions.Since(allVersions, version)

				Expect(versions).To(Equal([]string{"1.2.3#abc"}))
			})
		})
	})

	Describe("Reverse", func() {
		It("returns reversed ordered versions because concourse expects them that way", func() {
			versions, err := versions.Reverse([]string{"v201", "v178", "v120", "v200"})

			Expect(err).NotTo(HaveOccurred())
			Expect(versions).To(Equal([]string{"v200", "v120", "v178", "v201"}))
		})
	})

	Describe("SplitIntoVersionAndFingerprint", func() {
		var (
			input string
		)

		BeforeEach(func() {
			input = "some.version#my-fingerprint"
		})
func (c *CheckCommand) Run(input concourse.CheckRequest) (concourse.CheckResponse, error) {
	c.logger.Info("Received input, starting Check CMD run")

	err := c.removeExistingLogFiles()
	if err != nil {
		return nil, err
	}

	releaseType := input.Source.ReleaseType

	err = c.validateReleaseType(releaseType)
	if err != nil {
		return nil, err
	}

	productSlug := input.Source.ProductSlug

	c.logger.Info("Getting all releases")
	releases, err := c.pivnetClient.ReleasesForProductSlug(productSlug)
	if err != nil {
		return nil, err
	}

	if releaseType != "" {
		c.logger.Info(fmt.Sprintf("Filtering all releases by release type: '%s'", releaseType))
		releases, err = c.filter.ReleasesByReleaseType(
			releases,
			pivnet.ReleaseType(releaseType),
		)
		if err != nil {
			return nil, err
		}
	}

	version := input.Source.ProductVersion
	if version != "" {
		c.logger.Info(fmt.Sprintf("Filtering all releases by product version: '%s'", version))
		releases, err = c.filter.ReleasesByVersion(releases, version)
		if err != nil {
			return nil, err
		}
	}

	if input.Source.SortBy == concourse.SortBySemver {
		c.logger.Info("Sorting all releases by semver")
		releases, err = c.semverSorter.SortBySemver(releases)
		if err != nil {
			return nil, err
		}
	}

	vs, err := releaseVersions(releases)
	if err != nil {
		// Untested because versions.CombineVersionAndFingerprint cannot be forced to return an error.
		return concourse.CheckResponse{}, err
	}

	if len(vs) == 0 {
		return concourse.CheckResponse{}, nil
	}

	c.logger.Info("Gathering new versions")

	newVersions, err := versions.Since(vs, input.Version.ProductVersion)
	if err != nil {
		// Untested because versions.Since cannot be forced to return an error.
		return nil, err
	}

	reversedVersions, err := versions.Reverse(newVersions)
	if err != nil {
		// Untested because versions.Reverse cannot be forced to return an error.
		return nil, err
	}

	c.logger.Info(fmt.Sprintf("New versions: %v", reversedVersions))

	var out concourse.CheckResponse
	for _, v := range reversedVersions {
		out = append(out, concourse.Version{ProductVersion: v})
	}

	if len(out) == 0 {
		out = append(out, concourse.Version{ProductVersion: vs[0]})
	}

	c.logger.Info("Finishing check and returning ouput")

	return out, nil
}