public void saveProjectImports(final Path path) { if (ioService.exists(Paths.convert(path))) { throw new FileAlreadyExistsException(path.toString()); } else { ioService.write(Paths.convert(path), projectConfigurationContentHandler.toString(createProjectImports())); } }
@Test public void testNullModel() throws Exception { String xml = handler.toString(null); assertEquals("", xml); }
@Test public void testNullModel() throws Exception { String xml = handler.toString(null); assertEquals("", xml); }
@Test public void testNullModel() throws Exception { String xml = handler.toString(null); assertEquals("", xml); }
@Override public Path save(final Path resource, final ProjectImports projectImports, final Metadata metadata, final String comment) { try { ioService.write(Paths.convert(resource), projectConfigurationContentHandler.toString(projectImports), metadataService.setUpAttributes(resource, metadata)); //The pom.xml, kmodule.xml and project.imports are all saved from ProjectScreenPresenter //We only raise InvalidateDMOProjectCacheEvent and ResourceUpdatedEvent(pom.xml) events once //in POMService.save to avoid duplicating events (and re-construction of DMO). return resource; } catch (Exception e) { throw ExceptionUtilities.handleException(e); } }
@Test public void testVersion() throws Exception { assertTrue(handler.toString(new ProjectImports()).contains("<version>1.0</version>")); }
@Test public void testEmptyImports() throws Exception { String xml = handler.toString(new ProjectImports()); assertTrue(xml.contains("<imports>")); assertTrue(xml.contains("</imports>")); }
@Test public void testVersion() throws Exception { assertTrue(handler.toString(new ProjectImports()).contains("<version>1.0</version>")); }
@Test public void testVersion() throws Exception { assertTrue(handler.toString(new ProjectImports()).contains("<version>1.0</version>")); }
@Test public void testEmptyImports() throws Exception { String xml = handler.toString(new ProjectImports()); assertTrue(xml.contains("<imports>")); assertTrue(xml.contains("</imports>")); }
@Test public void testEmptyImports() throws Exception { String xml = handler.toString(new ProjectImports()); assertTrue(xml.contains("<imports>")); assertTrue(xml.contains("</imports>")); }
@Test public void testImports() throws Exception { ProjectImports configuration = new ProjectImports(); configuration.getImports().addImport(new Import("java.util.List")); configuration.getImports().addImport(new Import("org.test.Object")); String xml = handler.toString(configuration); assertTrue(xml.contains("<import>")); assertTrue(xml.contains("</import>")); assertTrue(xml.contains("<type>java.util.List</type>")); assertTrue(xml.contains("<type>org.test.Object</type>")); } }
@Test public void testImports() throws Exception { ProjectImports configuration = new ProjectImports(); configuration.getImports().addImport(new Import("java.util.List")); configuration.getImports().addImport(new Import("org.test.Object")); String xml = handler.toString(configuration); assertTrue(xml.contains("<import>")); assertTrue(xml.contains("</import>")); assertTrue(xml.contains("<type>java.util.List</type>")); assertTrue(xml.contains("<type>org.test.Object</type>")); } }
@Test public void testImports() throws Exception { ProjectImports configuration = new ProjectImports(); configuration.getImports().addImport(new Import("java.util.List")); configuration.getImports().addImport(new Import("org.test.Object")); String xml = handler.toString(configuration); assertTrue(xml.contains("<import>")); assertTrue(xml.contains("</import>")); assertTrue(xml.contains("<type>java.util.List</type>")); assertTrue(xml.contains("<type>org.test.Object</type>")); } }