1 7 package com.inversoft.verge.mvc.model.actionflow.test; 8 9 10 import java.util.HashMap ; 11 import java.util.Map ; 12 13 import com.inversoft.junit.WebTestCase; 14 import com.inversoft.verge.mvc.MVCException; 15 import com.inversoft.verge.mvc.MVCRequest; 16 import com.inversoft.verge.mvc.model.ModelResolution; 17 import com.inversoft.verge.mvc.model.web.WebMetaData; 18 import com.inversoft.verge.mvc.model.web.WebModelResolver; 19 import com.inversoft.verge.util.ScopeConstants; 20 21 22 31 public class ActionFlowModelResolverTest extends WebTestCase { 32 33 36 public ActionFlowModelResolverTest(String name) { 37 super(name); 38 setLocal(true); 39 } 40 41 42 45 public void testAll() { 46 47 Map params = new HashMap (); 48 params.put(WebMetaData.CLASS_PARAMETER, 49 "com.inversoft.verge.mvc.model.web.test.Bean1"); 50 params.put(WebMetaData.SCOPE_PARAMETER, 51 Integer.toString(ScopeConstants.SESSION_INT)); 52 MVCRequest mvcRequest = new MVCRequest(request, response); 53 54 try { 55 WebModelResolver resolver = new WebModelResolver(); 56 ModelResolution resolved = resolver.resolve(mvcRequest, "test.string1", params); 57 Object bean = request.getSession().getAttribute("test"); 58 59 assertEquals("Objects should be equal", resolved.getModel(), bean); 60 } catch (Exception e) { 61 fail(e.toString()); 62 } 63 64 try { 65 WebModelResolver resolver = new WebModelResolver(); 66 67 resolver.resolve(mvcRequest, "", params); 68 fail("Should have thrown an Assertion error"); 69 } catch (Throwable t) { 70 assertTrue("Should be an MVCException", t instanceof MVCException); 71 } 72 } 73 } 74 | Popular Tags |