Widget extends DesignerArtifact implements Identifiable, Assetable { @Override public String getType() { return type; }  @JsonView({JsonViewLight.class, JsonViewPersistence.class}) String getId(); void setId(String id); @JsonView({JsonViewLight.class, JsonViewPersistence.class}) String getName(); void setName(String name); @JsonView({JsonViewLight.class, JsonViewPersistence.class}) Instant getLastUpdate(); void setLastUpdate(Instant lastUpdate); @JsonView({JsonViewPersistence.class}) String getTemplate(); void setTemplate(String template); @JsonView({JsonViewPersistence.class}) String getIcon(); void setIcon(String icon); @JsonView({JsonViewPersistence.class}) String getController(); void setController(String controller); @JsonView({JsonViewPersistence.class}) String getDescription(); void setDescription(String description); @JsonView({JsonViewLight.class, JsonViewPersistence.class}) boolean isCustom(); void setCustom(boolean custom); @JsonView({JsonViewPersistence.class}) Integer getOrder(); void setOrder(Integer order); @JsonView({JsonViewPersistence.class}) List<Property> getProperties(); void addProperty(Property property); void replaceProperty(Property oldProperty, Property newProperty); @JsonView({JsonViewPersistence.class}) Set<Asset> getAssets(); @Override void addAsset(Asset asset); @Override void addAssets(Set<Asset> assets); void setAssets(Set<Asset> assets); void deleteProperty(Property property); Property getProperty(final String propertyName); @JsonView({JsonViewLight.class}) Map<String, List<Identifiable>> getUsedBy(); void addUsedBy(String componantName, List<Identifiable> components); @JsonIgnore boolean isUsed(); @JsonView({JsonViewPersistence.class}) Set<String> getRequiredModules(); void setRequiredModules(Set<String> requiredModules); @JsonView({JsonViewPersistence.class}) Set<String> getAuthRules(); void setAuthRules(Set<String> authRules); @Override String getType(); void setType(String type); @JsonView({JsonViewPersistence.class}) boolean hasHelp(); void setHasHelp(boolean hasHelp); @Override boolean equals(final Object obj); @Override int hashCode(); @Override String toString(); static String spinalCase(String widgetId);  }
@Test public void should_have_a_default_type_on_desieralization() throws Exception { byte[] content = toByteArray(this.getClass().getResourceAsStream("widget-with-no-type.json")); Widget widget = objectMapper.readValue(content, Widget.class); assertThat(widget.getType()).isEqualTo("widget"); }