NumberItem extends GenericItem { @Override public @Nullable StateDescription getStateDescription(@Nullable Locale locale) { StateDescription stateDescription = super.getStateDescription(locale); if (getDimension() == null && stateDescription != null && stateDescription.getPattern() != null && stateDescription.getPattern().contains(UnitUtils.UNIT_PLACEHOLDER)) { return StateDescriptionFragmentBuilder.create(stateDescription) .withPattern(stateDescription.getPattern().replaceAll(UnitUtils.UNIT_PLACEHOLDER, "").trim()) .build().toStateDescription(); } return stateDescription; } NumberItem(String name);  NumberItem(String type, String name); @Override List<Class<? extends State>> getAcceptedDataTypes(); @Override List<Class<? extends Command>> getAcceptedCommandTypes(); void send(DecimalType command); @Override @Nullable StateDescription getStateDescription(@Nullable Locale locale); @Nullable Class<? extends Quantity<?>> getDimension(); @Override void setState(State state); @Nullable String getUnitSymbol(); @Nullable Unit<? extends Quantity<?>> getUnit(); @Nullable QuantityType<?> toQuantityType(DecimalType originalType,
            @Nullable Class<? extends Quantity<?>> dimension);  }
@SuppressWarnings("null") @Test public void testStripUnitPlaceholderFromPlainNumberItem() { NumberItem item = new NumberItem("Number", ITEM_NAME); item.setStateDescriptionService(stateDescriptionService); assertThat(item.getStateDescription().getPattern(), is("%.1f")); }
@SuppressWarnings("null") @Test public void testLeaveUnitPlaceholderOnDimensionNumberItem() { NumberItem item = new NumberItem("Number:Temperature", ITEM_NAME); item.setStateDescriptionService(stateDescriptionService); assertThat(item.getStateDescription().getPattern(), is("%.1f " + UnitUtils.UNIT_PLACEHOLDER)); }