struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (WW-4111) Restful2ActionMapper add test to documentation
Date Wed, 19 Jun 2013 05:53:22 GMT

     [ https://issues.apache.org/jira/browse/WW-4111?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lukasz Lenart updated WW-4111:
------------------------------

    Description: 
{code:java}
public class MovieActionTest extends StrutsJUnit4TestCase<MovieActionTest>{
    
    @Before
    public void setUp() throws Exception {

        //assumes Basic authentication
        super.setUp();
        String credentials = "username:password";
        request.addHeader("authorization", "BASIC " + Base64.encodeBase64String(credentials.getBytes()));
    }

        
    @Test
    public void testIndex() throws Exception {
        
         
        request.setMethod("get"); //Http method should be set
        
        ActionProxy proxy = getActionProxy("/rest/movie/");                        
      
        proxy.setExecuteResult(false);
        String result = proxy.execute();
        
       //assertions ...
        
    }
    
    @Test
    public void testView() throws Exception {
        
      
        request.setMethod("get"); //Http method should be set
              
        ActionProxy proxy = getActionProxy("/rest/movie/1");                        
        MovieAction movieAction = MovieAction.class.cast(proxy.getAction());
           
        proxy.setExecuteResult(false);
        
        String result = proxy.execute();
        //assertions ...
         assertEquals("1", movieAction.getId()); 
        
    }
}
{code}

  was:
public class MovieActionTest extends StrutsJUnit4TestCase<MovieActionTest>{
    
    @Before
    public void setUp() throws Exception {

        //assumes Basic authentication
        super.setUp();
        String credentials = "username:password";
        request.addHeader("authorization", "BASIC " + Base64.encodeBase64String(credentials.getBytes()));
    }

        
    @Test
    public void testIndex() throws Exception {
        
         
        request.setMethod("get"); //Http method should be set
        
        ActionProxy proxy = getActionProxy("/rest/movie/");                        
      
        proxy.setExecuteResult(false);
        String result = proxy.execute();
        
       //assertions ...
        
    }
    
    @Test
    public void testView() throws Exception {
        
      
        request.setMethod("get"); //Http method should be set
              
        ActionProxy proxy = getActionProxy("/rest/movie/1");                        
        MovieAction movieAction = MovieAction.class.cast(proxy.getAction());
           
        proxy.setExecuteResult(false);
        
        String result = proxy.execute();
        //assertions ...
         assertEquals("1", movieAction.getId()); 
        
    }
}

    
> Restful2ActionMapper add test to documentation
> ----------------------------------------------
>
>                 Key: WW-4111
>                 URL: https://issues.apache.org/jira/browse/WW-4111
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 2.3.15
>            Reporter: Antonios Gkogkakis
>            Priority: Trivial
>              Labels: documentation
>             Fix For: 2.3.16
>
>
> {code:java}
> public class MovieActionTest extends StrutsJUnit4TestCase<MovieActionTest>{
>     
>     @Before
>     public void setUp() throws Exception {
>         //assumes Basic authentication
>         super.setUp();
>         String credentials = "username:password";
>         request.addHeader("authorization", "BASIC " + Base64.encodeBase64String(credentials.getBytes()));
>     }
>         
>     @Test
>     public void testIndex() throws Exception {
>         
>          
>         request.setMethod("get"); //Http method should be set
>         
>         ActionProxy proxy = getActionProxy("/rest/movie/");                        
>       
>         proxy.setExecuteResult(false);
>         String result = proxy.execute();
>         
>        //assertions ...
>         
>     }
>     
>     @Test
>     public void testView() throws Exception {
>         
>       
>         request.setMethod("get"); //Http method should be set
>               
>         ActionProxy proxy = getActionProxy("/rest/movie/1");                        
>         MovieAction movieAction = MovieAction.class.cast(proxy.getAction());
>            
>         proxy.setExecuteResult(false);
>         
>         String result = proxy.execute();
>         //assertions ...
>          assertEquals("1", movieAction.getId()); 
>         
>     }
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message