@Test public void shouldReturnEmptyPackageNameForInvalidFlattenComponentString() { val resultForNull = ComponentNameUtils.packageNameFrom(null); assertThat(resultForNull, is("")); val resultForEmpty = ComponentNameUtils.packageNameFrom(""); assertThat(resultForEmpty, is("")); val resultForInvalidFormat = ComponentNameUtils.packageNameFrom("com.abc.MyActivity"); assertThat(resultForInvalidFormat, is("")); }
@NonNull public static String packageNameFrom(@Nullable final String flattenComponentName) { val parts = nullToEmpty(flattenComponentName).split(COMPONENT_NAME_SEPARATOR); return (parts.length == 2) ? parts[0] : ""; }
ComponentNameUtils { @NonNull public static String packageNameFrom(@Nullable final String flattenComponentName) { val parts = nullToEmpty(flattenComponentName).split(COMPONENT_NAME_SEPARATOR); return (parts.length == 2) ? parts[0] : ""; } }
ComponentNameUtils { @NonNull public static String packageNameFrom(@Nullable final String flattenComponentName) { val parts = nullToEmpty(flattenComponentName).split(COMPONENT_NAME_SEPARATOR); return (parts.length == 2) ? parts[0] : ""; } private  ComponentNameUtils(); }
ComponentNameUtils { @NonNull public static String packageNameFrom(@Nullable final String flattenComponentName) { val parts = nullToEmpty(flattenComponentName).split(COMPONENT_NAME_SEPARATOR); return (parts.length == 2) ? parts[0] : ""; } private  ComponentNameUtils(); @NonNull static String packageNameFrom(@Nullable final String flattenComponentName); @NonNull static ComponentName fromFlattenString(@Nullable final String flattenComponentName); }
ComponentNameUtils { @NonNull public static String packageNameFrom(@Nullable final String flattenComponentName) { val parts = nullToEmpty(flattenComponentName).split(COMPONENT_NAME_SEPARATOR); return (parts.length == 2) ? parts[0] : ""; } private  ComponentNameUtils(); @NonNull static String packageNameFrom(@Nullable final String flattenComponentName); @NonNull static ComponentName fromFlattenString(@Nullable final String flattenComponentName); static final ComponentName DUMMY_COMPONENT; }