@Test public void testCompareTo() { HpAlmRepository repository1 = new HpAlmRepository(getProject().getName(), 1); HpAlmRepository repository2 = new HpAlmRepository(getProject().getName(), 2); Assert.assertEquals(-1, repository1.compareTo(repository2)); Assert.assertEquals(1, repository2.compareTo(repository1)); Assert.assertEquals(0, repository1.compareTo(repository1)); }
public int compareTo(HpAlmRepository other) { if(id < other.id) { return -1; } else if(id > other.id) { return 1; } else { return 0; } }
HpAlmRepository extends TaskRepository implements Comparable<HpAlmRepository> { public int compareTo(HpAlmRepository other) { if(id < other.id) { return -1; } else if(id > other.id) { return 1; } else { return 0; } } }
HpAlmRepository extends TaskRepository implements Comparable<HpAlmRepository> { public int compareTo(HpAlmRepository other) { if(id < other.id) { return -1; } else if(id > other.id) { return 1; } else { return 0; } } HpAlmRepository();  HpAlmRepository(String url, long id); }
HpAlmRepository extends TaskRepository implements Comparable<HpAlmRepository> { public int compareTo(HpAlmRepository other) { if(id < other.id) { return -1; } else if(id > other.id) { return 1; } else { return 0; } } HpAlmRepository();  HpAlmRepository(String url, long id); void setId(long id); @Tag("defect") TaskConfig getDefect(); void setDefect(TaskConfig defect); @Tag("requirement") TaskConfig getRequirement(); void setRequirement(TaskConfig requirement); @Attribute("id") long getId(); String getPresentableName(); boolean isConfigured(); Task[] getIssues(String query, int max, long since); @Override void setPreferredOpenTaskState(@Nullable CustomTaskState customTaskState); @Nullable @Override CustomTaskState getPreferredOpenTaskState(); @Override void setPreferredCloseTaskState(@Nullable CustomTaskState customTaskState); @Nullable @Override CustomTaskState getPreferredCloseTaskState(); Task findTask(String taskName); String extractId(String taskName); HpAlmRepository clone(); boolean equals(Object o); int hashCode(); int compareTo(HpAlmRepository other); }
HpAlmRepository extends TaskRepository implements Comparable<HpAlmRepository> { public int compareTo(HpAlmRepository other) { if(id < other.id) { return -1; } else if(id > other.id) { return 1; } else { return 0; } } HpAlmRepository();  HpAlmRepository(String url, long id); void setId(long id); @Tag("defect") TaskConfig getDefect(); void setDefect(TaskConfig defect); @Tag("requirement") TaskConfig getRequirement(); void setRequirement(TaskConfig requirement); @Attribute("id") long getId(); String getPresentableName(); boolean isConfigured(); Task[] getIssues(String query, int max, long since); @Override void setPreferredOpenTaskState(@Nullable CustomTaskState customTaskState); @Nullable @Override CustomTaskState getPreferredOpenTaskState(); @Override void setPreferredCloseTaskState(@Nullable CustomTaskState customTaskState); @Nullable @Override CustomTaskState getPreferredCloseTaskState(); Task findTask(String taskName); String extractId(String taskName); HpAlmRepository clone(); boolean equals(Object o); int hashCode(); int compareTo(HpAlmRepository other);  }