@Test public void testGetRepositoryId() { String href = "/path/to/my/resource"; assertThat( RepositoryPathUtil.getRepositoryName( href ) ).isEqualTo( "to" ); href = "path/to/my/resource"; assertThat( RepositoryPathUtil.getRepositoryName( href ) ).isEqualTo( "to" ); }
public static String getRepositoryName( final String href ) { String requestPathInfo = StringUtils.defaultString( href ); requestPathInfo = removePrefix( requestPathInfo ); if ( requestPathInfo.startsWith( "/" ) ) { requestPathInfo = requestPathInfo.substring( 1 ); } int slash = requestPathInfo.indexOf( '/' ); if ( slash > 0 ) { return requestPathInfo.substring( 0, slash ); } return requestPathInfo; }
RepositoryPathUtil { public static String getRepositoryName( final String href ) { String requestPathInfo = StringUtils.defaultString( href ); requestPathInfo = removePrefix( requestPathInfo ); if ( requestPathInfo.startsWith( "/" ) ) { requestPathInfo = requestPathInfo.substring( 1 ); } int slash = requestPathInfo.indexOf( '/' ); if ( slash > 0 ) { return requestPathInfo.substring( 0, slash ); } return requestPathInfo; } }
RepositoryPathUtil { public static String getRepositoryName( final String href ) { String requestPathInfo = StringUtils.defaultString( href ); requestPathInfo = removePrefix( requestPathInfo ); if ( requestPathInfo.startsWith( "/" ) ) { requestPathInfo = requestPathInfo.substring( 1 ); } int slash = requestPathInfo.indexOf( '/' ); if ( slash > 0 ) { return requestPathInfo.substring( 0, slash ); } return requestPathInfo; }  }
RepositoryPathUtil { public static String getRepositoryName( final String href ) { String requestPathInfo = StringUtils.defaultString( href ); requestPathInfo = removePrefix( requestPathInfo ); if ( requestPathInfo.startsWith( "/" ) ) { requestPathInfo = requestPathInfo.substring( 1 ); } int slash = requestPathInfo.indexOf( '/' ); if ( slash > 0 ) { return requestPathInfo.substring( 0, slash ); } return requestPathInfo; }  static String getRepositoryName( final String href ); }
RepositoryPathUtil { public static String getRepositoryName( final String href ) { String requestPathInfo = StringUtils.defaultString( href ); requestPathInfo = removePrefix( requestPathInfo ); if ( requestPathInfo.startsWith( "/" ) ) { requestPathInfo = requestPathInfo.substring( 1 ); } int slash = requestPathInfo.indexOf( '/' ); if ( slash > 0 ) { return requestPathInfo.substring( 0, slash ); } return requestPathInfo; }  static String getRepositoryName( final String href );  }