X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=support%2Fgeneral%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fgeneral%2FBeanKernelTest.java;h=941932244e11de14e90d5c140e9783c9ae48ba04;hb=8de36ff0206c996baf3ee4adc3e2293b12ff5f39;hp=2c9f898f967066a23f0380bba61a570b411a989a;hpb=32a62ca2c752e33a7873ac868a7a1f289caedcd4;p=utils diff --git a/support/general/src/test/java/org/wamblee/general/BeanKernelTest.java b/support/general/src/test/java/org/wamblee/general/BeanKernelTest.java index 2c9f898f..94193224 100644 --- a/support/general/src/test/java/org/wamblee/general/BeanKernelTest.java +++ b/support/general/src/test/java/org/wamblee/general/BeanKernelTest.java @@ -1,19 +1,18 @@ /* * Copyright 2005 the original author or authors. - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ - package org.wamblee.general; import junit.framework.TestCase; @@ -22,11 +21,10 @@ import junit.framework.TestCase; * Tests the bean kernel. The lookup of the bean factory itself can be tested * only partially. Using a global property file for all test cases would tie all * test cases together therefore no global property file is used. - * + * * @author Erik Brakkee */ public class BeanKernelTest extends TestCase { - /** * Loads the bean factory based on a property file configuration. Verifies * the correct bean factory is loaded. @@ -34,41 +32,41 @@ public class BeanKernelTest extends TestCase { */ public void testLoadBeanFactoryFromProperties() { BeanFactory factory = BeanKernel - .lookupBeanFactory("org/wamblee/general/beankernel.properties"); + .lookupBeanFactory("org/wamblee/general/beankernel.properties"); assertTrue(factory instanceof TestBeanFactory); } /** - * Loads the bean factory based on a non-existing property file. - * Verifies that BeanFactoryException is thrown. + * Loads the bean factory based on a non-existing property file. Verifies + * that BeanFactoryException is thrown. * */ public void testNonExistentPropertyFile() { try { BeanKernel - .lookupBeanFactory("org/wamblee/general/beankernel-nonexistent.properties"); + .lookupBeanFactory("org/wamblee/general/beankernel-nonexistent.properties"); } catch (BeanFactoryException e) { return; // ok } + fail(); } - + /** - * Loads the bean factory based on a property file with a non-existing - * bean factory defined in it. - * Verifies that BeanFactoryException is thrown. + * Loads the bean factory based on a property file with a non-existing bean + * factory defined in it. Verifies that BeanFactoryException is thrown. * */ public void testNonExistentBeanFactory() { try { BeanKernel - .lookupBeanFactory("org/wamblee/general/beankernel-wrong.properties"); + .lookupBeanFactory("org/wamblee/general/beankernel-wrong.properties"); } catch (BeanFactoryException e) { return; // ok } + fail(); } - /** * Retrieves a bean factory throug the bean kernel. Verifies that beans can @@ -77,12 +75,12 @@ public class BeanKernelTest extends TestCase { */ public void testRetrieveFactory() { BeanKernel.overrideBeanFactory(new TestBeanFactory()); // bypass - // default - // property - // lookup + // default + // property + // lookup + BeanFactory factory = BeanKernel.getBeanFactory(); assertNotNull(factory); assertEquals("hello", factory.find(String.class)); } - }