From 9450d8ed72d87c08adc61eac832e28ee78476a10 Mon Sep 17 00:00:00 2001 From: baardl Date: Tue, 25 Aug 2020 12:33:29 +0200 Subject: [PATCH] #14 Clean away unused test code --- .../json/services/SubscriptionCovTest.java | 73 +------------------ 1 file changed, 1 insertion(+), 72 deletions(-) diff --git a/src/test/java/no/entra/bacnet/json/services/SubscriptionCovTest.java b/src/test/java/no/entra/bacnet/json/services/SubscriptionCovTest.java index 789b383..6d53387 100644 --- a/src/test/java/no/entra/bacnet/json/services/SubscriptionCovTest.java +++ b/src/test/java/no/entra/bacnet/json/services/SubscriptionCovTest.java @@ -7,12 +7,7 @@ import no.entra.bacnet.json.npdu.NpduParser; import no.entra.bacnet.json.npdu.NpduResult; import no.entra.bacnet.json.objects.PduType; -import org.json.JSONException; import org.junit.jupiter.api.Test; -import org.skyscreamer.jsonassert.Customization; -import org.skyscreamer.jsonassert.JSONAssert; -import org.skyscreamer.jsonassert.JSONCompareMode; -import org.skyscreamer.jsonassert.comparator.CustomComparator; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -62,72 +57,6 @@ void verifyConfirmedCOVNotificationSingleProperty() { assertEquals("uncknown", JsonPath.read(observedJson, "$.configurationRequest.sender")); assertEquals("SubscribeCov", JsonPath.read(observedJson, "$.configurationRequest.service")); assertEquals("PresentValue", JsonPath.read(observedJson, "$.configurationRequest.observations[0].name")); - assertEquals("131109",JsonPath.read(observedJson, "$.configurationRequest.observations[0].source.deviceId")); - /* - String observedAt = JsonPath.read(observedJson, "$.configurationRequest.observations[0].observedAt"); - String expectedAt = JsonPath.read(expectedJson, "$.configurationRequest.observations[0].observedAt"); - assertNotNull(observedAt); - assertEquals(observedAt, expectedAt); - JSONAssert.assertEquals(expectedJson, observedJson, - new CustomComparator(JSONCompareMode.LENIENT, - new Customization("configurationRequest.observedAt", (o1, o2) -> true), - new Customization("configurationRequest.observations.observedAt", (o1, o2) -> true) - )); -// JSONAssert.assertEquals(expectedJson, observedJson, new CustomComparator(JSONCompareMode.LENIENT, -// new Customization("configurationRequest.observations.observedAt", (o1, o2) -> true))); -// assertEqualsIgnoreTimestamp(expectedJson, observedJson, "observedAt"); - - */ - } - - @Test - public void ignoringMultipleAttributesWorks() throws JSONException { - String expected = "{" + - " \"configurationRequest\": {" + - " \"observations\": [{" + - " \"observedAt\": \"2020-08-26T11:49:14.394374\"," + - " \"name\": \"PresentValue\"," + - " \"source\": {" + - " \"deviceId\": \"131109\"," + - " \"objectId\": \"0\"" + - " }," + - " \"value\": \"2e\"" + - " }]," + - " \"observedAt\":\"now\"," + - " }," + - " \"sender\": \"unknown\"," + - " \"service\": \"SubscribeCov\"" + - "}"; - expected = "{\"configurationRequest\":{\"observations\":[{\"observedAt\":\"2020-08-25T12:23:02.183803\",\"name\":\"PresentValue\",\"source\":{\"deviceId\":\"131109\",\"objectId\":\"0\"},\"value\":\"2e\"}]},\"sender\":\"unknown\",\"service\":\"SubscribeCov\"}"; - String actual = "{" + - " \"configurationRequest\": {" + - " \"observations\": [{" + - " \"observedAt\": \"2020-08-26T11:49:14.394374\"," + - " \"name\": \"PresentValue\"," + - " \"source\": {" + - " \"deviceId\": \"131109\"," + - " \"objectId\": \"0\"" + - " }," + - " \"value\": \"2e\"" + - " }]," + - " \"observedAt\":\"later\"," + - " }," + - " \"sender\": \"unknown\"," + - " \"service\": \"SubscribeCov\"" + - "}"; - actual = "{\"configurationRequest\":{\"observations\":[{\"observedAt\":\"2020-08-25T12:23:02.183803\",\"name\":\"PresentValue\",\"source\":{\"deviceId\":\"131109\",\"objectId\":\"0\"},\"value\":\"2e\"}]},\"sender\":\"unknown\",\"service\":\"SubscribeCov\"}"; - - JSONAssert.assertEquals(expected, actual, - new CustomComparator(JSONCompareMode.LENIENT, - new Customization("configurationRequest.observedAt", (o1, o2) -> true), - new Customization("configurationRequest.observations.observedAt", (o1, o2) -> true) - )); - } - - - void assertEqualsIgnoreTimestamp(String expectedJson, String observedJson, String ignoredParameter) { - JSONAssert.assertEquals(expectedJson, observedJson, new CustomComparator(JSONCompareMode.LENIENT, - new Customization(ignoredParameter, (o1, o2) -> true))); - + assertEquals("131109", JsonPath.read(observedJson, "$.configurationRequest.observations[0].source.deviceId")); } }