Map<JavaSourceGroupName, JavaSourceGroup> expectedMap = sourceGroupMap(expected);
for (JavaSourceGroup sourceGroup: actual) {
JavaSourceGroupName name = sourceGroup.getGroupName();
JavaSourceGroup expectedSourceGroup = expectedMap.get(name);
expectedMap.remove(name);
if (expectedSourceGroup == null) {
throw new AssertionError("Unexpected source group: " + name);
}
assertEquals("Source groups (" + name + ") must contain the same source roots.",
expectedSourceGroup.getSourceRoots(), sourceGroup.getSourceRoots());
}
if (!expectedMap.isEmpty()) {
fail("Missing expected source groups: " + expectedMap.keySet().toString());
}