@Test
@Transactional
public void testPostUpdate_updatingExistingNoJarUploaded() throws Exception {

    final MessageFormat messageFormat = messageFormatTestTools.createMessageFormat("MyMessageFormat" + System.currentTimeMillis());
    final String originalClasspath = messageFormat.getClasspath();
    final String originalJarName = messageFormat.getJar();
    final String originalJarContents = "OriginalContents";
    final Path originalJarPath = Paths.get(deserializerUploadPath, messageFormat.getJar());
    // Create a dummy jar
    FileTestTools.createDummyFile(deserializerUploadPath + messageFormat.getJar(), originalJarContents);
    // This is the same as not uploading a jar.
    final InputStream emptyFile = null;
    final MockMultipartFile jarUpload = new MockMultipartFile("file", "testPlugins.jar", null, emptyFile);
    final String newName = "MyUpdatedName" + System.currentTimeMillis();
    final String newClasspath = "my new class path";
    // Hit page.
    mockMvc
        .perform(multipart("/configuration/messageFormat/update")
            .file(jarUpload)
            .with(user(adminUserDetails))
            .with(csrf())
            .param("id", String.valueOf(messageFormat.getId()))
            .param("name", newName)
            .param("classpath", newClasspath)
            .param("customOptionNames", "option1")
            .param("customOptionNames", "option2")
            .param("customOptionValues", "value1")
            .param("customOptionValues", "value2"))
        //.andDo(print())
        .andExpect(model().hasNoErrors())
        .andExpect(status().is3xxRedirection())
        .andExpect(redirectedUrl("/configuration/messageFormat"));
    // Validate message format was updated.
    final MessageFormat updatedMessageFormat = messageFormatRepository.findById(messageFormat.getId()).get();
    assertNotNull("Has message format", updatedMessageFormat);
    assertEquals("Name updated", newName, updatedMessageFormat.getName());
    assertEquals("classpath was NOT updated", originalClasspath, updatedMessageFormat.getClasspath());
    assertNotEquals("classpath was NOT updated", newClasspath, updatedMessageFormat.getClasspath());
    assertEquals("Jar name not updated", originalJarName, updatedMessageFormat.getJar());
    assertFalse("Should not be a default format", updatedMessageFormat.isDefaultFormat());
    // Define our expected json string
    final String expectedOptionsJson = "{\"option1\":\"value1\",\"option2\":\"value2\"}";
    assertEquals("Parameters should have been updated", expectedOptionsJson, updatedMessageFormat.getOptionParameters());
    // Validate jar should still exist
    assertTrue("File should exist", Files.exists(originalJarPath));
    // Jar contents should be unchanged
    final String jarContents = FileTestTools.readFile(originalJarPath.toString());
    assertEquals("Jar contents should not have changed", originalJarContents, jarContents);
    // Cleanup
    Files.deleteIfExists(originalJarPath);
}