Friday, October 21, 2011
Thursday, October 20, 2011
EasyMock: Capture passed in values
I was writing a unit test this morning where the void method I was testing created an instance of a objected and passed it into a subsequent method. I needed to capture that object so that I could verify that it was set up properly. EasyMock provides a way to do this.
http://blog.jayway.com/2009/03/25/easymock-capturing-arguments-from-multiple-calls/
example:
Capture captured = new Captured();
expect(serviceInstance.method(EasyMock.capture(captured)).andReturn(/* whatever */);
MyObject obj = captured.getValue();
//run unit tests on obj
http://blog.jayway.com/2009/03/25/easymock-capturing-arguments-from-multiple-calls/
example:
Capture
expect(serviceInstance.method(EasyMock.capture(captured)).andReturn(/* whatever */);
MyObject obj = captured.getValue();
//run unit tests on obj
Friday, August 19, 2011
Friday, June 10, 2011
ResourceBundles and special characters
Seems that some special characters when used in a ResourceBundle proper file will throw off the parser for substitution. These characters need to be escaped properly, the escape notation is as follows:
See also:
The special chars \', { and }:
| escape ' with another ' | '' | (double-single quote) |
| escape \ with another \ | \\ | (double backslash) |
| enclose } with ' | '}' | |
| enclose { with ' | '{' |
See also:
Tuesday, May 24, 2011
Monday, May 9, 2011
Autowiring objects not instantiated by the Spring Framework
In order to enabled autowiring capabilities, add the following properties to the beans element.
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
xmlns:context="http://www.springframework.org/schema/context"
And make sure this line is included within the beans element
<context:annotation-config />
Next, in your code, get an instance of AutowireCapableBeanFactory.
Hint: Subclasses of AbstractApplicationContext have a getAutowireCapableBeanFactory, just one way to get such an instance.
Finally call the autowireBean(MyObject) method and like magic, so long as the annotations are correct, Spring will inject the correct instances.
xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"
xmlns:context="http://www.springframework.org/schema/context"
And make sure this line is included within the beans element
<context:annotation-config />
Next, in your code, get an instance of AutowireCapableBeanFactory.
Hint: Subclasses of AbstractApplicationContext have a getAutowireCapableBeanFactory, just one way to get such an instance.
Finally call the autowireBean(MyObject) method and like magic, so long as the annotations are correct, Spring will inject the correct instances.
Thursday, May 5, 2011
Steps to add ssl cert to JVM
Found a great link for adding certs to java for windows, Mac, and linux.
http://eclipse.open.collab.net/servlets/ProjectProcess?pageID=3450
http://eclipse.open.collab.net/servlets/ProjectProcess?pageID=3450
Subscribe to:
Posts (Atom)