test_class.declarator: dictionary
test_class.modifier: private static
test_class.original_string: private static IDictionaryStructure dictionary;
test_class.type: IDictionaryStructure
test_class.var_name: dictionary
test_class.declarator: strictMessageFactory
test_class.modifier: private static
test_class.original_string: private static StrictMessageFactoryWrapper strictMessageFactory;
test_class.type: StrictMessageFactoryWrapper
test_class.var_name: strictMessageFactory
test_class.declarator: dictionaryName = "/messages/strictMessage.xml"
test_class.modifier: private static final
test_class.original_string: private static final String dictionaryName = "/messages/strictMessage.xml";
test_class.type: String
test_class.var_name: dictionaryName
test_class.declarator: namespace = "TestStrictmessage"
test_class.modifier: private final
test_class.original_string: private final String namespace = "TestStrictmessage";
test_class.type: String
test_class.var_name: namespace
test_class.declarator: expectedException = ExpectedException.none()
test_class.modifier: @Rule
      public
test_class.original_string: @Rule
      public ExpectedException expectedException = ExpectedException.none();
test_class.type: ExpectedException
test_class.var_name: expectedException
test_class.file: BackEnd/Core/sailfish-core/src/test/java/com/exactpro/sf/common/impl/messages/TestStrictMessageWrapper.java
test_class.identifier: TestStrictMessageWrapper
test_case.body: @Test
      public void testPositive() {
          String msgName = "TestMessage";
          IMessage strictMsg = createStrictMessage(msgName);
  
          // add normal fields
          strictMsg.addField("boolean", true);
          strictMsg.addField("boolean_collection", Arrays.asList(true, false));
          strictMsg.addField("integer", 10);
          strictMsg.addField("integer_collection", Arrays.asList(-1, 0, 1));
          strictMsg.addField("string", "hello");
          strictMsg.addField("string_collection", Arrays.asList("abc", "def"));
          strictMsg.addField("short", 10);
          strictMsg.addField("short_collection", Arrays.asList(20, 30, 40));
          strictMsg.addField("long", 50l);
          strictMsg.addField("long_collection", Arrays.asList(60l, 70l, 80l));
          strictMsg.addField("byte", 1);
          strictMsg.addField("byte_collection", Arrays.asList(3, 5, 7));
          strictMsg.addField("float", 1.1f);
          strictMsg.addField("float_collection", Arrays.asList(3.3f, 5.5f, 7.7f));
          strictMsg.addField("double", 10.1d);
          strictMsg.addField("double_collection", Arrays.asList(30.3d, 50.5d, 70.7d));
          strictMsg.addField("character", 'a');
          strictMsg.addField("character_collection", Arrays.asList('b', 'c', 'd'));
          strictMsg.addField("bigDecimal", new BigDecimal("100.7"));
          strictMsg.addField("bigDecimal_collection",
                  Arrays.asList(new BigDecimal("10.5"), new BigDecimal("20.5")));
          strictMsg.addField("datetime", LocalDateTime.now());
          strictMsg.addField("datetime_collection", Arrays
                  .asList(LocalDateTime.now().plusWeeks(1), LocalDateTime.now().plusWeeks(2)));
          strictMsg.addField("date", LocalDate.now());
          strictMsg.addField("date_collection",
                  Arrays.asList(LocalDate.now().plusWeeks(1), LocalDate.now().plusWeeks(2)));
          strictMsg.addField("time", LocalTime.now());
          strictMsg.addField("time_collection",
                  Arrays.asList(LocalTime.now().plusHours(1), LocalTime.now().plusHours(2)));
          strictMsg.addField("message", wrappedTestMsg());
          strictMsg.addField("message_collection", Arrays.asList(wrappedTestMsg(), wrappedTestMsg()));
  
          // add collection in none-collection field
          strictMsg.addField("integer", Arrays.asList(99));
  
          // add single element in collection
          strictMsg.addField("double_collection", 10.1d);
  
          System.out.println(strictMsg);
      }
