[TEST] Ensure that iteration order of TestSection is consistent

This commit is contained in:
Simon Willnauer 2014-04-22 10:06:58 +02:00
parent ae911f6e75
commit 41cc1f5bcb
2 changed files with 7 additions and 2 deletions

View File

@ -35,7 +35,7 @@ public class RestTestSuite {
private SetupSection setupSection; private SetupSection setupSection;
private Set<TestSection> testSections = Sets.newHashSet(); private Set<TestSection> testSections = Sets.newTreeSet();
public RestTestSuite(String api, String name) { public RestTestSuite(String api, String name) {
this.api = api; this.api = api;

View File

@ -25,7 +25,7 @@ import java.util.List;
/** /**
* Represents a test section, which is composed of a skip section and multiple executable sections. * Represents a test section, which is composed of a skip section and multiple executable sections.
*/ */
public class TestSection { public class TestSection implements Comparable<TestSection> {
private final String name; private final String name;
private SkipSection skipSection; private SkipSection skipSection;
private final List<ExecutableSection> executableSections; private final List<ExecutableSection> executableSections;
@ -71,4 +71,9 @@ public class TestSection {
public int hashCode() { public int hashCode() {
return name != null ? name.hashCode() : 0; return name != null ? name.hashCode() : 0;
} }
@Override
public int compareTo(TestSection o) {
return name.compareTo(o.getName());
}
} }