  public void testInvalidData() throws IOException {
    Map<String, String> invalidData = new HashMap();
    invalidData.put("foo", "bar");

    NamedTemporaryFile tempFile = new NamedTemporaryFile("invalid_parser_data", null);
    try (FileOutputStream fos = new FileOutputStream(tempFile.get().toString());
        ZipOutputStream zipos = new ZipOutputStream(fos)) {
      zipos.putNextEntry(new ZipEntry("parser_data"));
      try (ObjectOutputStream oos = new ObjectOutputStream(zipos)) {
        oos.writeObject(invalidData);
      }
    }

    ProjectWorkspace workspace =
        TestDataHelper.createProjectWorkspaceForScenario(this, "parser_with_cell", tmp);
    workspace.setUp();

    // Load the invalid parser cache data.
    thrown.expect(InvalidClassException.class);
    thrown.expectMessage("Can't deserialize this class");
    workspace.runBuckCommand("parser-cache", "--load", tempFile.get().toString());
  }
The application deserializes untrusted data without sufficiently verifying that the resulting data will be valid.