@Test public void testCreateWithAmqpValueBodySectionContainingUnexpectedValueThrowsISE() throws Exception { Message message = Message.Factory.create(); message.setBody(new AmqpValue("not-a-list")); try { createReceivedStreamMessageFacade(createMockAmqpConsumer(), message); fail("expected exception to be thrown"); } catch (IllegalStateException ise) { } }
@SuppressWarnings("unchecked") @Override void setBody(Section body) { if (body == null) { list = initializeEmptyBodyList(true); } else if (body instanceof AmqpValue) { Object value = ((AmqpValue) body).getValue(); if (value == null) { list = initializeEmptyBodyList(false); } else if (value instanceof List) { list = (List<Object>) value; super.setBody(body); } else { throw new IllegalStateException("Unexpected amqp-value body content type: " + value.getClass().getSimpleName()); } } else if (body instanceof AmqpSequence) { List<?> value = ((AmqpSequence) body).getValue(); if (value == null) { list = initializeEmptyBodyList(true); } else { list = (List<Object>) value; super.setBody(body); } } else { throw new IllegalStateException("Unexpected message body type: " + body.getClass().getSimpleName()); } }
AmqpJmsStreamMessageFacade extends AmqpJmsMessageFacade implements JmsStreamMessageFacade { @SuppressWarnings("unchecked") @Override void setBody(Section body) { if (body == null) { list = initializeEmptyBodyList(true); } else if (body instanceof AmqpValue) { Object value = ((AmqpValue) body).getValue(); if (value == null) { list = initializeEmptyBodyList(false); } else if (value instanceof List) { list = (List<Object>) value; super.setBody(body); } else { throw new IllegalStateException("Unexpected amqp-value body content type: " + value.getClass().getSimpleName()); } } else if (body instanceof AmqpSequence) { List<?> value = ((AmqpSequence) body).getValue(); if (value == null) { list = initializeEmptyBodyList(true); } else { list = (List<Object>) value; super.setBody(body); } } else { throw new IllegalStateException("Unexpected message body type: " + body.getClass().getSimpleName()); } } }
AmqpJmsStreamMessageFacade extends AmqpJmsMessageFacade implements JmsStreamMessageFacade { @SuppressWarnings("unchecked") @Override void setBody(Section body) { if (body == null) { list = initializeEmptyBodyList(true); } else if (body instanceof AmqpValue) { Object value = ((AmqpValue) body).getValue(); if (value == null) { list = initializeEmptyBodyList(false); } else if (value instanceof List) { list = (List<Object>) value; super.setBody(body); } else { throw new IllegalStateException("Unexpected amqp-value body content type: " + value.getClass().getSimpleName()); } } else if (body instanceof AmqpSequence) { List<?> value = ((AmqpSequence) body).getValue(); if (value == null) { list = initializeEmptyBodyList(true); } else { list = (List<Object>) value; super.setBody(body); } } else { throw new IllegalStateException("Unexpected message body type: " + body.getClass().getSimpleName()); } }  }
AmqpJmsStreamMessageFacade extends AmqpJmsMessageFacade implements JmsStreamMessageFacade { @SuppressWarnings("unchecked") @Override void setBody(Section body) { if (body == null) { list = initializeEmptyBodyList(true); } else if (body instanceof AmqpValue) { Object value = ((AmqpValue) body).getValue(); if (value == null) { list = initializeEmptyBodyList(false); } else if (value instanceof List) { list = (List<Object>) value; super.setBody(body); } else { throw new IllegalStateException("Unexpected amqp-value body content type: " + value.getClass().getSimpleName()); } } else if (body instanceof AmqpSequence) { List<?> value = ((AmqpSequence) body).getValue(); if (value == null) { list = initializeEmptyBodyList(true); } else { list = (List<Object>) value; super.setBody(body); } } else { throw new IllegalStateException("Unexpected message body type: " + body.getClass().getSimpleName()); } }  @Override AmqpJmsStreamMessageFacade copy(); @Override byte getJmsMsgType(); @Override boolean hasNext(); @Override Object peek(); @Override void pop(); @Override void put(Object value); @Override void reset(); @Override void clearBody(); @Override boolean hasBody(); @Override JmsStreamMessage asJmsMessage(); }
AmqpJmsStreamMessageFacade extends AmqpJmsMessageFacade implements JmsStreamMessageFacade { @SuppressWarnings("unchecked") @Override void setBody(Section body) { if (body == null) { list = initializeEmptyBodyList(true); } else if (body instanceof AmqpValue) { Object value = ((AmqpValue) body).getValue(); if (value == null) { list = initializeEmptyBodyList(false); } else if (value instanceof List) { list = (List<Object>) value; super.setBody(body); } else { throw new IllegalStateException("Unexpected amqp-value body content type: " + value.getClass().getSimpleName()); } } else if (body instanceof AmqpSequence) { List<?> value = ((AmqpSequence) body).getValue(); if (value == null) { list = initializeEmptyBodyList(true); } else { list = (List<Object>) value; super.setBody(body); } } else { throw new IllegalStateException("Unexpected message body type: " + body.getClass().getSimpleName()); } }  @Override AmqpJmsStreamMessageFacade copy(); @Override byte getJmsMsgType(); @Override boolean hasNext(); @Override Object peek(); @Override void pop(); @Override void put(Object value); @Override void reset(); @Override void clearBody(); @Override boolean hasBody(); @Override JmsStreamMessage asJmsMessage();  }