[seam-issues] [JBoss JIRA] Closed: (JBSEAM-2296) @DataModelSelection always injects first value of @DataModel in unit tests

Christian Bauer (JIRA) jira-events at lists.jboss.org
Tue Dec 8 04:42:31 EST 2009


     [ https://jira.jboss.org/jira/browse/JBSEAM-2296?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Christian Bauer closed JBSEAM-2296.
-----------------------------------

    Resolution: Won't Fix


> @DataModelSelection always injects first value of @DataModel in unit tests
> --------------------------------------------------------------------------
>
>                 Key: JBSEAM-2296
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-2296
>             Project: Seam
>          Issue Type: Bug
>          Components: Test Harness
>            Reporter: Christian Bauer
>            Assignee: Christian Bauer
>             Fix For: The future
>
>
> @Name("testBean")
> @Scope(ScopeType.CONVERSATION)
> @AutoCreate
> public class TestBean {
>     @DataModel
>     private List<String> names;
>     public List<String> getNames() {
>         return names;
>     }
>     public void setNames(List<String> names) {
>         this.names = names;
>     }
>     @DataModelSelection
>     private String name;
>     public String getName() {
>         return name;
>     }
>     public void setName(String name) {
>         this.name = name;
>     }
>     public void init() {
>         this.names = new ArrayList<String>();
>         this.names.add("A");
>         this.names.add("B");
>         this.names.add("C");
>     }
> }
> The test:
>     @Test
>     public void test() throws Exception {
>         new FacesRequest() {
>             protected void invokeApplication() throws Exception {
>                 TestBean testBean = (TestBean)getInstance("testBean");
>                 testBean.init();
>                 testBean.setName("B");
>                 System.out.println("#### NAME IS: " + testBean.getName());
>                 assert testBean.getName().equals("B");
>             }
>         }.run();
>     }
> This test fails and prints the selected name as "A". If you remove @DataModelSelection, it prints the correct "B".

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list