public void addConfigDefinitionsFromBundle(Bundle bundle, List<Bundle> bundlesAdded) {
        try {
            checkAndCopyUserDefs(bundle, bundlesAdded);
        } catch (IOException e) {
            throw new IllegalArgumentException("Unable to add config definitions from bundle " + bundle.getFile().getAbsolutePath(), e);
        }
    }
@Test
    public void require_that_conflicting_defs_are_not_added() throws IOException {
        File defDir = temporaryFolder.newFolder();
        IOUtils.writeFile(new File(defDir, "foo.def"), "alreadyexists", false);
        ConfigDefinitionDir dir = new ConfigDefinitionDir(defDir);
        Bundle bundle = new Bundle(new JarFile(bundleFile), bundleFile);
        ArrayList<Bundle> bundlesAdded = new ArrayList<>();

        // Conflict with built-in config definition
        try {
            dir.addConfigDefinitionsFromBundle(bundle, bundlesAdded);
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().contains
                    ("The config definition with name 'bar.foo' contained in the bundle '" +
                            bundleFileName +
                            "' conflicts with a built-in config definition"));
        }
        bundlesAdded.add(bundle);

        // Conflict with another bundle
        Bundle bundle2 = new Bundle(new JarFile(bundleFile), bundleFile);
        try {
            dir.addConfigDefinitionsFromBundle(bundle2, bundlesAdded);
        } catch (IllegalArgumentException e) {
            assertEquals("The config definition with name 'bar.foo' contained in the bundle '" +
                         bundleFileName +
                         "' conflicts with the same config definition in the bundle 'com.yahoo.searcher1.jar'. Please choose a different name.",
                         e.getMessage());
        }
    }