Skip to content

Commit

Permalink
Fix flaky test replaceSmilingPlaceholder (#1373)
Browse files Browse the repository at this point in the history
Co-authored-by: balasukesh <bbelide2@fa23-cs527-002.cs.illinois.edu>
  • Loading branch information
bbelide2 and balasukesh authored Dec 2, 2023
1 parent a15215d commit af2edf9
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void replaceCryPlaceholder() throws JsonMappingException, JsonProcessingExceptio
}

@Test
void replaceSmilingPlaceholder() {
void replaceSmilingPlaceholder() throws JsonMappingException, JsonProcessingException {
Metrics metrics = Metrics.builder().name("^_^name^_^").build();
JsonElement jsonElement = new Gson().toJsonTree(metrics);
HashMap<String, Configmap> configmap = new HashMap<>();
Expand All @@ -120,7 +120,7 @@ void replaceSmilingPlaceholder() {
JsonElement res = CollectUtil.replaceSmilingPlaceholder(jsonElement, configmap);
Metrics metricsTarget = Metrics.builder().name("张三").build();
JsonElement jsonElement2 = new Gson().toJsonTree(metricsTarget);
assertEquals(jsonElement2.toString(), res.toString());
assertEquals(JSON_MAPPER.readTree(jsonElement2.toString()), JSON_MAPPER.readTree(res.toString()));


List<Metrics> metricsList = new ArrayList<>();
Expand All @@ -133,7 +133,7 @@ void replaceSmilingPlaceholder() {
metricsListTarget.add(metricsTarget);
metricsListTarget.add(metricsTarget);
JsonElement jsonArrayTarget = new Gson().toJsonTree(metricsListTarget);
assertEquals(jsonArrayTarget.toString(), res2.toString());
assertEquals(JSON_MAPPER.readTree(jsonArrayTarget.toString()), JSON_MAPPER.readTree(res2.toString()));
}

@Test
Expand Down

0 comments on commit af2edf9

Please sign in to comment.