Search in sources :

Example 76 with Test

use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.

the class UpdateHandlerTest method updateHandler_queryParams.

@Test
public void updateHandler_queryParams() {
    final String oldValue = "foo";
    final String newValue = "foo bar+plus=equals&ampersand";
    Response response = db.save(new Foo(null, oldValue));
    Params params = new Params().addParam("field", "title").addParam("value", newValue);
    String output = db.invokeUpdateHandler("example/example_update", response.getId(), params);
    // retrieve from db to verify
    Foo foo = db.find(Foo.class, response.getId());
    assertNotNull(output);
    assertEquals(foo.getTitle(), newValue);
}
Also used : Response(com.cloudant.client.api.model.Response) Params(com.cloudant.client.api.model.Params) Test(org.junit.jupiter.api.Test)

Example 77 with Test

use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.

the class UpdateHandlerTest method updateHandler_queryString.

@Test
public void updateHandler_queryString() {
    final String oldValue = "foo";
    final String newValue = "foo bar+plus=equals&ampersand";
    Response response = db.save(new Foo(null, oldValue));
    Params params = new Params().addParam("field", "title").addParam("value", newValue);
    String output = db.invokeUpdateHandler("example/example_update", response.getId(), params);
    // retrieve from db to verify
    Foo foo = db.find(Foo.class, response.getId());
    assertNotNull(output);
    assertEquals(foo.getTitle(), newValue);
}
Also used : Response(com.cloudant.client.api.model.Response) Params(com.cloudant.client.api.model.Params) Test(org.junit.jupiter.api.Test)

Example 78 with Test

use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.

the class UpdateHandlerTest method updateHandler_postUuid.

@Test
public void updateHandler_postUuid() {
    String output = db.invokeUpdateHandler("example/get-uuid", null, new Params());
    assertNotNull(output);
    assertTrue(output.length() > 0);
}
Also used : Params(com.cloudant.client.api.model.Params) Test(org.junit.jupiter.api.Test)

Example 79 with Test

use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.

the class IndexListTests method listSimpleTextIndex.

@Test
public void listSimpleTextIndex() throws Exception {
    enqueueList(TEXT_SIMPLE);
    List<TextIndex> indexes = db.listIndexes().textIndexes();
    assertEquals(1, indexes.size(), "There should be 1 text index");
    TextIndex simple = indexes.get(0);
    assertSimpleText(simple);
}
Also used : TextIndex(com.cloudant.client.api.query.TextIndex) Test(org.junit.jupiter.api.Test)

Example 80 with Test

use of org.junit.jupiter.api.Test in project java-cloudant by cloudant.

the class IndexListTests method listComplexJsonIndex.

@Test
public void listComplexJsonIndex() throws Exception {
    enqueueList(JSON_COMPLEX);
    List<JsonIndex> indexes = db.listIndexes().jsonIndexes();
    assertEquals(1, indexes.size(), "There should be 1 JSON index");
    JsonIndex complex = indexes.get(0);
    assertComplexJson(complex);
}
Also used : JsonIndex(com.cloudant.client.api.query.JsonIndex) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)67450 lombok.val (lombok.val)3880 File (java.io.File)2228 HashMap (java.util.HashMap)2180 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2164 ArrayList (java.util.ArrayList)2137 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)2027 SqlSession (org.apache.ibatis.session.SqlSession)1845 List (java.util.List)1799 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)1484 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1184 Map (java.util.Map)1143 IOException (java.io.IOException)1048 Path (java.nio.file.Path)1006 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)935 Date (java.util.Date)914 Method (java.lang.reflect.Method)862 TestBean (org.springframework.beans.testfixture.beans.TestBean)822 Transaction (org.neo4j.graphdb.Transaction)752 BaseDataTest (org.apache.ibatis.BaseDataTest)740