I'm currently using the following pattern for my seam-tests (taken from the examples):
| @Test
| public void testCombinedQuery() throws Exception{
| new FacesRequest() {
| QueryManager queryManager;
| @Override
| protected void updateModelValues()
| {
| queryManager = (QueryManager)getInstance("queryManager");
|
| }
|
| @Override
| protected void renderResponse()
| {
| Query query = new Query();
| query.setDays("'DAY1', 'DAY2'");
| query.setTopics("'1','3'");
| int resultSize = queryManager.getNrOfQuestionsInQuery(query);
| assertEquals("Combined-Query did not return the correct Number of
Questions", resultSize, COMBINEDQUERY_QUESTIONS);
| }
| }.run();
| }
|
something without the code-overhead of the faces-request?!
For most of the tests, all I want to do is get a seam-object with proper injections and
then invoke some methods on it and test the results. Is there a simpler way to achieve
something in the line of:
@Test
| public void testCombinedQuery(){
| queryManager = (QueryManager)getInstance("queryManager");
| Query query = new Query();
| query.setDays("'DAY1', 'DAY2'");
| query.setTopics("'1','3'");
| int resultSize = queryManager.getNrOfQuestionsInQuery(query);
| assertEquals("Combined-Query did not return the correct Number of
Questions", resultSize, COMBINEDQUERY_QUESTIONS);
|
| }
|
And another problem with testsuites: Two different testclasses in the same Test-Suite
start/teardonw the embedded container twice - is there a way to have different tests in
the same suite share the same embedded container?!
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035318#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...