Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

Commit

Permalink
#4 Validate parsing of object-list
Browse files Browse the repository at this point in the history
  • Loading branch information
baardl committed Apr 8, 2021
1 parent 00f506d commit 0b70e9b
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package no.entra.bacnet.services;

import no.entra.bacnet.objects.ObjectId;
import no.entra.bacnet.objects.ObjectType;
import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static no.entra.bacnet.objects.ObjectType.AnalogValue;
import static org.junit.jupiter.api.Assertions.*;

/*
Structure
Array
Expand Down Expand Up @@ -47,10 +47,13 @@ void parseObjectList() throws BacnetParserException {
ReadPropertyResult readPropertyResult = ReadPropertyResultParser.parse(hexString);
assertNotNull(readPropertyResult);
assertEquals(2, readPropertyResult.getArrayIndexNumber());
ObjectId expectedObjectId = new ObjectId(ObjectType.AnalogValue, 0);
ObjectId expectedObjectId = new ObjectId(AnalogValue, 0);
Map<String, Object> readResult = readPropertyResult.getReadResult();
Object objectId = readResult.get("objectId");
ObjectId objectId = (ObjectId) readResult.get("objectId");
assertEquals(expectedObjectId, objectId);
assertEquals(0, objectId.getInstanceNumber());
assertEquals(AnalogValue, objectId.getObjectType());
assertTrue(readPropertyResult.isParsedOk());
}

@Test
Expand Down

0 comments on commit 0b70e9b

Please sign in to comment.