### Question:
GenericMessageConverter implements MessageConverter { @Override public Object fromMessage(Message<?> message, Class<?> targetClass) { try { String payload = (String) message.getPayload(); if (SerializationUtils.isJson(payload)) { Msg msg = objectMapper.readValue(payload, Msg.class); String[] classNames = splitClassNames(msg.getName()); if (classNames.length == 1) { Class<?> c = Thread.currentThread().getContextClassLoader().loadClass(msg.getName()); return objectMapper.readValue(msg.msg, c); } Class<?> envelopeClass = Thread.currentThread().getContextClassLoader().loadClass(classNames[0]); Class<?> elementClass = Thread.currentThread().getContextClassLoader().loadClass(classNames[1]); JavaType type = objectMapper .getTypeFactory() .constructCollectionType((Class<? extends Collection>) envelopeClass, elementClass); return objectMapper.readValue(msg.msg, type); } } catch (Exception e) { log.warn("Deserialization of message {} failed", message, e); } return null; }  @Override Object fromMessage(Message<?> message, Class<?> targetClass); @Override Message<?> toMessage(Object payload, MessageHeaders headers);  }### Answer:
@Test public void fromMessageIoException() { Message<String> message = new GenericMessage<>("dasasd"); assertNull(genericMessageConverter.fromMessage(message, null)); }
@Test public void fromMessageClassCastException() { Message<TestData> message1 = new GenericMessage<>(testData); assertNull(genericMessageConverter.fromMessage(message1, null)); }