public Collection<? extends MqttProperty> listAll() {
        IntObjectHashMap<MqttProperty> props = this.props;
        if (props == null && subscriptionIds == null && userProperties == null) {
            return Collections.<MqttProperty>emptyList();
        }
        if (subscriptionIds == null && userProperties == null) {
            return props.values();
        }
        if (props == null && userProperties == null) {
            return subscriptionIds;
        }
        List<MqttProperty> propValues = new ArrayList<MqttProperty>(props != null ? props.size() : 1);
        if (props != null) {
            propValues.addAll(props.values());
        }
        if (subscriptionIds != null) {
            propValues.addAll(subscriptionIds);
        }
        if (userProperties != null) {
            propValues.add(UserProperties.fromUserPropertyCollection(userProperties));
        }
        return propValues;
    }
@Test
    public void testListAll() {
        MqttProperties props = createSampleProperties();

        List<MqttProperties.MqttProperty> expectedProperties = new ArrayList<MqttProperties.MqttProperty>();
        expectedProperties.add(new MqttProperties.IntegerProperty(PAYLOAD_FORMAT_INDICATOR.value(), 6));
        expectedProperties.add(new MqttProperties.StringProperty(CONTENT_TYPE.value(), "text/plain"));

        expectedProperties.add(new MqttProperties.IntegerProperty(SUBSCRIPTION_IDENTIFIER.value(), 10));
        expectedProperties.add(new MqttProperties.IntegerProperty(SUBSCRIPTION_IDENTIFIER.value(), 20));

        MqttProperties.UserProperties expectedUserProperties = new MqttProperties.UserProperties();
        expectedUserProperties.add(new MqttProperties.StringPair("isSecret", "true"));
        expectedUserProperties.add(new MqttProperties.StringPair("tag", "firstTag"));
        expectedUserProperties.add(new MqttProperties.StringPair("tag", "secondTag"));

        expectedProperties.add(expectedUserProperties);

        assertEquals(expectedProperties, props.listAll());
    }