@Test public void extractMediaType_Ends_With_Slash() { String mimeType = "video/"; String expectedResult = ""; String actualResult = TranscribeUtils.extractMediaType(mimeType); assertEquals(expectedResult, actualResult); }
public static String extractMediaType(String mimeType) { if (mimeType != null && mimeType.contains("/") && !mimeType.endsWith("/") && mimeType.chars().filter(c -> c == '/').count() == 1) { return mimeType.substring(mimeType.indexOf("/") + 1, mimeType.length()); } return ""; }
TranscribeUtils { public static String extractMediaType(String mimeType) { if (mimeType != null && mimeType.contains("/") && !mimeType.endsWith("/") && mimeType.chars().filter(c -> c == '/').count() == 1) { return mimeType.substring(mimeType.indexOf("/") + 1, mimeType.length()); } return ""; } }
TranscribeUtils { public static String extractMediaType(String mimeType) { if (mimeType != null && mimeType.contains("/") && !mimeType.endsWith("/") && mimeType.chars().filter(c -> c == '/').count() == 1) { return mimeType.substring(mimeType.indexOf("/") + 1, mimeType.length()); } return ""; }  }
TranscribeUtils { public static String extractMediaType(String mimeType) { if (mimeType != null && mimeType.contains("/") && !mimeType.endsWith("/") && mimeType.chars().filter(c -> c == '/').count() == 1) { return mimeType.substring(mimeType.indexOf("/") + 1, mimeType.length()); } return ""; }  static String getFirstWords(String text, int numberOfWords); static String extractMediaType(String mimeType); static Predicate<T> distinctByProperty(Function<? super T, ?> propertyExtractor); static List<TranscribeItem> clone(List<TranscribeItem> items); static String getText(List<TranscribeItem> items); }
TranscribeUtils { public static String extractMediaType(String mimeType) { if (mimeType != null && mimeType.contains("/") && !mimeType.endsWith("/") && mimeType.chars().filter(c -> c == '/').count() == 1) { return mimeType.substring(mimeType.indexOf("/") + 1, mimeType.length()); } return ""; }  static String getFirstWords(String text, int numberOfWords); static String extractMediaType(String mimeType); static Predicate<T> distinctByProperty(Function<? super T, ?> propertyExtractor); static List<TranscribeItem> clone(List<TranscribeItem> items); static String getText(List<TranscribeItem> items);  }