CLOUDSTACK-8656: use catch block for validation

This commit is contained in:
Daan Hoogland 2015-08-14 17:25:04 +02:00
parent 384a2e9cee
commit adcd0c0c0d

View File

@ -103,16 +103,19 @@ public class ModuleBasedContextFactoryTest {
assertEquals(parent, parentBean); assertEquals(parent, parentBean);
} }
int notfound = 0;
for (String notThere : notTheres) { for (String notThere : notTheres) {
try { try {
context.getBean(notThere, String.class); context.getBean(notThere, String.class);
fail(); fail();
} catch (NoSuchBeanDefinitionException e) { } catch (NoSuchBeanDefinitionException e) {
notfound++;
} }
} }
int count = context.getBean("count", InstantiationCounter.class).getCount(); int count = context.getBean("count", InstantiationCounter.class).getCount();
assertEquals(notTheres.length, notfound);
assertEquals(order, count); assertEquals(order, count);
} }