mirror of https://github.com/halo-dev/halo
fix: locale for unit test of json extension converter (#2170)
parent
f5d629d2bf
commit
89eeccd99c
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue