use of com.mulesoft.tools.migration.project.model.pom.Parent in project mule-migration-assistant by mulesoft.
the class UpdateProjectParentTest method executeWithGavAndParent.
@Test
public void executeWithGavAndParent() throws URISyntaxException, IOException, XmlPullParserException {
UpdateProjectParent updateProjectParent = new UpdateProjectParent();
final ApplicationModel applicationModelMock = mock(ApplicationModel.class);
Parent parent = new Parent.ParentBuilder().withGroupId("com.mule").withArtifactId("rest-parent").withVersion("2.0.0").build();
when(applicationModelMock.getProjectPomParent()).thenReturn(Optional.of(parent));
updateProjectParent.setApplicationModel(applicationModelMock);
Path pomPath = Paths.get(getClass().getResource(PARENT_POM).toURI());
PomModel model = new PomModel.PomModelBuilder().withPom(pomPath).build();
parent = model.getParent().get();
assertEquals(parent.getGroupId(), "com.mule.parent");
assertEquals(parent.getArtifactId(), "parent-rest");
assertEquals(parent.getVersion(), "1.0.0");
try {
updateProjectParent.execute(model, report.getReport());
Parent afterParent = model.getParent().get();
assertEquals(afterParent.getGroupId(), "com.mule");
assertEquals(afterParent.getArtifactId(), "rest-parent");
assertEquals(afterParent.getVersion(), "2.0.0");
} catch (RuntimeException e) {
fail("no exception have to be thrown");
}
}
use of com.mulesoft.tools.migration.project.model.pom.Parent in project mule-migration-assistant by mulesoft.
the class UpdateProjectParentTest method executeWithProjectParentGavAndWithoutParent.
@Test
public void executeWithProjectParentGavAndWithoutParent() throws URISyntaxException, IOException, XmlPullParserException {
UpdateProjectParent updateProjectParent = new UpdateProjectParent();
final ApplicationModel applicationModelMock = mock(ApplicationModel.class);
Parent parent = new Parent.ParentBuilder().withGroupId("com.mule").withArtifactId("rest-parent").withVersion("2.0.0").build();
when(applicationModelMock.getProjectPomParent()).thenReturn(Optional.of(parent));
updateProjectParent.setApplicationModel(applicationModelMock);
Path pomPath = Paths.get(getClass().getResource(POM).toURI());
PomModel model = new PomModel.PomModelBuilder().withPom(pomPath).build();
try {
updateProjectParent.execute(model, report.getReport());
assertTrue(!model.getParent().isPresent());
} catch (RuntimeException e) {
fail("no exception have to be thrown");
}
}
Aggregations