fix: locale for unit test of json extension converter (#2170)

pull/2175/head
guqing 2022-06-20 23:18:28 +08:00 committed by GitHub
parent f5d629d2bf
commit 89eeccd99c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -6,6 +6,8 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Locale;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import run.halo.app.extension.exception.ExtensionConvertException;
@ -18,8 +20,13 @@ class JsonExtensionConverterTest {
ObjectMapper objectMapper;
Locale localeDefault;
@BeforeEach
void setUp() {
localeDefault = Locale.getDefault();
Locale.setDefault(Locale.ENGLISH);
DefaultSchemeManager schemeManager = new DefaultSchemeManager(null);
converter = new JSONExtensionConverter(schemeManager);
objectMapper = JSONExtensionConverter.OBJECT_MAPPER;
@ -27,6 +34,11 @@ class JsonExtensionConverterTest {
schemeManager.register(FakeExtension.class);
}
@AfterEach
void cleanUp() {
Locale.setDefault(localeDefault);
}
@Test
void convertTo() throws IOException {
var fake = createFakeExtension("fake", 10L);