@Test
public void sortPropertySources() {

    // setup
    DefaultConfigurationBuilder b = new DefaultConfigurationBuilder();
    MockedPropertySource[] propertySources = new MockedPropertySource[10];
    for (int i = 0; i < propertySources.length; i++) {
        propertySources[i] = new MockedPropertySource("ps" + i, i);
    }
    b.addPropertySources(propertySources);
    Comparator<PropertySource> psComp = (o1, o2) -> o1.toString().compareTo(o2.toString());
    // test 
    assertThat(b.sortPropertySources(psComp).getClass()).isEqualTo(DefaultConfigurationBuilder.class);
    Arrays.sort(propertySources, psComp);
    for (int i = 0; i < propertySources.length; i++) {
        assertThat(b.getPropertySources().get(i)).isEqualTo(propertySources[i]);
    }
}