You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2018/11/28 22:52:07 UTC

[10/14] tomee git commit: Adjust to use json object

Adjust to use json object


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/bd401431
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/bd401431
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/bd401431

Branch: refs/heads/master
Commit: bd401431acf0d278458d5401de89d1c139e4213e
Parents: 30b75da
Author: ivanjunckes <ij...@tomitribe.com>
Authored: Mon Nov 26 15:00:38 2018 -0200
Committer: ivanjunckes <ij...@tomitribe.com>
Committed: Mon Nov 26 15:00:38 2018 -0200

----------------------------------------------------------------------
 .../src/test/java/WeatherServiceTest.java            | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/bd401431/examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java
----------------------------------------------------------------------
diff --git a/examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java b/examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java
index 074156c..f741a72 100644
--- a/examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java
+++ b/examples/mp-metrics-timed/src/test/java/WeatherServiceTest.java
@@ -57,12 +57,12 @@ public class WeatherServiceTest {
     private Client client;
 
     @Before
-    public void before(){
+    public void before() {
         this.client = ClientBuilder.newClient();
     }
 
     @After
-    public void after(){
+    public void after() {
         this.client.close();
     }
 
@@ -90,7 +90,7 @@ public class WeatherServiceTest {
                 .invoke()
                 .readEntity(String.class);
 
-        String [] expected = {
+        String[] expected = {
                 "# TYPE application:weather_day_status_seconds summary timer",
                 "# TYPE application:weather_day_status_seconds_count timer",
                 "application:weather_day_status_seconds_count 1.0",
@@ -138,7 +138,9 @@ public class WeatherServiceTest {
                 .invoke()
                 .readEntity(String.class);
 
-        String [] expected = {
+        JsonObject expectedJson = Json.createReader(new StringReader(metric)).readObject();
+
+        String[] expected = {
                 "count",
                 "meanRate",
                 "fifteenMinRate",
@@ -157,7 +159,10 @@ public class WeatherServiceTest {
         };
 
         Stream.of(expected)
-                .forEach(text -> assertTrue("Expected: " + text + " to be present in " + metric, metric.contains(text)));
+                .forEach(text ->
+                        assertTrue(
+                                "Expected: " + text + " to be present in " + metric,
+                                expectedJson.getJsonObject("weather_day_status").get("count") != null));
     }
 
     @Test