This content has been marked as final.
Show 3 replies
-
1. Re: EntityController not testable?
christian.bauer Jul 23, 2007 6:35 AM (in response to nhpvti)Run it inside a SeamTest.
-
2. Re: EntityController not testable?
nhpvti Jul 23, 2007 8:27 AM (in response to nhpvti)"christian.bauer@jboss.com" wrote:
Run it inside a SeamTest.
Does your answer mean that EntityController subclasses can be tested in an integration test, but not in a unit test if they rely on a logger or faces messages?public class MyEntityControllerTest extends SeamTest { @Test public void testEntityController() { try { new FacesRequest() { @Override protected void invokeApplication() { assert invokeMethod("#{myEntityController.save}").equals("OK"); } }.run(); } catch (Exception e) { Logging.getLog(MyEntityControllerTest.class).error(e.getMessage()); } } }
-
3. Re: EntityController not testable?
larshuber Aug 17, 2007 10:38 AM (in response to nhpvti)For unit testing you can user field setting. I tried it with the logger, but not with faces messages.
setField(obj, "log", org.jboss.seam.log.Logging.getLog(obj.getClass().getName()));
obj is an instance of EntityController subclass.