Skip to content

Commit

Permalink
⏪ revert 修复i18n MessageSource测试类
Browse files Browse the repository at this point in the history
  • Loading branch information
evil0th committed Apr 12, 2024
1 parent 82a159b commit 0bb8da8
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,20 @@

package org.ballcat.i18n;

import java.io.IOException;
import java.util.Locale;

import org.junit.jupiter.api.Test;
import org.springframework.context.MessageSource;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;

class HierarchicalMessageSourceTest {

MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new WildcardReloadableResourceBundleMessageSource();
// Specify the location of the properties file
messageSource.setBasename("classpath*:test-*");
messageSource.setBasename("classpath:test-*");
messageSource.setDefaultEncoding("UTF-8");
messageSource.setFallbackToSystemLocale(false);

Expand All @@ -44,17 +40,6 @@ MessageSource messageSource() {
return dynamicMessageSource;
}

@Test
void testResourcePatternResolver() throws IOException {
final PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resolver.getResources("classpath:test*" + ".properties");
assertNotNull(resources);
assertEquals(0, resources.length);
resources = resolver.getResources("classpath*:test*" + ".properties");
assertNotNull(resources);
assertEquals(3, resources.length);
}

@Test
void testParentMessageSource() {
MessageSource messageSource = messageSource();
Expand Down

0 comments on commit 0bb8da8

Please sign in to comment.