@Test void findCompositeUnitNames() { Set<String> findCompositeUnitNames = unitConverter.findCompositeUnitNames("kg/m²"); assertTrue(Sets.newHashSet("kg", "m", "kg/m²").containsAll(findCompositeUnitNames)); }
Set<String> findCompositeUnitNames(String unitName) { Set<String> newUnitNames = new HashSet<>(); if (StringUtils.isNotBlank(unitName)) { newUnitNames.add(unitName); if (unitName.contains("/")) { newUnitNames.addAll( Arrays.asList(unitName.split("/")).stream() .map(UnitHelper::superscriptToNumber) .map(unit -> unit.replaceAll("\\d+", "")) .collect(Collectors.toSet())); } } return newUnitNames; }
MagmaUnitConverter { Set<String> findCompositeUnitNames(String unitName) { Set<String> newUnitNames = new HashSet<>(); if (StringUtils.isNotBlank(unitName)) { newUnitNames.add(unitName); if (unitName.contains("/")) { newUnitNames.addAll( Arrays.asList(unitName.split("/")).stream() .map(UnitHelper::superscriptToNumber) .map(unit -> unit.replaceAll("\\d+", "")) .collect(Collectors.toSet())); } } return newUnitNames; } }
MagmaUnitConverter { Set<String> findCompositeUnitNames(String unitName) { Set<String> newUnitNames = new HashSet<>(); if (StringUtils.isNotBlank(unitName)) { newUnitNames.add(unitName); if (unitName.contains("/")) { newUnitNames.addAll( Arrays.asList(unitName.split("/")).stream() .map(UnitHelper::superscriptToNumber) .map(unit -> unit.replaceAll("\\d+", "")) .collect(Collectors.toSet())); } } return newUnitNames; }  }
MagmaUnitConverter { Set<String> findCompositeUnitNames(String unitName) { Set<String> newUnitNames = new HashSet<>(); if (StringUtils.isNotBlank(unitName)) { newUnitNames.add(unitName); if (unitName.contains("/")) { newUnitNames.addAll( Arrays.asList(unitName.split("/")).stream() .map(UnitHelper::superscriptToNumber) .map(unit -> unit.replaceAll("\\d+", "")) .collect(Collectors.toSet())); } } return newUnitNames; }  String convertUnit(Unit<? extends Quantity> standardUnit, Unit<? extends Quantity> unit); }
MagmaUnitConverter { Set<String> findCompositeUnitNames(String unitName) { Set<String> newUnitNames = new HashSet<>(); if (StringUtils.isNotBlank(unitName)) { newUnitNames.add(unitName); if (unitName.contains("/")) { newUnitNames.addAll( Arrays.asList(unitName.split("/")).stream() .map(UnitHelper::superscriptToNumber) .map(unit -> unit.replaceAll("\\d+", "")) .collect(Collectors.toSet())); } } return newUnitNames; }  String convertUnit(Unit<? extends Quantity> standardUnit, Unit<? extends Quantity> unit);  }