/**
 * The MIT License
 *
 *   Copyright (c) 2017, Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
 *
 *   Permission is hereby granted, free of charge, to any person obtaining a copy
 *   of this software and associated documentation files (the "Software"), to deal
 *   in the Software without restriction, including without limitation the rights
 *   to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 *   copies of the Software, and to permit persons to whom the Software is
 *   furnished to do so, subject to the following conditions:
 *
 *   The above copyright notice and this permission notice shall be included in
 *   all copies or substantial portions of the Software.
 *
 *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 *   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 *   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 *   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 *   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 *   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 *   THE SOFTWARE.
 */
package io.github.benas.randombeans.randomizers.misc;

import static io.github.benas.randombeans.randomizers.misc.LocaleRandomizer.aNewLocaleRandomizer;
import static org.assertj.core.api.Assertions.assertThat;

import java.util.Locale;

import org.junit.jupiter.api.Test;

import io.github.benas.randombeans.randomizers.AbstractRandomizerTest;

public class LocaleRandomizerTest extends AbstractRandomizerTest<Locale> {

    @Test
    public void shouldGenerateRandomLocale() {
        assertThat(aNewLocaleRandomizer().getRandomValue()).isIn(Locale.getAvailableLocales());
    }

    @Test
    public void shouldGenerateTheSameValueForTheSameSeed() {
        String javaVersion = System.getProperty("java.specification.version");
        if (javaVersion.startsWith("9") || javaVersion.startsWith("10")) {
            assertThat(aNewLocaleRandomizer(SEED).getRandomValue()).isEqualTo(new Locale("sw", "ke"));
        } else if (javaVersion.startsWith("12")) {
            assertThat(aNewLocaleRandomizer(SEED).getRandomValue()).isEqualTo(new Locale("en", "CK"));
        } else {
            assertThat(aNewLocaleRandomizer(SEED).getRandomValue()).isEqualTo(new Locale("nl", "be"));
        }
    }
}

@@ -1413,24 +1413,53 @@
 ssertThat;%0A%0A
+import java.math.BigDecimal;%0A
 import java.
@@ -1471,16 +1471,16 @@
 Locale;%0A
-
 %0Aimport 
@@ -1899,14 +1899,18 @@
     
-String
+BigDecimal
  jav
@@ -1920,16 +1920,31 @@
 rsion = 
+new BigDecimal(
 System.g
@@ -1983,16 +1983,17 @@
 ersion%22)
+)
 ;%0A      
@@ -2014,56 +2014,45 @@
 ion.
-startsWith(%229%22) %7C%7C javaVersion.startsWith(%2210
+compareTo(new BigDecimal(%2211
 %22))
+ %3E= 0)
  %7B%0A 
@@ -2144,16 +2144,16 @@
 le(%22
-sw
+en
 %22, %22
-ke
+CK
 %22));
@@ -2188,24 +2188,43 @@
 ion.
-startsWith(%2212%22)
+compareTo(new BigDecimal(%229%22)) %3E= 0
 ) %7B%0A
@@ -2309,32 +2309,32 @@
 new Locale(%22
-en
+sw
 %22, %22
-CK
+ke
 %22));%0A       

Fix LocaleRandomizerTest#shouldGenerateTheSameValueForTheSameSeed on Java 11.