### Question:
DBDouble implements DBType { static String truncateDecimals(double value, int decimals) { StringBuilder builder = new StringBuilder("0"); if (decimals > 0) builder.append('.'); for (int i = 0; i < decimals; i++) builder.append('#'); DecimalFormat df = new DecimalFormat(builder.toString(), defaultDecimalFormatSymbols); df.setRoundingMode(RoundingMode.FLOOR); return df.format(value); } DBDouble();  DBDouble(String typeString); @Override String generateRandom(boolean nullable); @Override String mutate(String currentValue, boolean nullable); @Override boolean hasSeed(Seeds seeds); @Override String generateFromSeed(Seeds seeds); @Override String getTypeString(); @Override String getNormalizedTypeString();  }### Answer:
@Test void truncateDecimals() { assertThat(DBDouble.truncateDecimals(3, 4)).isEqualTo("3"); assertThat(DBDouble.truncateDecimals(4.52, 1)).isEqualTo("4.5"); assertThat(DBDouble.truncateDecimals(4.58, 1)).isEqualTo("4.5"); assertThat(DBDouble.truncateDecimals(5.1, 3)).isEqualTo("5.1"); }
@Test void truncateDecimals_locale() { Locale currentLocale = Locale.getDefault(); Locale.setDefault(Locale.GERMAN); DecimalFormat decimalFormat = new DecimalFormat(); assertThat(decimalFormat.format(50.4)).isEqualTo("50,4"); assertThat(DBDouble.truncateDecimals(50.4, 4)).isEqualTo("50.4"); Locale.setDefault(currentLocale); }