@Test public void shouldGenerateWithIdAndOwnerAndContent() throws JSONException { Child child = new Child("id1", "owner1", "{ 'test1' : 'value1' }"); assertThat(child.getUniqueId(), is("id1")); assertThat(child.getOwner(), is("owner1")); assertThat(child.getString("test1"), is("value1")); }
@Test public void shouldDecodeString() throws JSONException { Child child = new Child("{ 'test1' : 'value1' }"); assertThat(child.getString("test1"), is("value1")); }
@Test public void shouldTrimFieldValues() throws JSONException { Child child = new Child(); child.put("name", "\r\n line1 \r\n line2 \r\n \r\n"); assertThat(child.getString("name"), equalTo("line1 \r\n line2")); }