public List<? extends MqttProperty> getProperties(int propertyId) {
        if (propertyId == MqttPropertyType.USER_PROPERTY.value) {
            return userProperties == null ? Collections.<MqttProperty>emptyList() : userProperties;
        }
        if (propertyId == MqttPropertyType.SUBSCRIPTION_IDENTIFIER.value) {
            return subscriptionIds == null ? Collections.<MqttProperty>emptyList() : subscriptionIds;
        }
        IntObjectHashMap<MqttProperty> props = this.props;
        return (props == null || !props.containsKey(propertyId)) ?
                Collections.<MqttProperty>emptyList() :
                Collections.singletonList(props.get(propertyId));
    }
@Test
    public void testGetProperties() {
        MqttProperties props = createSampleProperties();

        assertEquals(
                Collections.singletonList(new MqttProperties.StringProperty(CONTENT_TYPE.value(), "text/plain")),
                props.getProperties(CONTENT_TYPE.value()));

        List<MqttProperties.IntegerProperty> expectedSubscriptionIds = new ArrayList<MqttProperties.IntegerProperty>();
        expectedSubscriptionIds.add(new MqttProperties.IntegerProperty(SUBSCRIPTION_IDENTIFIER.value(), 10));
        expectedSubscriptionIds.add(new MqttProperties.IntegerProperty(SUBSCRIPTION_IDENTIFIER.value(), 20));
        assertEquals(
                expectedSubscriptionIds,
               props.getProperties(SUBSCRIPTION_IDENTIFIER.value()));

        List<MqttProperties.UserProperty> expectedUserProps = new ArrayList<MqttProperties.UserProperty>();
        expectedUserProps.add(new MqttProperties.UserProperty("isSecret", "true"));
        expectedUserProps.add(new MqttProperties.UserProperty("tag", "firstTag"));
        expectedUserProps.add(new MqttProperties.UserProperty("tag", "secondTag"));
        List<MqttProperties.UserProperty> actualUserProps =
                (List<MqttProperties.UserProperty>) props.getProperties(USER_PROPERTY.value());
        assertEquals(expectedUserProps, actualUserProps);
    }