HawkbitCommonUtil { public static Locale getCurrentLocale() { final UI currentUI = UI.getCurrent(); return currentUI == null ? Locale.getDefault() : currentUI.getLocale(); } private  HawkbitCommonUtil(); static String concatStrings(final String delimiter, final String... texts); static String getFormattedNameVersion(final String name, final String version); static Locale getCurrentLocale(); static Locale getLocaleToBeUsed(final UiProperties.Localization localizationProperties,
            final Locale desiredLocale); static void initLocalization(final UI ui, final Localization localizationProperties,
            final VaadinMessageSource i18n); static List<T> getEntitiesByPageableProvider(final Function<Pageable, Slice<T>> provider); static boolean atLeastOnePresent(final Long count); static Long getSumOf(final Collection<Long> countList); static String sanitizeHtml(final String html); static final String SP_STRING_PIPE; }
@Test @Description("getCurrentLocale should return the set Locale in the UI if found, otherwise the default System Locale") public void getCurrentLocaleShouldReturnSetUILocaleOrDefaultSystemLocale() { final UI ui = Mockito.mock(UI.class); UI.setCurrent(null); final Locale currentLocale = HawkbitCommonUtil.getCurrentLocale(); assertEquals(Locale.getDefault(), currentLocale); UI.setCurrent(ui); doReturn(Locale.GERMAN).when(ui).getLocale(); final Locale currentLocale2 = HawkbitCommonUtil.getCurrentLocale(); assertEquals(Locale.GERMAN, currentLocale2); }