Package slim3.demo.controller.blobstore

Source Code of slim3.demo.controller.blobstore.IndexControllerTest

package slim3.demo.controller.blobstore;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import org.junit.Test;
import org.slim3.datastore.Datastore;
import org.slim3.tester.ControllerTestCase;

import slim3.demo.model.Blobstore;

public class IndexControllerTest extends ControllerTestCase {

    @Test
    public void run() throws Exception {
        tester.start("/blobstore/");
        IndexController controller = tester.getController();
        assertThat(controller, is(notNullValue()));
        assertThat(tester.isRedirect(), is(false));
        assertThat(tester.getDestinationPath(), is("/blobstore/index.jsp"));
    }

    @Test
    public void runAfterUpload() throws Exception {
        String keyStr = "hoge";
        Blobstore blobstore = new Blobstore();
        blobstore.setKey(Datastore.createKey(Blobstore.class, keyStr));
        Datastore.put(blobstore);
        tester.start("/blobstore/");
        IndexController controller = tester.getController();
        assertThat(controller, is(notNullValue()));
        assertThat(tester.isRedirect(), is(false));
        assertThat(tester.getDestinationPath(), is("/blobstore/index.jsp"));
        assertThat(tester.requestScope("dataList"), is(notNullValue()));
    }
}
TOP

Related Classes of slim3.demo.controller.blobstore.IndexControllerTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.