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&ersand";
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);
}
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&ersand";
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);
}
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);
}
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);
}
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);
}
Aggregations