### Question:
SliceXml { public static void serializeSlice(Slice s, Context context, OutputStream output, String encoding, SliceUtils.SerializeOptions options) throws IOException { try { XmlSerializer serializer = XmlPullParserFactory.newInstance().newSerializer(); serializer.setOutput(output, encoding); serializer.startDocument(encoding, null); serialize(s, context, options, serializer, false, null); serializer.endDocument(); serializer.flush(); } catch (XmlPullParserException e) { throw new IOException("Unable to init XML Serialization", e); } } private  SliceXml(); static Slice parseSlice(Context context, InputStream input,
            String encoding, SliceUtils.SliceActionListener listener); static void serializeSlice(Slice s, Context context, OutputStream output,
            String encoding, SliceUtils.SerializeOptions options);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testThrowForRemoteInput() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Slice s = new Slice.Builder(Uri.parse("content: .addRemoteInput(null, null) .build(); SliceUtils.serializeSlice(s, mContext, outputStream, "UTF-8", new SliceUtils .SerializeOptions()); }
@Test(expected = IllegalArgumentException.class) public void testThrowForImage() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Slice s = new Slice.Builder(Uri.parse("content: .addIcon(null, null) .build(); SliceUtils.serializeSlice(s, mContext, outputStream, "UTF-8", new SliceUtils .SerializeOptions()); }
@Test public void testNoThrowForAction() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Slice s = new Slice.Builder(Uri.parse("content: .addAction((PendingIntent) null, null, null) .build(); SliceUtils.serializeSlice(s, mContext, outputStream, "UTF-8", new SliceUtils .SerializeOptions().setActionMode(SliceUtils.SerializeOptions.MODE_REMOVE)); }
@Test public void testNoThrowForRemoteInput() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Slice s = new Slice.Builder(Uri.parse("content: .addRemoteInput(null, null) .build(); SliceUtils.serializeSlice(s, mContext, outputStream, "UTF-8", new SliceUtils .SerializeOptions().setActionMode(SliceUtils.SerializeOptions.MODE_REMOVE)); }
@Test public void testNoThrowForImage() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Slice s = new Slice.Builder(Uri.parse("content: .addIcon(null, null) .build(); SliceUtils.serializeSlice(s, mContext, outputStream, "UTF-8", new SliceUtils .SerializeOptions().setImageMode(SliceUtils.SerializeOptions.MODE_REMOVE)); }
@Test(expected = IllegalArgumentException.class) public void testThrowForAction() throws IOException { ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); Slice s = new Slice.Builder(Uri.parse("content: .addAction((PendingIntent) null, null, null) .build(); SliceUtils.serializeSlice(s, mContext, outputStream, "UTF-8", new SliceUtils .SerializeOptions()); }