Remove allure (phase2) (#2483)
Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
@@ -19,23 +19,22 @@ import java.util.Collections;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serialization of DDI api model 'DdiActionFeedback'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serialization of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serialization of DDI api Models")
|
||||
class DdiActionFeedbackTest {
|
||||
|
||||
private final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model with minimal payload")
|
||||
void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model with minimal payload
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObjectWithoutOptionalValues() throws IOException {
|
||||
// Setup
|
||||
final DdiStatus ddiStatus = new DdiStatus(DdiStatus.ExecutionStatus.CLOSED, null, null, Collections.emptyList());
|
||||
final DdiActionFeedback ddiActionFeedback = new DdiActionFeedback(ddiStatus);
|
||||
@@ -48,9 +47,10 @@ class DdiActionFeedbackTest {
|
||||
assertThat(deserializedDdiActionFeedback.getStatus()).hasToString(ddiStatus.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model with all values provided")
|
||||
void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model with all values provided
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObjectWithOptionalValues() throws IOException {
|
||||
// Setup
|
||||
final Long timestamp = System.currentTimeMillis();
|
||||
final DdiResult ddiResult = new DdiResult(DdiResult.FinalResult.SUCCESS, new DdiProgress(10, 10));
|
||||
@@ -65,9 +65,10 @@ class DdiActionFeedbackTest {
|
||||
assertThat(deserializedDdiActionFeedback.getStatus()).hasToString(ddiStatus.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiActionFeedback = """
|
||||
{
|
||||
@@ -83,9 +84,10 @@ class DdiActionFeedbackTest {
|
||||
() -> mapper.readValue(serializedDdiActionFeedback, DdiActionFeedback.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization works if optional fields are not parsed")
|
||||
void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
|
||||
/**
|
||||
* Verify that deserialization works if optional fields are not parsed
|
||||
*/
|
||||
@Test void shouldConvertItWithoutOptionalFieldTimestamp() throws JsonProcessingException {
|
||||
// Setup
|
||||
final String serializedDdiActionFeedback = """
|
||||
{
|
||||
|
||||
@@ -19,23 +19,22 @@ import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiActionHistory'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiActionHistoryTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String actionStatus = "TestAction";
|
||||
final List<String> messages = Arrays.asList("Action status message 1", "Action status message 2");
|
||||
@@ -48,9 +47,10 @@ class DdiActionHistoryTest {
|
||||
assertThat(deserializedDdiActionHistory.toString()).contains(actionStatus, messages.get(0), messages.get(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiActionHistory = """
|
||||
{
|
||||
@@ -64,9 +64,10 @@ class DdiActionHistoryTest {
|
||||
assertThat(ddiActionHistory.toString()).contains("SomeAction", "Some message");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiActionFeedback = """
|
||||
{
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiArtifactHash'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiArtifactHashTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String sha1Hash = "11111";
|
||||
final String md5Hash = "22222";
|
||||
@@ -49,9 +48,10 @@ class DdiArtifactHashTest {
|
||||
assertThat(deserializedDdiArtifact.getSha256()).isEqualTo(sha256Hash);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"sha1\": \"123\", \"md5\": \"456\", \"sha256\": \"789\", \"unknownProperty\": \"test\"}";
|
||||
|
||||
@@ -62,9 +62,10 @@ class DdiArtifactHashTest {
|
||||
assertThat(ddiArtifact.getSha256()).isEqualTo("789");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"sha1\": [123], \"md5\": 456, \"sha256\": \"789\"";
|
||||
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiArtifact'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiArtifactTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String filename = "testfile.txt";
|
||||
final DdiArtifactHash hashes = new DdiArtifactHash("123", "456", "789");
|
||||
@@ -52,9 +51,10 @@ class DdiArtifactTest {
|
||||
assertThat(deserializedDdiArtifact.getHashes().getSha256()).isEqualTo(hashes.getSha256());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"filename\":\"test.file\",\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[],\"unknownProperty\": \"test\"}";
|
||||
|
||||
@@ -67,9 +67,10 @@ class DdiArtifactTest {
|
||||
assertThat(ddiArtifact.getHashes().getSha256()).isEqualTo("789");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiArtifact = "{\"filename\": [\"test.file\"],\"hashes\":{\"sha1\":\"123\",\"md5\":\"456\",\"sha256\":\"789\"},\"size\":111,\"links\":[]}";
|
||||
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiCancelActionToStop'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiCancelActionToStopTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String stopId = "1234";
|
||||
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop(stopId);
|
||||
@@ -46,9 +45,10 @@ class DdiCancelActionToStopTest {
|
||||
assertThat(deserializedDdiCancelActionToStop.getStopId()).isEqualTo(stopId);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiCancelActionToStop = "{\"stopId\":\"12345\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -58,9 +58,10 @@ class DdiCancelActionToStopTest {
|
||||
assertThat(ddiCancelActionToStop.getStopId()).contains("12345");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiCancelActionToStop = "{\"stopId\": [\"12345\"]}";
|
||||
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiArtifact'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiCancelTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String ddiCancelId = "1234";
|
||||
final DdiCancelActionToStop ddiCancelActionToStop = new DdiCancelActionToStop("1234");
|
||||
@@ -47,9 +46,10 @@ class DdiCancelTest {
|
||||
assertThat(deserializedDdiCancel.getCancelAction().getStopId()).isEqualTo(ddiCancelActionToStop.getStopId());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiCancel = "{\"id\":\"1234\",\"cancelAction\":{\"stopId\":\"1234\"}, \"unknownProperty\": \"test\"}";
|
||||
|
||||
@@ -59,9 +59,10 @@ class DdiCancelTest {
|
||||
assertThat(ddiCancel.getCancelAction().getStopId()).matches("1234");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiCancel = "{\"id\":[\"1234\"],\"cancelAction\":{\"stopId\":\"1234\"}}";
|
||||
|
||||
|
||||
@@ -19,23 +19,22 @@ import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiChunk'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiChunkTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String part = "1234";
|
||||
final String version = "1.0";
|
||||
@@ -53,9 +52,10 @@ class DdiChunkTest {
|
||||
assertThat(deserializedDdiChunk.getArtifacts()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiChunk = "{\"part\":\"1234\",\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[],\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -67,9 +67,10 @@ class DdiChunkTest {
|
||||
assertThat(ddiChunk.getArtifacts()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiChunk = "{\"part\":[\"1234\"],\"version\":\"1.0\",\"name\":\"Dummy-Artifact\",\"artifacts\":[]}";
|
||||
|
||||
|
||||
@@ -19,23 +19,22 @@ import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiConfigData'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiConfigDataTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final Map<String, String> data = new HashMap<>();
|
||||
data.put("test", "data");
|
||||
@@ -48,9 +47,10 @@ class DdiConfigDataTest {
|
||||
assertThat(deserializedDdiConfigData.getMode()).isEqualTo(DdiUpdateMode.REPLACE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with an additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with an additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":\"replace\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -59,9 +59,10 @@ class DdiConfigDataTest {
|
||||
assertThat(ddiConfigData.getMode()).isEqualTo(DdiUpdateMode.REPLACE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiConfigData = "{\"data\":{\"test\":\"data\"},\"mode\":[\"replace\"],\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -70,9 +71,10 @@ class DdiConfigDataTest {
|
||||
.isThrownBy(() -> OBJECT_MAPPER.readValue(serializedDdiConfigData, DdiConfigData.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with removed unused status property")
|
||||
void shouldDeserializeObjectWithStatusProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with removed unused status property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithStatusProperty() throws IOException {
|
||||
// We formerly falsely required a 'status' property object when using the
|
||||
// configData endpoint. It was removed as a requirement from code and
|
||||
// documentation, as it was unused. This test ensures we still behave correctly
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiConfig'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiConfigTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiPolling ddiPolling = new DdiPolling("10");
|
||||
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
|
||||
@@ -45,9 +44,10 @@ class DdiConfigTest {
|
||||
assertThat(deserializedDdiConfig.getPolling().getSleep()).isEqualTo("10");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiConfig = "{\"polling\":{\"sleep\":\"123\"},\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -56,9 +56,10 @@ class DdiConfigTest {
|
||||
assertThat(ddiConfig.getPolling().getSleep()).isEqualTo("123");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiConfig = "{\"polling\":{\"sleep\":[\"10\"]}}";
|
||||
|
||||
|
||||
@@ -22,23 +22,22 @@ import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiConfirmationBase'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: CHeck JSON serialization of DDI api confirmation models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("CHeck JSON serialization of DDI api confirmation models")
|
||||
class DdiConfirmationBaseTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String id = "1234";
|
||||
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
|
||||
@@ -63,9 +62,10 @@ class DdiConfirmationBaseTest {
|
||||
.hasToString(ddiActionHistory.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiConfirmationBase = "{" +
|
||||
"\"id\":\"1234\",\"confirmation\":{\"download\":\"forced\"," +
|
||||
@@ -84,9 +84,10 @@ class DdiConfirmationBaseTest {
|
||||
.isEqualTo(AVAILABLE.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiConfirmationBase = "{" +
|
||||
"\"id\":[\"1234\"],\"confirmation\":{\"download\":\"forced\"," +
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiControllerBase'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiControllerBaseTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiPolling ddiPolling = new DdiPolling("10");
|
||||
final DdiConfig ddiConfig = new DdiConfig(ddiPolling);
|
||||
@@ -46,9 +45,10 @@ class DdiControllerBaseTest {
|
||||
assertThat(deserializedDdiControllerBase.getConfig().getPolling().getSleep()).isEqualTo(ddiPolling.getSleep());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":\"123\"}},\"links\":[],\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -57,9 +57,10 @@ class DdiControllerBaseTest {
|
||||
assertThat(ddiControllerBase.getConfig().getPolling().getSleep()).isEqualTo("123");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiControllerBase = "{\"config\":{\"polling\":{\"sleep\":[\"123\"]}},\"links\":[],\"unknownProperty\":\"test\"}";
|
||||
|
||||
|
||||
@@ -22,23 +22,22 @@ import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiDeploymentBase'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiDeploymentBaseTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String id = "1234";
|
||||
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
|
||||
@@ -57,9 +56,10 @@ class DdiDeploymentBaseTest {
|
||||
assertThat(deserializedDdiDeploymentBase.getActionHistory()).hasToString(ddiActionHistory.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiDeploymentBase = "{\"id\":\"1234\",\"deployment\":{\"download\":\"forced\"," +
|
||||
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +
|
||||
@@ -73,9 +73,10 @@ class DdiDeploymentBaseTest {
|
||||
assertThat(ddiDeploymentBase.getDeployment().getMaintenanceWindow().getStatus()).isEqualTo(AVAILABLE.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiDeploymentBase = "{\"id\":[\"1234\"],\"deployment\":{\"download\":\"forced\"," +
|
||||
"\"update\":\"attempt\",\"maintenanceWindow\":\"available\",\"chunks\":[]}," +
|
||||
|
||||
@@ -21,23 +21,22 @@ import java.util.Collections;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiDeployment'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiDeploymentTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiDeployment ddiDeployment = new DdiDeployment(FORCED, ATTEMPT, Collections.emptyList(), AVAILABLE);
|
||||
|
||||
@@ -51,9 +50,10 @@ class DdiDeploymentTest {
|
||||
assertThat(deserializedDdiDeployment.getMaintenanceWindow().getStatus()).isEqualTo(ddiDeployment.getMaintenanceWindow().getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiDeployment = "{\"download\":\"forced\",\"update\":\"attempt\", " +
|
||||
"\"maintenanceWindow\":\"available\",\"chunks\":[],\"unknownProperty\":\"test\"}";
|
||||
@@ -65,9 +65,10 @@ class DdiDeploymentTest {
|
||||
assertThat(ddiDeployment.getMaintenanceWindow().getStatus()).isEqualTo(AVAILABLE.getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiDeployment = "{\"download\":[\"forced\"],\"update\":\"attempt\", " +
|
||||
"\"maintenanceWindow\":\"available\",\"chunks\":[]}";
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiMetadata'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiMetadataTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final String key = "testKey";
|
||||
final String value = "testValue";
|
||||
@@ -47,9 +46,10 @@ class DdiMetadataTest {
|
||||
assertThat(deserializedDdiMetadata.getValue()).isEqualTo(ddiMetadata.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiMetadata = "{\"key\":\"testKey\",\"value\":\"testValue\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -59,9 +59,10 @@ class DdiMetadataTest {
|
||||
assertThat(ddiMetadata.getValue()).isEqualTo("testValue");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiMetadata = "{\"key\":[\"testKey\"],\"value\":\"testValue\"}";
|
||||
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiPolling'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiPollingTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiPolling ddiPolling = new DdiPolling("10");
|
||||
|
||||
@@ -44,9 +43,10 @@ class DdiPollingTest {
|
||||
assertThat(deserializedDdiPolling.getSleep()).isEqualTo(ddiPolling.getSleep());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiPolling = "{\"sleep\":\"10\",\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -55,9 +55,10 @@ class DdiPollingTest {
|
||||
assertThat(ddiPolling.getSleep()).isEqualTo("10");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiPolling = "{\"sleep\":[\"10\"]}";
|
||||
|
||||
|
||||
@@ -17,23 +17,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiProgress'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiProgressTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiProgress ddiProgress = new DdiProgress(30, 100);
|
||||
|
||||
@@ -45,9 +44,10 @@ class DdiProgressTest {
|
||||
assertThat(deserializedDdiProgress.getOf()).isEqualTo(ddiProgress.getOf());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiProgress = "{\"cnt\":30,\"of\":100,\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -57,9 +57,10 @@ class DdiProgressTest {
|
||||
assertThat(ddiProgress.getOf()).isEqualTo(100);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiProgress = "{\"cnt\":[30],\"of\":100}";
|
||||
|
||||
|
||||
@@ -18,23 +18,22 @@ import java.io.IOException;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiResult'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiResultTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@Test void shouldSerializeAndDeserializeObject() throws IOException {
|
||||
// Setup
|
||||
final DdiProgress ddiProgress = new DdiProgress(30, 100);
|
||||
final DdiResult ddiResult = new DdiResult(NONE, ddiProgress);
|
||||
@@ -48,9 +47,10 @@ class DdiResultTest {
|
||||
assertThat(deserializedDdiResult.getProgress().getOf()).isEqualTo(ddiProgress.getOf());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiResult = "{\"finished\":\"none\",\"progress\":{\"cnt\":30,\"of\":100},\"unknownProperty\":\"test\"}";
|
||||
|
||||
@@ -61,9 +61,10 @@ class DdiResultTest {
|
||||
assertThat(ddiResult.getProgress().getOf()).isEqualTo(100);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiResult = "{\"finished\":[\"none\"],\"progress\":{\"cnt\":30,\"of\":100}}";
|
||||
|
||||
|
||||
@@ -21,9 +21,6 @@ import java.util.stream.Stream;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
@@ -31,16 +28,19 @@ import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
/**
|
||||
* Test serializability of DDI api model 'DdiStatus'
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serializability of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serializability of DDI api Models")
|
||||
class DdiStatusTest {
|
||||
|
||||
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||
|
||||
/**
|
||||
* Verify the correct serialization and deserialization of the model
|
||||
*/
|
||||
@ParameterizedTest
|
||||
@MethodSource("ddiStatusPossibilities")
|
||||
@Description("Verify the correct serialization and deserialization of the model")
|
||||
void shouldSerializeAndDeserializeObject(final DdiResult ddiResult, final DdiStatus ddiStatus) throws IOException {
|
||||
// Test
|
||||
final String serializedDdiStatus = OBJECT_MAPPER.writeValueAsString(ddiStatus);
|
||||
@@ -54,9 +54,10 @@ class DdiStatusTest {
|
||||
assertThat(deserializedDdiStatus.getDetails()).isEqualTo(ddiStatus.getDetails());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a additional unknown property")
|
||||
void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a additional unknown property
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithUnknownProperty() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
|
||||
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[],\"unknownProperty\":\"test\"}";
|
||||
@@ -70,9 +71,10 @@ class DdiStatusTest {
|
||||
assertThat(ddiStatus.getResult().getProgress().getOf()).isEqualTo(100);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify the correct deserialization of a model with a provided code (optional)")
|
||||
void shouldDeserializeObjectWithOptionalCode() throws IOException {
|
||||
/**
|
||||
* Verify the correct deserialization of a model with a provided code (optional)
|
||||
*/
|
||||
@Test void shouldDeserializeObjectWithOptionalCode() throws IOException {
|
||||
// Setup
|
||||
final String serializedDdiStatus = "{\"execution\":\"proceeding\",\"result\":{\"finished\":\"none\"," +
|
||||
"\"progress\":{\"cnt\":30,\"of\":100}},\"code\": 12,\"details\":[]}";
|
||||
@@ -86,9 +88,10 @@ class DdiStatusTest {
|
||||
assertThat(ddiStatus.getResult().getProgress().getOf()).isEqualTo(100);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Description("Verify that deserialization fails for known properties with a wrong datatype")
|
||||
void shouldFailForObjectWithWrongDataTypes() {
|
||||
/**
|
||||
* Verify that deserialization fails for known properties with a wrong datatype
|
||||
*/
|
||||
@Test void shouldFailForObjectWithWrongDataTypes() {
|
||||
// Setup
|
||||
final String serializedDdiStatus = "{\"execution\":[\"proceeding\"],\"result\":{\"finished\":\"none\"," +
|
||||
"\"progress\":{\"cnt\":30,\"of\":100}},\"details\":[]}";
|
||||
|
||||
@@ -18,21 +18,20 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import io.github.classgraph.ClassGraph;
|
||||
import io.github.classgraph.ClassInfo;
|
||||
import io.github.classgraph.ScanResult;
|
||||
import io.qameta.allure.Description;
|
||||
import io.qameta.allure.Feature;
|
||||
import io.qameta.allure.Story;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* Check DDI api model classes for '@JsonIgnoreProperties' annotation
|
||||
* <p/>
|
||||
* Feature: Unit Tests - Direct Device Integration API<br/>
|
||||
* Story: Serialization of DDI api Models
|
||||
*/
|
||||
@Feature("Unit Tests - Direct Device Integration API")
|
||||
@Story("Serialization of DDI api Models")
|
||||
class JsonIgnorePropertiesAnnotationTest {
|
||||
|
||||
@Test
|
||||
@Description("This test verifies that all model classes within the 'org.eclipse.hawkbit.ddi.json.model' package are annotated with '@JsonIgnoreProperties(ignoreUnknown = true)'")
|
||||
void shouldCheckAnnotationsForAllModelClasses() {
|
||||
/**
|
||||
* This test verifies that all model classes within the 'org.eclipse.hawkbit.ddi.json.model' package are annotated with '@JsonIgnoreProperties(ignoreUnknown = true)'
|
||||
*/
|
||||
@Test void shouldCheckAnnotationsForAllModelClasses() {
|
||||
final String packageName = getClass().getPackage().getName();
|
||||
try (final ScanResult scanResult = new ClassGraph().acceptPackages(packageName).scan()) {
|
||||
final List<? extends Class<?>> matchingClasses = scanResult.getAllClasses()
|
||||
|
||||
Reference in New Issue
Block a user