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

    // Create some dummy formats
    final MessageFormat format = messageFormatTestTools.createMessageFormat("Format 1");
    final long formatId = format.getId();
    // Generate a dummy file
    final Path expectedJarPath = Paths.get(deserializerUploadPath, format.getJar());
    FileTestTools.createDummyFile(expectedJarPath.toString(), "MyContests");
    assertTrue("Sanity test", Files.exists(expectedJarPath));
    // Hit index.
    mockMvc
        .perform(post("/configuration/messageFormat/delete/" + formatId)
            .with(user(adminUserDetails))
            .with(csrf()))
        //.andDo(print())
        .andExpect(status().is3xxRedirection())
        .andExpect(redirectedUrl("/configuration/messageFormat"));
    // Validate
    assertFalse("Should NOT have message format", messageFormatRepository.existsById(formatId));
    // Jar should have been removed
    assertFalse("Should have been removed", Files.exists(expectedJarPath));
}