@Test @Transactional public void testCreateDomainStorage() throws Exception { Domain domain = new Domain(); domain.setName("TestCreation"); File tmpFile = null; try { tmpFile = File.createTempFile("domain", "TestCreation"); populateFile(tmpFile); // Mock FileRepositoryManager mockStatic(FileRepositoryManager.class); when(FileRepositoryManager.getDomainPropertiesPath("TestCreation")) .thenReturn(tmpFile.getAbsolutePath()); // Create domain storage dao.createDomainStorage(domain); // Looks for domain created tables testTablesExistence(true); } catch (Exception e) { tmpFile.delete(); throw e; } }