geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [geode] branch develop updated: GEODE-5007: Add unit tests to TabularResultData (#1757)
Date Mon, 09 Apr 2018 16:17:39 GMT
This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new a7701e8  GEODE-5007: Add unit tests to TabularResultData (#1757)
a7701e8 is described below

commit a7701e88bc1cc5fa3356ad5f55113606dbeae2d1
Author: Jens Deppe <jdeppe@pivotal.io>
AuthorDate: Mon Apr 9 09:17:36 2018 -0700

    GEODE-5007: Add unit tests to TabularResultData (#1757)
---
 .../internal/cli/result/TabularResultDataTest.java | 47 +++++++++++++++++++++-
 1 file changed, 45 insertions(+), 2 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/TabularResultDataTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/TabularResultDataTest.java
index f812952..496039e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/TabularResultDataTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/TabularResultDataTest.java
@@ -27,7 +27,7 @@ import org.apache.geode.test.junit.categories.UnitTest;
 @Category(UnitTest.class)
 public class TabularResultDataTest {
 
-  TabularResultData data;
+  private TabularResultData data;
 
   @Before
   public void before() throws Exception {
@@ -35,7 +35,50 @@ public class TabularResultDataTest {
   }
 
   @Test
-  public void rowColumnSize() throws Exception {
+  public void emptyTabularResultData() {
+    assertThat(data.getGfJsonObject().getString("content")).isEqualTo("{}");
+    assertThat(data.getType()).isEqualTo(ResultData.TYPE_TABULAR);
+  }
+
+  @Test
+  public void canAccumulate() {
+    data.accumulate("col1", "value1");
+    assertThat(data.getGfJsonObject().getJSONObject("content").getString("col1"))
+        .isEqualTo("[\"value1\"]");
+
+    data.accumulate("col1", "value2");
+    assertThat(data.getGfJsonObject().getJSONObject("content").getString("col1"))
+        .isEqualTo("[\"value1\",\"value2\"]");
+
+    data.accumulate("col2", "value3");
+    data.accumulate("col2", "value4");
+    assertThat(data.getGfJsonObject().getJSONObject("content").getString("col1"))
+        .isEqualTo("[\"value1\",\"value2\"]");
+    assertThat(data.getGfJsonObject().getJSONObject("content").getString("col2"))
+        .isEqualTo("[\"value3\",\"value4\"]");
+  }
+
+  @Test
+  public void canRetrieveAllValues() {
+    data.accumulate("col1", "value1");
+    data.accumulate("col1", "value2");
+    data.accumulate("col1", "value3");
+
+    assertThat(data.retrieveAllValues("col1")).containsExactly("value1", "value2", "value3");
+  }
+
+  @Test
+  public void hasHeaderAndFooter() {
+    String headerFooter = "header and footer";
+    data.setHeader(headerFooter);
+    data.setFooter(headerFooter);
+
+    assertThat(data.getGfJsonObject().getString("header")).isEqualTo(headerFooter);
+    assertThat(data.getGfJsonObject().getString("footer")).isEqualTo(headerFooter);
+  }
+
+  @Test
+  public void rowColumnSize() {
     data.accumulate("key", "value1");
     assertThat(data.rowSize("key")).isEqualTo(1);
     assertThat(data.columnSize()).isEqualTo(1);

-- 
To stop receiving notification emails like this one, please contact
jensdeppe@apache.org.

Mime
View raw message