|
19 | 19 | import static org.junit.Assert.assertEquals; |
20 | 20 | import static org.junit.Assert.assertFalse; |
21 | 21 | import static org.junit.Assert.assertSame; |
| 22 | +import static org.junit.Assert.assertThrows; |
22 | 23 | import static org.junit.Assert.assertTrue; |
23 | 24 | import static org.mockito.ArgumentMatchers.any; |
24 | 25 | import static org.mockito.Mockito.mock; |
@@ -134,6 +135,31 @@ public void testCreateMutableCredentialsEmptyScopesThrowsError() { |
134 | 135 | new MutableCredentials(initialCredentials, Collections.emptySet()); |
135 | 136 | } |
136 | 137 |
|
| 138 | + @Test |
| 139 | + public void testCreateMutableCredentialsNullCredentialsThrowsError() { |
| 140 | + NullPointerException exception = |
| 141 | + assertThrows(NullPointerException.class, () -> new MutableCredentials(null, scopes)); |
| 142 | + assertEquals("credentials must not be null", exception.getMessage()); |
| 143 | + } |
| 144 | + |
| 145 | + @Test |
| 146 | + public void testCreateMutableCredentialsNullScopesThrowsError() { |
| 147 | + NullPointerException exception = |
| 148 | + assertThrows( |
| 149 | + NullPointerException.class, () -> new MutableCredentials(initialCredentials, null)); |
| 150 | + assertEquals("scopes must not be null", exception.getMessage()); |
| 151 | + } |
| 152 | + |
| 153 | + @Test |
| 154 | + public void testUpdateMutableCredentialsNullCredentialsThrowsError() throws IOException { |
| 155 | + setupInitialCredentials(); |
| 156 | + MutableCredentials credentials = new MutableCredentials(initialCredentials, scopes); |
| 157 | + |
| 158 | + NullPointerException exception = |
| 159 | + assertThrows(NullPointerException.class, () -> credentials.updateCredentials(null)); |
| 160 | + assertEquals("credentials must not be null", exception.getMessage()); |
| 161 | + } |
| 162 | + |
137 | 163 | private void validateInitialDelegatedCredentialsAreSet( |
138 | 164 | MutableCredentials credentials, URI testUri) throws IOException { |
139 | 165 | assertEquals(initialAuthType, credentials.getAuthenticationType()); |
|
0 commit comments