App implements Serializable { public String getUrlFriendlyName() { if ( getShortName() != null ) { return getShortName() .trim() .replaceAll( "[^A-Za-z0-9\\s-]", "" ) .replaceAll( "\\s+", "-" ); } return null; }  void init( String contextPath ); @JsonProperty String getKey(); @JsonProperty boolean getIsBundledApp(); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getVersion(); void setVersion( String version ); @JsonProperty( "short_name" ) @JacksonXmlProperty( localName = "short_name", namespace = DxfNamespaces.DXF_2_0 ) String getShortName(); void setShortName( String shortName ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getName(); void setName( String name ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) AppType getAppType(); void setAppType( AppType appType ); @JsonProperty( "launch_path" ) @JacksonXmlProperty( localName = "launch_path", namespace = DxfNamespaces.DXF_2_0 ) String getLaunchPath(); void setLaunchPath( String launchPath ); @JsonProperty( "installs_allowed_from" ) @JacksonXmlProperty( localName = "installs_allowed_from", namespace = DxfNamespaces.DXF_2_0 ) String[] getInstallsAllowedFrom(); void setInstallsAllowedFrom( String[] installsAllowedFrom ); @JsonProperty( "default_locale" ) @JacksonXmlProperty( localName = "default_locale", namespace = DxfNamespaces.DXF_2_0 ) String getDefaultLocale(); void setDefaultLocale( String defaultLocale ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getDescription(); void setDescription( String description ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) AppDeveloper getDeveloper(); void setDeveloper( AppDeveloper developer ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) AppIcons getIcons(); void setIcons( AppIcons icons ); @JsonIgnore String getLocales(); void setLocales( String locales ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) AppActivities getActivities(); void setActivities( AppActivities activities ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getFolderName(); void setFolderName( String folderName ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getLaunchUrl(); void setLaunchUrl( String launchUrl ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) String getBaseUrl(); void setBaseUrl( String baseUrl ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) AppStorageSource getAppStorageSource(); void setAppStorageSource( AppStorageSource appStorageSource ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) Set<String> getAuthorities(); void setAuthorities( Set<String> authorities ); @JsonProperty @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0 ) AppStatus getAppState(); void setAppState( AppStatus appState ); @Override int hashCode(); @Override boolean equals( Object obj ); @Override String toString(); String getUrlFriendlyName(); String getSeeAppAuthority(); static final String SEE_APP_AUTHORITY_PREFIX; static final String INSTALLED_APP_PATH; }
@Test public void testGetUrlFriendlyName() { App appA = new App(); appA.setName( "Org [Facility] &Registry@" ); App appB = new App(); appB.setName( null ); assertEquals( "Org-Facility-Registry", appA.getUrlFriendlyName() ); assertNull( appB.getUrlFriendlyName() ); }