"mrobinson28" wrote : 
  | So my questions:
  | 
  |   | *  From the exception it looks like I may have to provide more than I 
am currently via something in org.jboss.seam.mock.* e.g currentUser (In the 
application currentUser is a session scoped component that is instantiated when 
a user logs in). Are there any examples of using these mock objects anywhere? 
  |   | *  Currently I am extending SeamTest which I understand is used for 
integration testing. Is it incorrect to do this when unit testing; several of 
the methods provided seem helpful in unit testing also. Would it be feasible to 
override init so that the embedded container is not started for stand alone 
unit test (or maybe have something like SeamUnitTest? 
  |   | *  In general I seem to be having difficulties writing unit test 
because it occurs over and over again that some method is accessing a variable 
that is within scope during normal program executions e.g. in the code above 
currentUser is within scope but is not injected into the component that is 
accessing it. Is this bad practice? I tested re-writing the class that I am 
trying to test to contain and instance of the currentUser object injected using 
@In and then accessing that object from the method that performs the query and 
this works, both in the application and in my unit test if I manually inject 
that object. 
  |   | *  Is it possible to manually inject objects into different scopes 
programmatically for unit testing? 

Did you ever figure out the answers to these excellent questions?  I'm writing 
some unit tests and I'm running into some of your issues, especially the second 
issue (re: extending SeamTest for unit tests).  I'm trying to avoid extending 
SeamTest in my unit tests.  However, there's one nagging issue I have when 
doing this.  Because the code I'm testing contains logging statements where the 
log object is injected using the @Logger annotation, TestNG always barfs with a 
null pointer exception when it encounters a logging statement in the code...  
Perhaps I can mock the log object.  Any hints here?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045235#4045235

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045235
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to