@Test
public void populateMethodDeclarations() {

    final List<MethodDeclaration> toAdd = IntStream.range(0, 5)
            .boxed()
            .map(index -> getMethodDeclaration("METHOD_" + index))
            .collect(Collectors.toList());
    final ClassOrInterfaceDeclaration toPopulate = new ClassOrInterfaceDeclaration();
    assertTrue(toPopulate.getMembers().isEmpty());
    CommonCodegenUtils.populateMethodDeclarations(toPopulate, toAdd);
    final NodeList<BodyDeclaration<?>> retrieved = toPopulate.getMembers();
    assertEquals(toAdd.size(), retrieved.size());
    assertTrue(toAdd.stream().anyMatch(methodDeclaration -> retrieved.stream()
            .anyMatch(bodyDeclaration -> bodyDeclaration.equals(methodDeclaration))));
}