summaryrefslogtreecommitdiffstats
path: root/sample-apps/basic-search-java/src/test/java/ApplicationTest.java
blob: 5cf5b62c2619532ebebf175a10d919016d2e22e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
//package ${package};

import com.yahoo.application.Application;
import com.yahoo.application.Networking;
import com.yahoo.application.container.Processing;
import com.yahoo.component.ComponentSpecification;
import com.yahoo.processing.Request;
import com.yahoo.processing.Response;
import org.junit.Test;

import java.nio.file.FileSystems;

import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertThat;

public class ApplicationTest {

    @Test
    public void requireThatResultContainsHelloWorld() throws Exception {
        try (Application app = Application.fromApplicationPackage(
                FileSystems.getDefault().getPath("src/main/application"),
                Networking.disable)) {
            Processing processing = app.getJDisc("jdisc").processing();
            Response response = processing.process(ComponentSpecification.fromString("default"), new Request());
            assertThat(response.data().get(0).toString(), containsString("Hello, services!"));
        }
    }
}