Skip to content

Commit 01de4dd

Browse files
Remove additional unnecessary exception declarations from test methods
Co-authored-by: thomasturrell <1552612+thomasturrell@users.noreply.github.com>
1 parent 31f3960 commit 01de4dd

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void whenActivityIsBuiltWithStringIdThenIdIsExpected() {
160160
}
161161

162162
@Test
163-
void whenDeserializingActivityWithInvalidDisplayThenResultIsExpected() throws Exception {
163+
void whenDeserializingActivityWithInvalidDisplayThenResultIsExpected() {
164164

165165
final var json =
166166
"{\"objectType\":\"Activity\",\"id\":\"https://example.com/activity/simplestatement\",\"definition\":{\"name\":{\"a12345678\":\"Simple Statement\"}}}";

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ class LanguageMapTests {
2525

2626
@ParameterizedTest
2727
@CsvSource({"en-GB, Colour", "en-US, Color", "de, Colour"})
28-
void givenUkAndUSKeyWhenGettingLocaleValueThenValueIsExpected(String locale, String expected)
29-
throws Exception {
28+
void givenUkAndUSKeyWhenGettingLocaleValueThenValueIsExpected(String locale, String expected) {
3029

3130
final var languageMap = new LanguageMap();
3231

@@ -43,7 +42,7 @@ void givenUkAndUSKeyWhenGettingLocaleValueThenValueIsExpected(String locale, Str
4342
}
4443

4544
@Test
46-
void givenFranceGermanyandUSKeyWhenGettingUKValueThenValueIsEnglish() throws Exception {
45+
void givenFranceGermanyandUSKeyWhenGettingUKValueThenValueIsEnglish() {
4746

4847
final var languageMap = new LanguageMap();
4948

@@ -61,7 +60,7 @@ void givenFranceGermanyandUSKeyWhenGettingUKValueThenValueIsEnglish() throws Exc
6160
}
6261

6362
@Test
64-
void givenFrenchAndEnglishKeyWhenGettingUSValueThenValueIsEnglish() throws Exception {
63+
void givenFrenchAndEnglishKeyWhenGettingUSValueThenValueIsEnglish() {
6564

6665
final var languageMap = new LanguageMap();
6766

@@ -78,7 +77,7 @@ void givenFrenchAndEnglishKeyWhenGettingUSValueThenValueIsEnglish() throws Excep
7877
}
7978

8079
@Test
81-
void givenFrenchAndUsKeyWhenGettingCanadaFrenchValueThenValueIsFrench() throws Exception {
80+
void givenFrenchAndUsKeyWhenGettingCanadaFrenchValueThenValueIsFrench() {
8281

8382
final var languageMap = new LanguageMap();
8483

@@ -95,7 +94,7 @@ void givenFrenchAndUsKeyWhenGettingCanadaFrenchValueThenValueIsFrench() throws E
9594
}
9695

9796
@Test
98-
void givenMapIsEmptyWhenGettingGermanValueThenValueIsNull() throws Exception {
97+
void givenMapIsEmptyWhenGettingGermanValueThenValueIsNull() {
9998

10099
final var languageMap = new LanguageMap();
101100

@@ -110,7 +109,7 @@ void givenMapIsEmptyWhenGettingGermanValueThenValueIsNull() throws Exception {
110109
}
111110

112111
@Test
113-
void givenUsAndUndKeyWhenGettingGermanValueThenValueIsUnd() throws Exception {
112+
void givenUsAndUndKeyWhenGettingGermanValueThenValueIsUnd() {
114113

115114
final var languageMap = new LanguageMap();
116115

@@ -127,8 +126,7 @@ void givenUsAndUndKeyWhenGettingGermanValueThenValueIsUnd() throws Exception {
127126
}
128127

129128
@Test
130-
void givenUkAndUsKeyInMapUsedToConstructLanguageMapWhenGettingUKValueThenValueIsUK()
131-
throws Exception {
129+
void givenUkAndUsKeyInMapUsedToConstructLanguageMapWhenGettingUKValueThenValueIsUK() {
132130

133131
final Map<Locale, String> map = new HashMap<>();
134132
map.put(Locale.UK, "Colour");

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ void whenDeserializingStatementWithoutTimestampOffsetThenNoExceptionIsThrown()
991991
}
992992

993993
@Test
994-
void whenDeserializingStatementNullTimestampThenExceptionIsThrown() throws IOException {
994+
void whenDeserializingStatementNullTimestampThenExceptionIsThrown() {
995995

996996
Assertions.assertThrows(ValueInstantiationException.class, () -> {
997997
objectMapper.registerModule(new XapiStrictNullValuesModule()).readValue("""
@@ -1023,7 +1023,7 @@ void whenDeserializingStatementNullTimestampThenExceptionIsThrown() throws IOExc
10231023
}
10241024

10251025
@Test
1026-
void whenDeserializingStatementWithInvalidLocaleStringThenExceptionIsThrown() throws IOException {
1026+
void whenDeserializingStatementWithInvalidLocaleStringThenExceptionIsThrown() {
10271027

10281028
Assertions.assertThrows(InvalidFormatException.class, () -> {
10291029
objectMapper.registerModule(new XapiStrictLocaleModule()).readValue("""
@@ -1057,7 +1057,7 @@ void whenDeserializingStatementWithInvalidLocaleStringThenExceptionIsThrown() th
10571057
}
10581058

10591059
@Test
1060-
void whenDeserializingStatementWithNonStringLocaleThenExceptionIsThrown() throws IOException {
1060+
void whenDeserializingStatementWithNonStringLocaleThenExceptionIsThrown() {
10611061

10621062
Assertions.assertThrows(MismatchedInputException.class, () -> {
10631063
objectMapper.registerModule(new XapiStrictLocaleModule()).readValue("""
@@ -1091,7 +1091,7 @@ void whenDeserializingStatementWithNonStringLocaleThenExceptionIsThrown() throws
10911091
}
10921092

10931093
@Test
1094-
void whenDeserializingStatementWithNullPropertyThenExceptionIsThrown() throws IOException {
1094+
void whenDeserializingStatementWithNullPropertyThenExceptionIsThrown() {
10951095

10961096
Assertions.assertThrows(ValueInstantiationException.class, () -> {
10971097
objectMapper.registerModule(new XapiStrictNullValuesModule()).readValue("""
@@ -1291,7 +1291,7 @@ void whenDeserializingStatementWithTimestampWithoutOffsetThenResultisExpected()
12911291
}
12921292

12931293
@Test
1294-
void whenDeserializingStatementWithInvalidLocaleThenExceptionIsThrown() throws IOException {
1294+
void whenDeserializingStatementWithInvalidLocaleThenExceptionIsThrown() {
12951295

12961296
Assertions.assertThrows(InvalidFormatException.class, () -> {
12971297
objectMapper.registerModule(new XapiStrictLocaleModule()).readValue("""
@@ -1606,7 +1606,7 @@ void whenSigningStatementThenSignatureIsExpected() throws NoSuchAlgorithmExcepti
16061606

16071607
@Test
16081608
void whenSigningStatementThenSignatureIsValid()
1609-
throws NoSuchAlgorithmException, JsonMappingException, JsonProcessingException {
1609+
throws NoSuchAlgorithmException, JsonProcessingException {
16101610

16111611
final var keyPairGenerator = KeyPairGenerator.getInstance("RSA");
16121612
keyPairGenerator.initialize(2048);

xapi-model/src/test/java/dev/learning/xapi/model/validation/internal/validators/NotUndeterminedValidatorTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ void whenValueIsNullThenResultIsTrue() {
3232
}
3333

3434
@Test
35-
void whenValueIsUndeterminedLocaleThenResultIsFalse()
36-
throws NoSuchFieldException, SecurityException {
35+
void whenValueIsUndeterminedLocaleThenResultIsFalse() {
3736

3837
// When Value Is Undetermined Locale
3938
final var result = validator.isValid(Locale.forLanguageTag("und"), null);
@@ -43,8 +42,7 @@ void whenValueIsUndeterminedLocaleThenResultIsFalse()
4342
}
4443

4544
@Test
46-
void whenValueIsNotUndeterminedLocaleThenResultIsTrue()
47-
throws NoSuchFieldException, SecurityException {
45+
void whenValueIsNotUndeterminedLocaleThenResultIsTrue() {
4846

4947
// When Value Is Not Undetermined Locale
5048
final var result = validator.isValid(Locale.forLanguageTag("en-US"), null);

0 commit comments

Comments
 (0)