@Test public void pathTestMaybePath() throws Exception { final Map<String, String> someMap = new HashMap<>(); someMap.put("name", fakeFileName); someMap.put("extension", fakeExtension); when(state.getTokens()) .thenReturn(someMap); String path = maybePath(state); assertThat(path, is(equalTo(fakeFileName + "." + fakeExtension))); someMap.put("path", fakePath); path = maybePath(state); assertThat(path, is(equalTo(fakePath + "/" + fakeFileName + "." + fakeExtension))); }
public static String maybePath(final TokenMatcher.State state) { checkNotNull(state); String path = state.getTokens().get("path"); if (isNullOrEmpty(path)) { return String.format("%s.%s", match(state, "name"), match(state, "extension")); } return String.format("%s/%s.%s", path, match(state, "name"), match(state, "extension")); }
P2PathUtils { public static String maybePath(final TokenMatcher.State state) { checkNotNull(state); String path = state.getTokens().get("path"); if (isNullOrEmpty(path)) { return String.format("%s.%s", match(state, "name"), match(state, "extension")); } return String.format("%s/%s.%s", path, match(state, "name"), match(state, "extension")); } }
P2PathUtils { public static String maybePath(final TokenMatcher.State state) { checkNotNull(state); String path = state.getTokens().get("path"); if (isNullOrEmpty(path)) { return String.format("%s.%s", match(state, "name"), match(state, "extension")); } return String.format("%s/%s.%s", path, match(state, "name"), match(state, "extension")); } private  P2PathUtils(); }
P2PathUtils { public static String maybePath(final TokenMatcher.State state) { checkNotNull(state); String path = state.getTokens().get("path"); if (isNullOrEmpty(path)) { return String.format("%s.%s", match(state, "name"), match(state, "extension")); } return String.format("%s/%s.%s", path, match(state, "name"), match(state, "extension")); } private  P2PathUtils(); static String path(final TokenMatcher.State state); static String maybePath(final TokenMatcher.State state); static String path(final String path, final String filename); static String path(final String path, final String filename, final String extension); static String binaryPath(final String path, final String name, final String version); static String name(final TokenMatcher.State state); static String filename(final TokenMatcher.State state); static String version(final TokenMatcher.State state); static String componentName(final TokenMatcher.State state); static String componentVersion(final TokenMatcher.State state); static String extension(final TokenMatcher.State state); static TokenMatcher.State matcherState(final Context context); static P2Attributes toP2Attributes(final String path, final TokenMatcher.State state); static P2Attributes toP2AttributesBinary(final String path, final TokenMatcher.State state); static P2Attributes getBinaryAttributesFromBlobName(final String blobName); static P2Attributes getPackageAttributesFromBlob(final StorageFacet storageFacet,
                                                          final P2TempBlobUtils p2TempBlobUtils,
                                                          final Blob blob,
                                                          final String blobName); static AssetKind getAssetKind(final String path); }
P2PathUtils { public static String maybePath(final TokenMatcher.State state) { checkNotNull(state); String path = state.getTokens().get("path"); if (isNullOrEmpty(path)) { return String.format("%s.%s", match(state, "name"), match(state, "extension")); } return String.format("%s/%s.%s", path, match(state, "name"), match(state, "extension")); } private  P2PathUtils(); static String path(final TokenMatcher.State state); static String maybePath(final TokenMatcher.State state); static String path(final String path, final String filename); static String path(final String path, final String filename, final String extension); static String binaryPath(final String path, final String name, final String version); static String name(final TokenMatcher.State state); static String filename(final TokenMatcher.State state); static String version(final TokenMatcher.State state); static String componentName(final TokenMatcher.State state); static String componentVersion(final TokenMatcher.State state); static String extension(final TokenMatcher.State state); static TokenMatcher.State matcherState(final Context context); static P2Attributes toP2Attributes(final String path, final TokenMatcher.State state); static P2Attributes toP2AttributesBinary(final String path, final TokenMatcher.State state); static P2Attributes getBinaryAttributesFromBlobName(final String blobName); static P2Attributes getPackageAttributesFromBlob(final StorageFacet storageFacet,
                                                          final P2TempBlobUtils p2TempBlobUtils,
                                                          final Blob blob,
                                                          final String blobName); static AssetKind getAssetKind(final String path); static final String PLUGIN_NAME; }