Skip to content

Commit 62e0022

Browse files
authored
Use Hamcrest assertions instead of JUnit in examples/metrics/filtering/se (helidon-io#1749) (helidon-io#5869)
1 parent 21dc5ee commit 62e0022

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

  • examples/metrics/filtering/se/src/test/java/io/helidon/examples/metrics/filtering/se

examples/metrics/filtering/se/src/test/java/io/helidon/examples/metrics/filtering/se/MainTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2021 Oracle and/or its affiliates.
2+
* Copyright (c) 2018, 2023 Oracle and/or its affiliates.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -33,9 +33,8 @@
3333

3434
import static org.hamcrest.MatcherAssert.assertThat;
3535
import static org.hamcrest.Matchers.containsString;
36+
import static org.hamcrest.Matchers.is;
3637
import static org.hamcrest.Matchers.not;
37-
import static org.junit.jupiter.api.Assertions.assertEquals;
38-
import static org.junit.jupiter.api.Assertions.assertTrue;
3938

4039
public class MainTest {
4140

@@ -77,31 +76,31 @@ public void testHelloWorld() {
7776
.path("/greet")
7877
.request(JsonObject.class)
7978
.await();
80-
assertEquals("Hello World!", jsonObject.getString("message"));
79+
assertThat(jsonObject.getString("message"), is("Hello World!"));
8180

8281
jsonObject = webClient.get()
8382
.path("/greet/Joe")
8483
.request(JsonObject.class)
8584
.await();
86-
assertEquals("Hello Joe!", jsonObject.getString("message"));
85+
assertThat(jsonObject.getString("message"), is("Hello Joe!"));
8786

8887
response = webClient.put()
8988
.path("/greet/greeting")
9089
.submit(TEST_JSON_OBJECT)
9190
.await();
92-
assertEquals(204, response.status().code());
91+
assertThat(response.status().code(), is(204));
9392

9493
jsonObject = webClient.get()
9594
.path("/greet/Joe")
9695
.request(JsonObject.class)
9796
.await();
98-
assertEquals("Hola Joe!", jsonObject.getString("message"));
97+
assertThat(jsonObject.getString("message"), is("Hola Joe!"));
9998

10099
response = webClient.get()
101100
.path("/metrics")
102101
.request()
103102
.await();
104-
assertEquals(200, response.status().code());
103+
assertThat(response.status().code(), is(200));
105104
}
106105

107106
@Test
@@ -113,14 +112,14 @@ public void testMetrics() {
113112
.request(String.class)
114113
.await();
115114

116-
assertTrue(get.contains("Hello World!"));
115+
assertThat(get, containsString("Hello World!"));
117116

118117
get = webClient.get()
119118
.path("/greet/Joe")
120119
.request(String.class)
121120
.await();
122121

123-
assertTrue(get.contains("Hello Joe!"));
122+
assertThat(get, containsString("Hello Joe!"));
124123

125124
String openMetricsOutput = webClient.get()
126125
.path("/metrics/application")

0 commit comments

Comments
 (0)