JBossAssemblyDescriptorMetaData assembly = new JBossAssemblyDescriptorMetaData();
original.setAssemblyDescriptor(assembly);
ApplicationExceptionsMetaData exceptions = new ApplicationExceptionsMetaData();
assembly.setApplicationExceptions(exceptions);
ApplicationExceptionMetaData exc = new ApplicationExceptionMetaData();
exc.setExceptionClass("original.only.Exception");
exc.setRollback(true);
exceptions.add(exc);
exc = new ApplicationExceptionMetaData();
exc.setExceptionClass("overriden.Exception");
exc.setRollback(false);
exceptions.add(exc);
// override
JBoss50MetaData override = new JBoss50MetaData();
assembly = new JBossAssemblyDescriptorMetaData();
override.setAssemblyDescriptor(assembly);
exceptions = new ApplicationExceptionsMetaData();
assembly.setApplicationExceptions(exceptions);
exc = new ApplicationExceptionMetaData();
exc.setExceptionClass("override.only.Exception");
exc.setRollback(false);
exceptions.add(exc);
exc = new ApplicationExceptionMetaData();
exc.setExceptionClass("overriden.Exception");
exc.setRollback(true);
exceptions.add(exc);
// merge
JBoss50MetaData merged = new JBoss50MetaData();
merged.merge(override, original);
assembly = merged.getAssemblyDescriptor();
assertNotNull(assembly);
exceptions = assembly.getApplicationExceptions();
assertNotNull(exceptions);
assertEquals(3, exceptions.size());
exc = exceptions.get("original.only.Exception");
assertNotNull(exc);
assertEquals("original.only.Exception", exc.getExceptionClass());
assertTrue(exc.isRollback());
exc = exceptions.get("override.only.Exception");
assertNotNull(exc);
assertEquals("override.only.Exception", exc.getExceptionClass());
assertFalse(exc.isRollback());
exc = exceptions.get("overriden.Exception");
assertNotNull(exc);
assertEquals("overriden.Exception", exc.getExceptionClass());
assertTrue(exc.isRollback());
}