use of org.jboss.tools.openshift.internal.ui.comparators.ProjectViewerComparator in project jbosstools-openshift by jbosstools.
the class ProjectTreeSorterTest method testProjectsWithLabelProvider.
@Test
public void testProjectsWithLabelProvider() {
final ViewerComparator comparator = new ProjectViewerComparator(new OpenShiftExplorerLabelProvider());
IProject p1 = mockProject("default", "z");
IProject p2 = mockProject("openshift", "y");
IProject p3 = mockProject("a", "c");
IProject p4 = mockProject("b2", null);
IProject p5 = mockProject("d", "b");
IProject[] projects = new IProject[] { p3, p5, p2, p1, p4 };
Arrays.sort(projects, new Comparator<IProject>() {
@Override
public int compare(IProject o1, IProject o2) {
return comparator.compare(null, o1, o2);
}
});
assertEquals(p1, projects[0]);
assertEquals(p2, projects[1]);
assertEquals(p5, projects[2]);
assertEquals(p4, projects[3]);
assertEquals(p3, projects[4]);
}
Aggregations