ThingsModelFactory { public static Attributes newAttributes(final JsonObject jsonObject) { return AttributesModelFactory.newAttributes(jsonObject); } private  ThingsModelFactory(); static Attributes emptyAttributes(); static Attributes nullAttributes(); static Attributes newAttributes(final JsonObject jsonObject); static Attributes newAttributes(final String jsonString); static AttributesBuilder newAttributesBuilder(); static AttributesBuilder newAttributesBuilder(final JsonObject jsonObject); static ThingDefinition newDefinition(@Nullable final CharSequence thingDefinition); static ThingDefinition nullDefinition(); static DefinitionIdentifier newFeatureDefinitionIdentifier(final CharSequence namespace,
            final CharSequence name, final CharSequence version); static DefinitionIdentifier newFeatureDefinitionIdentifier(
            final CharSequence featureIdentifierAsCharSequence); static FeatureDefinition newFeatureDefinition(final JsonArray jsonArray); static FeatureDefinition newFeatureDefinition(final String jsonString); static FeatureDefinition nullFeatureDefinition(); static FeatureDefinitionBuilder newFeatureDefinitionBuilder(final CharSequence firstIdentifier); static FeatureDefinitionBuilder newFeatureDefinitionBuilder(final JsonArray jsonArray); static FeatureProperties emptyFeatureProperties(); static FeatureProperties nullFeatureProperties(); static FeatureProperties newFeatureProperties(final JsonObject jsonObject); static FeatureProperties newFeatureProperties(final String jsonString); static FeaturePropertiesBuilder newFeaturePropertiesBuilder(); static FeaturePropertiesBuilder newFeaturePropertiesBuilder(final JsonObject jsonObject); static Feature nullFeature(final String featureId); static Feature newFeature(final String featureId); static Feature newFeature(final String featureId, @Nullable final FeatureProperties featureProperties); static Feature newFeature(final String featureId, @Nullable final FeatureDefinition featureDefinition); static Feature newFeature(final String featureId, @Nullable final FeatureDefinition featureDefinition,
            @Nullable final FeatureProperties featureProperties); static FeatureBuilder.FromScratchBuildable newFeatureBuilder(); static FeatureBuilder.FromCopyBuildable newFeatureBuilder(final Feature feature); static FeatureBuilder.FromJsonBuildable newFeatureBuilder(final JsonObject jsonObject); static FeatureBuilder.FromJsonBuildable newFeatureBuilder(final String jsonString); static Features emptyFeatures(); static Features nullFeatures(); static Features newFeatures(final Iterable<Feature> features); static Features newFeatures(final JsonObject jsonObject); static Features newFeatures(final String jsonString); static Features newFeatures(final Feature feature, final Feature... additionalFeatures); static FeaturesBuilder newFeaturesBuilder(); static FeaturesBuilder newFeaturesBuilder(final Iterable<Feature> features); static JsonPointer validateFeaturePropertyPointer(final JsonPointer jsonPointer); static void validateJsonKeys(final JsonObject jsonObject); static Metadata emptyMetadata(); static Metadata nullMetadata(); static Metadata newMetadata(final JsonObject jsonObject); static Metadata newMetadata(final String jsonString); static MetadataBuilder newMetadataBuilder(); static MetadataBuilder newMetadataBuilder(final Metadata metadata); static ThingRevision newThingRevision(final long revisionNumber); @Deprecated static Permissions noPermissions(); static Permissions allPermissions(); static Permissions newPermissions(final Collection<Permission> permissions); static Permissions newPermissions(final Permission permission, final Permission... furtherPermissions); static Permissions newUnmodifiablePermissions(final Permission permission,
            final Permission... furtherPermissions); static AclEntry newAclEntry(final AuthorizationSubject authorizationSubject, final Permission permission,
            final Permission... furtherPermissions); static AclEntry newAclEntry(final AuthorizationSubject authorizationSubject,
            final Iterable<Permission> permissions); static AclEntry newAclEntry(final JsonObject jsonObject); @Deprecated static AclEntry newAclEntry(final CharSequence authorizationSubjectId, final JsonValue permissionsValue); @Deprecated static AccessControlListBuilder newAclBuilder(); @Deprecated static AccessControlListBuilder newAclBuilder(final Iterable<AclEntry> aclEntries); @Deprecated static AccessControlListBuilder newAclBuilder(final Optional<? extends Iterable<AclEntry>> aclEntries); @Deprecated static AccessControlList emptyAcl(); @Deprecated static AccessControlList newAcl(final AclEntry entry, final AclEntry... furtherEntries); @Deprecated static AccessControlList newAcl(final Iterable<AclEntry> entries); @Deprecated static AccessControlList newAcl(final JsonObject jsonObject); @Deprecated static AccessControlList newAcl(final String jsonString); static Thing newThing(final JsonObject jsonObject); static Thing newThing(final String jsonString); static ThingBuilder.FromScratch newThingBuilder(); static ThingBuilder.FromCopy newThingBuilder(final JsonObject jsonObject); static ThingBuilder.FromCopy newThingBuilder(final String jsonString); static ThingBuilder.FromCopy newThingBuilder(final Thing thing);  }
@Test(expected = JsonKeyInvalidException.class) public void createInvalidAttribute() { final String invalidAttribute = "invalidAttribute/"; final JsonObject jsonObject = JsonFactory.newObjectBuilder() .set(invalidAttribute, JsonFactory.newObject()) .build(); ThingsModelFactory.newAttributes(jsonObject); }
@Test(expected = JsonKeyInvalidException.class) public void createTooLargeAttribute() { final String invalidAttribute = generateStringExceedingMaxLength(); final JsonObject jsonObject = JsonFactory.newObjectBuilder() .set(invalidAttribute, JsonFactory.newObject()) .build(); ThingsModelFactory.newAttributes(jsonObject); }