Catch exception when failing to create slice
- Created a non-generic exception type when failing SliceData.build() - Catch exception and log error instead of crash. - Added a presubmit test Fixes: 78347031 Test: robotests, atest Change-Id: I06e528cb5e1cd328f82f9561553f3c4b5b0bed26
This commit is contained in:
@@ -67,7 +67,7 @@ public class SliceDataTest {
|
||||
assertThat(data.isPlatformDefined()).isEqualTo(IS_PLATFORM_DEFINED);
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = SliceData.InvalidSliceDataException.class)
|
||||
public void testBuilder_noKey_throwsIllegalStateException() {
|
||||
new SliceData.Builder()
|
||||
.setTitle(TITLE)
|
||||
@@ -80,7 +80,7 @@ public class SliceDataTest {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = SliceData.InvalidSliceDataException.class)
|
||||
public void testBuilder_noTitle_throwsIllegalStateException() {
|
||||
new SliceData.Builder()
|
||||
.setKey(KEY)
|
||||
@@ -93,7 +93,7 @@ public class SliceDataTest {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = SliceData.InvalidSliceDataException.class)
|
||||
public void testBuilder_noFragment_throwsIllegalStateException() {
|
||||
new SliceData.Builder()
|
||||
.setKey(KEY)
|
||||
@@ -106,7 +106,7 @@ public class SliceDataTest {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = SliceData.InvalidSliceDataException.class)
|
||||
public void testBuilder_noPrefController_throwsIllegalStateException() {
|
||||
new SliceData.Builder()
|
||||
.setKey(KEY)
|
||||
|
Reference in New Issue
Block a user