Search in sources :

Example 1 with DisabledOnJre

use of org.junit.jupiter.api.condition.DisabledOnJre in project robozonky by RoboZonky.

the class InterestNumberFormatFactoryTest method formattingCzech.

@DisabledOnJre(JRE.JAVA_8)
@Test
void formattingCzech() throws TemplateValueFormatException, TemplateModelException {
    final BigDecimal n = new BigDecimal("0.0001");
    final TemplateNumberFormat f = InterestNumberFormatFactory.INSTANCE.get("", Defaults.LOCALE, Environment.getCurrentEnvironment());
    final TemplateNumberModel m = () -> n;
    final String result = f.formatToPlainText(m);
    assertThat(result.trim()).isEqualTo("0,01" + (char) 160 + "%");
}
Also used : TemplateNumberFormat(freemarker.core.TemplateNumberFormat) TemplateNumberModel(freemarker.template.TemplateNumberModel) BigDecimal(java.math.BigDecimal) DisabledOnJre(org.junit.jupiter.api.condition.DisabledOnJre) Test(org.junit.jupiter.api.Test)

Example 2 with DisabledOnJre

use of org.junit.jupiter.api.condition.DisabledOnJre in project robozonky by RoboZonky.

the class InterestNumberFormatFactoryTest method formattingCzech2.

@DisabledOnJre(JRE.JAVA_8)
@Test
void formattingCzech2() throws TemplateValueFormatException, TemplateModelException {
    final BigDecimal n = new BigDecimal("0.0000");
    final TemplateNumberFormat f = InterestNumberFormatFactory.INSTANCE.get("", Defaults.LOCALE, Environment.getCurrentEnvironment());
    final TemplateNumberModel m = () -> n;
    final String result = f.formatToPlainText(m);
    assertThat(result.trim()).isEqualTo("0" + (char) 160 + "%");
}
Also used : TemplateNumberFormat(freemarker.core.TemplateNumberFormat) TemplateNumberModel(freemarker.template.TemplateNumberModel) BigDecimal(java.math.BigDecimal) DisabledOnJre(org.junit.jupiter.api.condition.DisabledOnJre) Test(org.junit.jupiter.api.Test)

Example 3 with DisabledOnJre

use of org.junit.jupiter.api.condition.DisabledOnJre in project robozonky by RoboZonky.

the class InterestNumberFormatFactoryTest method formattingCzech3.

@DisabledOnJre(JRE.JAVA_8)
@Test
void formattingCzech3() throws TemplateValueFormatException, TemplateModelException {
    final BigDecimal n = new BigDecimal("0.001");
    final TemplateNumberFormat f = InterestNumberFormatFactory.INSTANCE.get("", Defaults.LOCALE, Environment.getCurrentEnvironment());
    final TemplateNumberModel m = () -> n;
    final String result = f.formatToPlainText(m);
    assertThat(result.trim()).isEqualTo("0,1" + (char) 160 + "%");
}
Also used : TemplateNumberFormat(freemarker.core.TemplateNumberFormat) TemplateNumberModel(freemarker.template.TemplateNumberModel) BigDecimal(java.math.BigDecimal) DisabledOnJre(org.junit.jupiter.api.condition.DisabledOnJre) Test(org.junit.jupiter.api.Test)

Aggregations

TemplateNumberFormat (freemarker.core.TemplateNumberFormat)3 TemplateNumberModel (freemarker.template.TemplateNumberModel)3 BigDecimal (java.math.BigDecimal)3 Test (org.junit.jupiter.api.Test)3 DisabledOnJre (org.junit.jupiter.api.condition.DisabledOnJre)3