use of com.google.gwt.json.client.JSONBoolean in project gwt-test-utils by gwt-test-utils.
the class JSONArrayTest method addElements.
@Test
public void addElements() {
// Given
JSONArray jsonArray = new JSONArray();
JSONString string = new JSONString("myString");
JSONBoolean bool = JSONBoolean.getInstance(true);
// Preconditions
assertThat(jsonArray.size()).isEqualTo(0);
// When
jsonArray.set(0, string);
jsonArray.set(1, bool);
// Then
assertThat(jsonArray.size()).isEqualTo(2);
assertThat(jsonArray.get(0)).isEqualTo(string);
assertThat(jsonArray.get(1)).isEqualTo(bool);
assertThat(jsonArray.get(2)).isNull();
assertThat(jsonArray.get(-1)).isNull();
}
use of com.google.gwt.json.client.JSONBoolean in project gwt-test-utils by gwt-test-utils.
the class JSONArrayTest method addElements_unbounded.
@Test
public void addElements_unbounded() {
// Given
JSONArray jsonArray = new JSONArray();
JSONString string = new JSONString("myString");
JSONBoolean bool = JSONBoolean.getInstance(true);
// Preconditions
assertThat(jsonArray.size()).isEqualTo(0);
// When
jsonArray.set(0, string);
jsonArray.set(2, bool);
// Then
assertThat(jsonArray.size()).isEqualTo(3);
assertThat(jsonArray.get(0)).isEqualTo(string);
assertThat(jsonArray.get(1)).isNull();
assertThat(jsonArray.get(2)).isEqualTo(bool);
assertThat(jsonArray.get(3)).isNull();
}
use of com.google.gwt.json.client.JSONBoolean in project perun by CESNET.
the class IsLoginAvailable method generateFinalResponse.
/**
* Generates the final response in format {value: true} or {value: false}
* @return
*/
protected JavaScriptObject generateFinalResponse() {
JSONBoolean response = JSONBoolean.getInstance(isAvailable);
JSONObject json = new JSONObject();
json.put("value", response);
return json.getJavaScriptObject();
}
Aggregations