Clean up dependencies for London Release
[policy/apex-pdp.git] / plugins / plugins-context / plugins-context-schema / plugins-context-schema-avro / src / test / java / org / onap / policy / apex / plugins / context / schema / avro / AvroSchemaRecordTest.java
index 1477982..2977059 100644 (file)
@@ -1,7 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2016-2018 Ericsson. All rights reserved.
- *  Modifications Copyright (C) 2020 Nordix Foundation.
+ *  Modifications Copyright (C) 2020,2023 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -143,11 +143,11 @@ public class AvroSchemaRecordTest {
         schemas.getSchemasMap().put(avroSchema.getKey(), avroSchema);
         final SchemaHelper schemaHelper = new SchemaHelperFactory().createSchemaHelper(testKey, avroSchema.getKey());
 
-        GenericRecord subRecord = (GenericRecord) schemaHelper.createNewSubInstance("AddressUSRecord");
-        assertEquals(null, subRecord.get("streetAddress"));
+        final GenericRecord subRecord0 = (GenericRecord) schemaHelper.createNewSubInstance("AddressUSRecord");
+        assertThatThrownBy(() -> subRecord0.get("address")).hasMessage("Not a valid schema field: address");
 
-        subRecord = (GenericRecord) schemaHelper.createNewSubInstance("EmailAddress");
-        assertEquals(null, subRecord.get("address"));
+        final GenericRecord subRecord1 = (GenericRecord) schemaHelper.createNewSubInstance("EmailAddress");
+        assertThatThrownBy(() -> subRecord0.get("address")).hasMessage("Not a valid schema field: address");
 
         assertThatThrownBy(() -> schemaHelper.createNewSubInstance("IDontExist"))
             .hasMessage("AvroTest:0.0.1: the schema \"User\" does not have a subtype of type \"IDontExist\"");