package com.fwdekker.randomness.decimal;

import org.junit.Before;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;


/**
 * Unit tests for {@link DecimalSettings}.
 */
public final class DecimalSettingsTest {
    private DecimalSettings decimalSettings;


    @Before
    public void beforeEach() {
        decimalSettings = new DecimalSettings();
    }


    @Test
    public void testGetComponentName() {
        assertThat(decimalSettings.getComponentName()).isEqualTo("DecimalSettings");
    }

    @Test
    public void testGetLoadState() {
        decimalSettings.setMinValue(399.75);
        decimalSettings.setMaxValue(928.22);
        decimalSettings.setDecimalCount(205);

        final DecimalSettings newDecimalSettings = new DecimalSettings();
        newDecimalSettings.loadState(decimalSettings.getState());

        assertThat(newDecimalSettings.getMinValue()).isEqualTo(399.75);
        assertThat(newDecimalSettings.getMaxValue()).isEqualTo(928.22);
        assertThat(newDecimalSettings.getDecimalCount()).isEqualTo(205);
    }

    @Test
    public void testGetSetMinValue() {
        decimalSettings.setMinValue(720.41);

        assertThat(decimalSettings.getMinValue()).isEqualTo(720.41);
    }

    @Test
    public void testGetSetMaxValue() {
        decimalSettings.setMaxValue(901.38);

        assertThat(decimalSettings.getMaxValue()).isEqualTo(901.38);
    }

    @Test
    public void testGetSetDecimalCount() {
        decimalSettings.setDecimalCount(987);

        assertThat(decimalSettings.getDecimalCount()).isEqualTo(987);
    }
}

@@ -1592,11 +1592,1196 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void testGetSetGroupingSeparator() %7B%0A        decimalSettings.setGroupingSeparator('L');%0A%0A        assertThat(decimalSettings.getGroupingSeparator()).isEqualTo('L');%0A    %7D%0A%0A    @Test%0A    public void testGetSetGroupingSeparatorStringEmpty() %7B%0A        decimalSettings.setGroupingSeparator(%22%22);%0A%0A        assertThat(decimalSettings.getGroupingSeparator()).isEqualTo('%5C0');%0A    %7D%0A%0A    @Test%0A    public void testGetSetGroupingSeparatorString() %7B%0A        decimalSettings.setGroupingSeparator(%223lk-c%22);%0A%0A        assertThat(decimalSettings.getGroupingSeparator()).isEqualTo('3');%0A    %7D%0A%0A    @Test%0A    public void testGetSetDecimalSeparator() %7B%0A        decimalSettings.setDecimalSeparator('%7D');%0A%0A        assertThat(decimalSettings.getDecimalSeparator()).isEqualTo('%7D');%0A    %7D%0A%0A    @Test%0A    public void testGetSetDecimalSeparatorStringEmpty() %7B%0A        decimalSettings.setDecimalSeparator(%22%22);%0A%0A        assertThat(decimalSettings.getDecimalSeparator()).isEqualTo('%5C0');%0A    %7D%0A%0A    @Test%0A    public void testGetSetDecimalSeparatorString() %7B%0A        decimalSettings.setDecimalSeparator(%22Px@%3E%5B%22);%0A%0A        assertThat(decimalSettings.getDecimalSeparator()).isEqualTo('P');%0A    %7D
 %0A%7D%0A

Add miscellaneous unit tests for decimal settings