use of org.guvnor.common.services.project.client.POMEditorPanel in project kie-wb-common by kiegroup.
the class POMWizardPageTest method setUp.
@Before
@SuppressWarnings("unchecked")
public void setUp() throws Exception {
gavEditor = new GAVEditor(gavEditorView);
pomEditor = spy(new POMEditorPanel(pomEditorView, syncBeanManager, gavPreferences, projectScopedResolutionStrategySupplier));
// POMEditorView implementation updates a nested GAVEditor presenter. Mock the implementation to avoid use of real widgets
doAnswer(new Answer<Void>() {
@Override
public Void answer(final InvocationOnMock invocation) throws Throwable {
final String artifactId = (String) invocation.getArguments()[0];
gavEditor.setArtifactID(artifactId);
return null;
}
}).when(pomEditorView).setArtifactID(any(String.class));
// POMEditorView implementation updates a nested GAVEditor presenter. Mock the implementation to avoid use of real widgets
doAnswer(new Answer<Void>() {
@Override
public Void answer(final InvocationOnMock invocation) throws Throwable {
final GAV gav = (GAV) invocation.getArguments()[0];
gavEditor.setGAV(gav);
return null;
}
}).when(pomEditorView).setGAV(any(GAV.class));
// POMEditorView implementation updates a nested GAVEditor presenter. Mock the implementation to avoid use of real widgets
doAnswer(new Answer<Void>() {
@Override
public Void answer(final InvocationOnMock invocation) throws Throwable {
final ArtifactIdChangeHandler handler = (ArtifactIdChangeHandler) invocation.getArguments()[0];
gavEditor.addArtifactIdChangeHandler(handler);
return null;
}
}).when(pomEditorView).addArtifactIdChangeHandler(any(ArtifactIdChangeHandler.class));
page = spy(new POMWizardPage(pomEditor, view, event, new CallerMock<ProjectScreenService>(projectScreenService), new CallerMock<ValidationService>(validationService)));
page.initialise();
doAnswer(invocationOnMock -> {
((ParameterizedCommand<GAVPreferences>) invocationOnMock.getArguments()[1]).execute(gavPreferences);
return null;
}).when(gavPreferences).load(any(PreferenceScopeResolutionStrategyInfo.class), any(ParameterizedCommand.class), any(ParameterizedCommand.class));
}
Aggregations