Skip to content

Commit 79409c1

Browse files
Refactor deprecated Locale constructor and @MockBean annotation (#387)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 8279bf3 commit 79409c1

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

samples/xapi-server/src/test/java/dev/learning/xapi/samples/xapiserver/StatementsControllerTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.junit.jupiter.api.Test;
1313
import org.springframework.beans.factory.annotation.Autowired;
1414
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
15-
import org.springframework.boot.test.mock.mockito.MockBean;
15+
import org.springframework.test.context.bean.override.mockito.MockitoBean;
1616
import org.springframework.http.MediaType;
1717
import org.springframework.test.web.servlet.MockMvc;
1818

@@ -30,7 +30,7 @@ class StatementControllerTest {
3030
@Autowired
3131
private MockMvc mvc;
3232

33-
@MockBean
33+
@MockitoBean
3434
private StatementService statementService;
3535

3636
@Test

xapi-model/src/main/java/dev/learning/xapi/model/LanguageMap.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class LanguageMap extends LinkedHashMap<Locale, String> {
2929
/**
3030
* Cached undefined locale instance to avoid repeated object creation.
3131
*/
32-
private static final Locale UNDEFINED_LOCALE = new Locale("und");
32+
private static final Locale UNDEFINED_LOCALE = Locale.forLanguageTag("und");
3333

3434
/**
3535
* Constructs an empty LanguageMap.

xapi-model/src/test/java/dev/learning/xapi/model/LanguageMapTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void givenUsAndUndKeyWhenGettingGermanValueThenValueIsUnd() {
115115

116116
// Given US And UND Key
117117
languageMap.put(Locale.US, "Color");
118-
languageMap.put(new Locale("und"), "Colour");
118+
languageMap.put(Locale.forLanguageTag("und"), "Colour");
119119

120120
// When Getting German Value
121121
final var value = languageMap.get(LanguageRange.parse("de"));

xapi-model/src/test/java/dev/learning/xapi/model/VerbTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ void givenVerbIsConstructedWithIdAndNameWhenGettingDisplayForLocaleUNDThenResult
142142
final var verb = new Verb("http://adlnet.gov/expapi/verbs/answered", "answered");
143143

144144
// When Getting Display For Locale UND
145-
final var result = verb.getDisplay().get(Locale.forLanguageTag("UND"));
145+
final var result = verb.getDisplay().get(Locale.forLanguageTag("und"));
146146

147147
// Then Result Is Expected
148148
assertThat(result, is("answered"));

0 commit comments

Comments
 (0)