public class MovieActionTest extends StrutsJUnit4TestCase<MovieActionTest>{
@Before
public void setUp() throws Exception {
super.setUp();
String credentials = "username:password";
request.addHeader("authorization", "BASIC " + Base64.encodeBase64String(credentials.getBytes()));
}
@Test
public void testIndex() throws Exception {
request.setMethod("get");
ActionProxy proxy = getActionProxy("/rest/movie/");
proxy.setExecuteResult(false);
String result = proxy.execute();
}
@Test
public void testView() throws Exception {
request.setMethod("get");
ActionProxy proxy = getActionProxy("/rest/movie/1");
MovieAction movieAction = MovieAction.class.cast(proxy.getAction());
proxy.setExecuteResult(false);
String result = proxy.execute();
assertEquals("1", movieAction.getId());
}
}