@Test
  public void extractObjectNotSupported() throws Exception {
    HttpMessageWriterView view = new HttpMessageWriterView(new Jaxb2XmlEncoder());
    view.setModelKeys(new HashSet<>(Collections.singletonList("foo1")));
    this.model.addAttribute("foo1", "bar1");

    try {
      view.extractObjectToRender(this.model);
      fail();
    } catch (IllegalStateException ex) {
      String message = ex.getMessage();
      assertTrue(message, message.contains("[foo1] is not supported"));
    }
  }
  @Test
  public void extractObjectMultipleMatchesNotSupported() throws Exception {
    HttpMessageWriterView view = new HttpMessageWriterView(new CharSequenceEncoder());
    view.setModelKeys(new HashSet<>(Arrays.asList("foo1", "foo2")));
    this.model.addAttribute("foo1", "bar1");
    this.model.addAttribute("foo2", "bar2");

    try {
      view.extractObjectToRender(this.model);
      fail();
    } catch (IllegalStateException ex) {
      String message = ex.getMessage();
      assertTrue(message, message.contains("Map rendering is not supported"));
    }
  }