Beanoh, pronounced Bean-oh, is a simple open source way to verify your Spring context. Teams that leverage Beanoh spend less time focusing on configuring Spring and more time adding business value.
Beanoh is a simple way to verify all of the beans in your Spring context. This lightweight tool supplies quick feedback without firing up your container. Beanoh provides three simple verification strategies:
Beanoh allows you to combine these strategies in a single test.
Beanoh helps you focus on adding busines value. Switching your focus between coding and configuring Spring is distracting. While configuring Spring is absolutely necessary it should not be your primary focus. Beanoh encourages you to focus on coding while it focuses on verifying your context. Beanoh can help increase your productivity by encouraging you to focus on adding business value.
Beanoh uncovers Spring configuration errors and supplies timely information. This tool puts your team back in the driver's seat. It identifies misconfigured beans, components that are not scanned by Spring, and duplicate bean definitions. Beanoh takes the mystery out of Spring. You don't have to be a Spring guru to take control of your Spring context. Beanoh does the heavy lifting and empowers you to take control of your Spring context.
public class SomeTest extends BeanohTestCase {
@Test
public void testSomething() {
assertContextLoading();
}
}
public class SomeTest extends BeanohTestCase {
@Test
public void testSomething() {
assertComponentsInContext("com.sourceallies");
}
}
public class SomeTest extends BeanohTestCase {
@Test
public void testSomething() {
assertUniqueBeanContextLoading();
}
}
Beanoh requires a test bootstrap Spring context file. BeanohTestCase looks for a Spring context in the classpath with the same name as the test plus "-BeanohContext.xml". For example 'com.sourceallies.anything. SomethingTest' will use 'com.sourceallies.anything.SomethingTest-BeanohContext.xml' to bootstrap the Spring context. Add imports to this bootstrap context for each of the context files that you wish to load. If you need to override beans they must be added to this bootstrap context in order to not count as a duplicate bean definition.
<jee:jndi-lookup id="testBean" jndi-name="jdbc/test"/>
<bean id="testBean" class="org.mockito.Mockito" factory-method="mock">
<constructor-arg value="com.something.Foo" />
</bean>
<bean id="dataSource" parent="beanohDataSource"/>
@BeforeClass
public static void setupProperties(){
System.setProperty("something", "someValue");
}
Copyright © 2011 Source Allies
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation version 3.0.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; if not, please visit http://www.gnu.org/licenses/lgpl-3.0.txt.