public class UpdateControllerTest extends ControllerTestCase {
@Test
public void run() throws Exception {
Blog blog = new Blog();
blog.setTitle("aaa");
blog.setContent("111");
Datastore.put(blog);
tester.param("key", Datastore.keyToString(blog.getKey()));
tester.param("title", "aaa2");
tester.param("content", "222");
tester.param("version", blog.getVersion());
tester.start("/blog/update");
UpdateController controller = tester.getController();
assertThat(controller, is(notNullValue()));
assertThat(tester.isRedirect(), is(true));
assertThat(tester.getDestinationPath(), is("/blog/"));
blog = Datastore.get(Blog.class, blog.getKey());
assertThat(blog, is(notNullValue()));
assertThat(blog.getTitle(), is("aaa2"));
assertThat(blog.getContent(), is("222"));
}