test_case.class_method_signature: TestStrictMessageWrapper.testPositive()
test_case.full_signature: @Test public void testPositive()
test_case.identifier: testPositive
test_case.invocations: createStrictMessage addField addField asList addField addField asList addField addField asList addField addField asList addField addField asList addField addField asList addField addField asList addField addField asList addField addField asList addField addField asList addField now addField asList plusWeeks now plusWeeks now addField now addField asList plusWeeks now plusWeeks now addField now addField asList plusHours now plusHours now addField wrappedTestMsg addField asList wrappedTestMsg wrappedTestMsg addField asList addField println
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPositive()
focal_class.declarator: messageStructure
focal_class.modifier: private final
focal_class.original_string: private final IMessageStructure messageStructure;
focal_class.type: IMessageStructure
focal_class.var_name: messageStructure
focal_class.declarator: message
focal_class.modifier: private final
focal_class.original_string: private final IMessage message;
focal_class.type: IMessage
focal_class.var_name: message
focal_class.file: BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/common/impl/messages/StrictMessageWrapper.java
focal_class.identifier: StrictMessageWrapper
focal_class.interfaces: implements IMessage
focal_class.class_method_signature: StrictMessageWrapper.StrictMessageWrapper(IMessage message, IMessageStructure messageStructure)
focal_class.full_signature: public  StrictMessageWrapper(IMessage message, IMessageStructure messageStructure)
focal_class.identifier: StrictMessageWrapper
focal_class.modifiers: public
focal_class.parameters: (IMessage message, IMessageStructure messageStructure)
focal_class.signature:  StrictMessageWrapper(IMessage message, IMessageStructure messageStructure)
focal_class.class_method_signature: StrictMessageWrapper.castValueToCollection(Object value, Class<T> elementClass)
focal_class.full_signature: protected List<T> castValueToCollection(Object value, Class<T> elementClass)
focal_class.identifier: castValueToCollection
focal_class.modifiers: protected
focal_class.parameters: (Object value, Class<T> elementClass)
focal_class.return: List<T>
focal_class.signature: List<T> castValueToCollection(Object value, Class<T> elementClass)
focal_class.class_method_signature: StrictMessageWrapper.addField(String name, Object value)
focal_class.full_signature: @Override public void addField(String name, Object value)
focal_class.identifier: addField
focal_class.modifiers: @Override public
focal_class.parameters: (String name, Object value)
focal_class.return: void
focal_class.signature: void addField(String name, Object value)
focal_class.class_method_signature: StrictMessageWrapper.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: StrictMessageWrapper.getNamespace()
focal_class.full_signature: @Override public String getNamespace()
focal_class.identifier: getNamespace
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getNamespace()
focal_class.class_method_signature: StrictMessageWrapper.getMetaData()
focal_class.full_signature: @Override public MsgMetaData getMetaData()
focal_class.identifier: getMetaData
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: MsgMetaData
focal_class.signature: MsgMetaData getMetaData()
focal_class.class_method_signature: StrictMessageWrapper.removeField(String name)
focal_class.full_signature: @Override public Object removeField(String name)
focal_class.identifier: removeField
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: Object
focal_class.signature: Object removeField(String name)
focal_class.class_method_signature: StrictMessageWrapper.getField(String name)
focal_class.full_signature: @Override public T getField(String name)
focal_class.identifier: getField
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: T
focal_class.signature: T getField(String name)
focal_class.class_method_signature: StrictMessageWrapper.getFieldMetaData(String name)
focal_class.full_signature: @Override public FieldMetaData getFieldMetaData(String name)
focal_class.identifier: getFieldMetaData
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: FieldMetaData
focal_class.signature: FieldMetaData getFieldMetaData(String name)
focal_class.class_method_signature: StrictMessageWrapper.isFieldSet(String name)
focal_class.full_signature: @Override public boolean isFieldSet(String name)
focal_class.identifier: isFieldSet
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: boolean
focal_class.signature: boolean isFieldSet(String name)
focal_class.class_method_signature: StrictMessageWrapper.getFieldNames()
focal_class.full_signature: @Override public Set<String> getFieldNames()
focal_class.identifier: getFieldNames
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Set<String>
focal_class.signature: Set<String> getFieldNames()
focal_class.class_method_signature: StrictMessageWrapper.getFieldInfo(String name)
focal_class.full_signature: @Override public IFieldInfo getFieldInfo(String name)
focal_class.identifier: getFieldInfo
focal_class.modifiers: @Override public
focal_class.parameters: (String name)
focal_class.return: IFieldInfo
focal_class.signature: IFieldInfo getFieldInfo(String name)
focal_class.class_method_signature: StrictMessageWrapper.cloneMessage()
focal_class.full_signature: @Override public IMessage cloneMessage()
focal_class.identifier: cloneMessage
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: IMessage
focal_class.signature: IMessage cloneMessage()
focal_class.class_method_signature: StrictMessageWrapper.compare(IMessage message)
focal_class.full_signature: @Override public boolean compare(IMessage message)
focal_class.identifier: compare
focal_class.modifiers: @Override public
focal_class.parameters: (IMessage message)
focal_class.return: boolean
focal_class.signature: boolean compare(IMessage message)
focal_class.class_method_signature: StrictMessageWrapper.getFieldCount()
focal_class.full_signature: @Override public int getFieldCount()
focal_class.identifier: getFieldCount
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getFieldCount()
focal_class.class_method_signature: StrictMessageWrapper.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: StrictMessageWrapper.requiredNotNull(Object value, IFieldStructure fieldStructure)
focal_class.full_signature: private Object requiredNotNull(Object value, IFieldStructure fieldStructure)
focal_class.identifier: requiredNotNull
focal_class.modifiers: private
focal_class.parameters: (Object value, IFieldStructure fieldStructure)
focal_class.return: Object
focal_class.signature: Object requiredNotNull(Object value, IFieldStructure fieldStructure)
focal_class.class_method_signature: StrictMessageWrapper.extractValueFromCollection(List<?> collection)
focal_class.full_signature: private Object extractValueFromCollection(List<?> collection)
focal_class.identifier: extractValueFromCollection
focal_class.modifiers: private
focal_class.parameters: (List<?> collection)
focal_class.return: Object
focal_class.signature: Object extractValueFromCollection(List<?> collection)
focal_class.class_method_signature: StrictMessageWrapper.checkElement(Object element, Class<T> elementClass)
focal_class.full_signature: @SuppressWarnings("unchecked") private T checkElement(Object element, Class<T> elementClass)
focal_class.identifier: checkElement
focal_class.modifiers: @SuppressWarnings("unchecked") private
focal_class.parameters: (Object element, Class<T> elementClass)
focal_class.return: T
focal_class.signature: T checkElement(Object element, Class<T> elementClass)
focal_method.body: @Override
      public void addField(String name, Object value) {
          IFieldStructure fieldStructure = messageStructure.getFields().get(name);
          if (fieldStructure == null) {
              message.addField(name, value);
              return;
          }
  
          if (value == null) {
              message.addField(name, requiredNotNull(value, fieldStructure));
              return;
          }
  
          if (fieldStructure.isComplex()) {
              if (fieldStructure.isCollection()) {
                  message.addField(name, castValueToCollection(value, StrictMessageWrapper.class));
              } else {
                  Object element = value;
                  if (value instanceof List<?>) {
                      element = extractValueFromCollection((List<?>)value);
                  }
                  message.addField(name, checkElement(requiredNotNull(element, fieldStructure), StrictMessageWrapper.class));
              }
          } else {
              try {
                  Class<?> clazz = getClass().getClassLoader().loadClass(fieldStructure.getJavaType().value());
  
                  if (fieldStructure.isCollection()) {
                      message.addField(name, castValueToCollection(value, clazz));
                  } else {
                      Object element = value;
                      if (value instanceof List<?>) {
                          element = extractValueFromCollection((List<?>)value);
                      }
                      message.addField(name, checkElement(requiredNotNull(element, fieldStructure), clazz));
                  }
              } catch (ClassNotFoundException e) {
                  throw new EPSCommonException("Unknown field type: " + fieldStructure.getJavaType().value(), e);
              }
          }
      }
focal_method.class_method_signature: StrictMessageWrapper.addField(String name, Object value)
focal_method.full_signature: @Override public void addField(String name, Object value)
focal_method.identifier: addField
focal_method.invocations: get getFields addField addField requiredNotNull isComplex isCollection addField castValueToCollection extractValueFromCollection addField checkElement requiredNotNull loadClass getClassLoader getClass value getJavaType isCollection addField castValueToCollection extractValueFromCollection addField checkElement requiredNotNull value getJavaType
focal_method.modifiers: @Override public
focal_method.parameters: (String name, Object value)
focal_method.return: void
focal_method.signature: void addField(String name, Object value)