@Test
 public void serializable() throws Exception {
   UriComponents uriComponents =
       UriComponentsBuilder.fromUriString("http://example.com")
           .path("/{foo}")
           .query("bar={baz}")
           .build();
   ByteArrayOutputStream bos = new ByteArrayOutputStream();
   ObjectOutputStream oos = new ObjectOutputStream(bos);
   oos.writeObject(uriComponents);
   ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
   UriComponents readObject = (UriComponents) ois.readObject();
   assertThat(uriComponents.toString(), equalTo(readObject.toString()));
 }