On the Javadoc of LatestStrategy, for the sort() method it states:

/**
    * Sorts the given artifacts info from the latest one to the oldest one.
    * The definition of 'latest' depends on the strategy itself.
    * Given artifacts info are all good candidate.
    * @param infos
    * @return
    */


Is this inaccurate? My unit test seems to indicate the opposite is true. Which is to say, after sorting, the 'latest' is at the end of the list, and not at the beginning. I've included snippets below -- the assertEquals fails.

Kind regards,

Keith



public void testIvyStrategy() throws Exception {
       LatestRevisionStrategy strategy= new LatestRevisionStrategy();
       ArtifactInfo artifactInfoOne = defineQuickArtifact("1.2");
       ArtifactInfo artifactInfoTwo = defineQuickArtifact("1.3");

ArtifactInfo[] arts = new ArtifactInfo[]{artifactInfoOne, artifactInfoTwo};
       List list = strategy.sort(arts);
       ArtifactInfo info = (ArtifactInfo) list.get(0);
       assertEquals("1.3", info.getRevision());

   }
private ArtifactInfo defineQuickArtifact(final String revision) {
       ArtifactInfo artifactInfo = new ArtifactInfo() {
           public String getRevision() {
               return revision;
           }

           public long getLastModified() {
               return 0;
           }
       };
       return artifactInfo;
   }

Reply via email to