Skip to content

Commit e1fcfc3

Browse files
authored
Use assertThrows() in StorageReferenceTest (#3572)
1 parent 56b0cd3 commit e1fcfc3

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

firebase-storage/src/test/java/com/google/firebase/storage/StorageReferenceTest.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ public void initWithDefaultAndCustomUriTest() throws Exception {
148148
Assert.assertEquals("gs://foo-bar.appspot.com/", customRef.toString());
149149
}
150150

151-
@Test(expected = IllegalArgumentException.class)
151+
@Test
152152
public void badInitTest() throws Exception {
153-
FirebaseStorage.getInstance().getReference("gs://fooey.appspot.com/child");
153+
assertThrows(
154+
IllegalArgumentException.class,
155+
() -> FirebaseStorage.getInstance().getReference("gs://fooey.appspot.com/child"));
154156
}
155157

156158
@Test
@@ -178,15 +180,18 @@ public void initWithApp() throws Exception {
178180
Assert.assertEquals("child", ref.getName());
179181
}
180182

181-
@Test(expected = IllegalArgumentException.class)
183+
@Test
182184
public void badInitWithApp1() throws Exception {
183-
FirebaseStorage.getInstance().getReference("gs://bucket/child");
185+
assertThrows(
186+
IllegalArgumentException.class,
187+
() -> FirebaseStorage.getInstance().getReference("gs://bucket/child"));
184188
}
185189

186190
@SuppressWarnings("ConstantConditions")
187-
@Test(expected = IllegalArgumentException.class)
191+
@Test
188192
public void badInitWithApp2() throws Exception {
189-
FirebaseStorage.getInstance().getReference(null);
193+
assertThrows(
194+
IllegalArgumentException.class, () -> FirebaseStorage.getInstance().getReference(null));
190195
}
191196

192197
@Test

0 commit comments

Comments
 (0)