LimsUtils { public static String nullifyStringIfBlank(String s) { return (isStringBlankOrNull(s) ? null : s); }  static boolean isStringEmptyOrNull(String s); static boolean isStringBlankOrNull(String s); static String nullifyStringIfBlank(String s); static String toNiceString(BigDecimal num); static String zeroPad(int number, int minLength); static List<Long> parseIds(String idString); static boolean checkDirectory(File path, boolean attemptMkdir); static String getCurrentDateAsString(DateFormat df); static String getCurrentDateAsString(); static String formatDate(Date date); static Date parseDate(String dateString); static String formatDateTime(Date date); static Date parseDateTime(String dateString); static DateFormat getDateFormat(); static DateFormat getDateTimeFormat(); static boolean isDetailedSample(Sample sample); static boolean isPlainSample(Sample sample); static boolean isIdentitySample(Sample sample); static boolean isTissueSample(Sample sample); static boolean isTissueProcessingSample(Sample sample); static boolean isTissuePieceSample(Sample sample); static boolean isProcessingSingleCellSample(Sample sample); static boolean isStockSample(Sample sample); static boolean isStockSingleCellSample(Sample sample); static boolean isAliquotSample(Sample sample); static boolean isAliquotSingleCellSample(Sample sample); static boolean isSampleSlide(Sample sample); static boolean isDetailedLibrary(Library library); static boolean isDetailedLibraryAliquot(LibraryAliquot aliquot); static boolean isIlluminaRun(Run run); static boolean isPacBioRun(Run run); static boolean isLS454Run(Run run); static boolean isSolidRun(Run run); static boolean isOxfordNanoporeRun(Run run); static boolean isOxfordNanoporeContainer(SequencerPartitionContainer container); static T getParent(Class<T> targetParentClass, DetailedSample start); static String generateTemporaryName(); static boolean hasTemporaryName(Nameable nameable); static boolean hasTemporaryAlias(Boxable boxable); static void generateAndSetIdBarcode(Nameable nameable); static void appendSet(StringBuilder target, Collection<String> items, String prefix); @SuppressWarnings("unchecked") static T deproxify(T from); static String[] prefix(String prefix, String... suffixes); static Date toBadDate(LocalDate localDate, ZoneId timezone); static Date toBadDate(LocalDate localDate); static Date toBadDate(LocalDateTime localDate); static Date toBadDate(Instant instant); static Predicate<T> rejectUntil(Predicate<T> check); @SafeVarargs static Set<String> concatSets(Set<String>... sets); static String makeConcentrationLabel(BigDecimal concentration, ConcentrationUnit concentrationUnits); static String joinWithConjunction(Collection<String> words, String conjunction); static String findCommonPrefix(String[] str); static void updateParentVolume(HierarchyEntity entity, HierarchyEntity beforeChange, User changeUser); @SafeVarargs static boolean equals(T item, Object other, Function<T, Object>... getters); @SafeVarargs static boolean equalsByIdFirst(T item, Object other, Function<T, Object>... getters); static int hashCodeByIdFirst(T item, Object... fields); static String getLongestIndex(Stream<Index> indices);  }
@Test public void testNullifyStringIfBlankIsBlank() throws Exception { String nullString = null; assertEquals(nullString, LimsUtils.nullifyStringIfBlank(" ")); }
@Test public void testNullifyStringIfBlankNotBlank() throws Exception { String notNullString = "not null"; assertEquals(notNullString, LimsUtils.nullifyStringIfBlank("not null")); }