Package play.test

Examples of play.test.FakeApplication


    private final FakeApplication fakeApplication = fakeApplication(conf);
    private final CfpUserService userService = fakeApplication.getWrappedApplication().plugin(CfpUserService.class).get();

    @Test
    public void should_return_default_user() throws Exception {
        final FakeApplication fakeApplication = Helpers.fakeApplication();
        running(fakeApplication, new Runnable() {
            @Override
            public void run() {
                final Identity identity = userService.doFind(new IdentityId("test","icule"));
                assertThat(identity).isNotNull();
View Full Code Here


    @Test
    public void should_not_mock() throws Exception {
        Map<String, Object> conf = new HashMap<>();
        conf.put("mockUserService", false);
        final FakeApplication app = fakeApplication(conf);
        running(app, new Runnable() {
            @Override
            public void run() {
                final BaseUserService userService1 = app.getWrappedApplication()
                        .plugin(CfpUserService.class).get().unWrap();
                assertThat(userService1.getClass()).isEqualTo(CfpUserServiceDelegate.class);
                assertThat(userService1.getClass()).isNotEqualTo(MockCfpUserServiceDelegate.class);
            }
        });
View Full Code Here

        assertThat(contentAsString(html)).contains("Your new application is ready.");
    }

    @Test
    public void workingDirectoryShouldBeConstant() {
        FakeApplication app = new FakeApplication(relativeToBaseDir("."),
                Helpers.class.getClassLoader(), new HashMap<String, String>(), new ArrayList<String>(), null);
       
        File testData = app.getWrappedApplication().getFile("./test/resources/test-data.txt");
       
        assertThat(testData).isFile();
    }
View Full Code Here

        assertThat(testData).isFile();
    }

    @Test
    public void unmanagedDependenciesCanBeFoundOnClassPath() {
        FakeApplication app = new FakeApplication(relativeToBaseDir("."),
                Helpers.class.getClassLoader(), new HashMap<String, String>(), new ArrayList<String>(), null);
       
        ProxySelector ps = new PacProxySelector(null);
       
        assertThat(ps instanceof ProxySelector);
View Full Code Here

    public void keyTypeInferenceShouldWorkForJava() {
        Map<String, String> config = new HashMap<String, String>();
        config.put("ehcacheplugin", "disabled");
        config.put("mongodbJacksonMapperCloseOnStop", "disabled");
        final String collName = "mockcoll" + new Random().nextInt(10000);
        FakeApplication app = fakeApplication(config);
        running(app, new Runnable() {
            @Override
            public void run() {
                JacksonDBCollection<MockObject, String> coll = MongoDB.getCollection(collName, MockObject.class);
                MockObject o = new MockObject();
View Full Code Here

        assertThat(gitRepository.isFile(fileName, "not_exist_branch")).isEqualTo(false);
    }

    @Test
    public void testGetAllBranches() throws IOException, GitAPIException {
        FakeApplication app = support.Helpers.makeTestApplication();
        Helpers.start(app);

        // Given
        String userName = "wansoon";
        String projectName = "test";
View Full Code Here

        Helpers.stop(app);
    }

    @Test
    public void getRelatedAuthors() throws IOException, GitAPIException, LimitExceededException {
        FakeApplication app = support.Helpers.makeTestApplication();
        Helpers.start(app);

        Project project = createProject("yobi", "test");
        PullRequest pullRequest = createPullRequest(project);
        GitRepository gitRepository = new GitRepository(project);
View Full Code Here

import static org.fest.assertions.Assertions.assertThat;

public class ConfigTest {
    @Test
    public void getScheme() {
        FakeApplication app;
        Map<String, String> additionalConfiguration = support.Helpers.makeTestConfig();

        additionalConfiguration.put("application.scheme", "http");
        app = support.Helpers.makeTestApplication(additionalConfiguration);
        Helpers.start(app);
View Full Code Here

        Helpers.stop(app);
    }

    @Test
    public void getHostname() {
        FakeApplication app;
        Map<String, String> additionalConfiguration = support.Helpers.makeTestConfig();

        additionalConfiguration.put("application.hostname", "test.yobi.com");
        additionalConfiguration.put("application.port", "8080");
        app = support.Helpers.makeTestApplication(additionalConfiguration);
View Full Code Here

        Helpers.stop(app);
    }

    @Test
    public void getSiteName() {
        FakeApplication app;
        Map<String, String> additionalConfiguration = support.Helpers.makeTestConfig();

        additionalConfiguration.put("application.siteName", "my site");
        app = support.Helpers.makeTestApplication(additionalConfiguration);
        Helpers.start(app);
View Full Code Here

TOP

Related Classes of play.test.FakeApplication

Copyright © 2018 www.massapicom. 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.