Skip to content

Commit

Permalink
chore: add JSON parser test for Windows #1827
Browse files Browse the repository at this point in the history
  • Loading branch information
rholshausen committed Sep 26, 2024
1 parent ab4c88c commit 883f3e5
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package au.com.dius.pact.core.support.json;

import org.junit.jupiter.api.Test;

import java.util.List;
import java.util.Map;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

public class JsonParserTest {
@Test
void canParseRawVersionSelectors() {
String jsonStr = "[{\"mainBranch\": true}, {\"deployedOrReleased\": true}, {\"matchingBranch\": true}]";
JsonValue jsonValue = JsonParser.parseString(jsonStr);

JsonValue json = new JsonValue.Array(List.of(
new JsonValue.Object(Map.of("mainBranch", JsonValue.True.INSTANCE)),
new JsonValue.Object(Map.of("deployedOrReleased", JsonValue.True.INSTANCE)),
new JsonValue.Object(Map.of("matchingBranch", JsonValue.True.INSTANCE))
));
assertThat(jsonValue, is(equalTo(json)));
}
}

0 comments on commit 883f3e5

Please sign in to comment.