Search in sources :

Example 21 with MockControl

use of org.easymock.MockControl in project maven-archetype by apache.

the class DefaultArchetypeSelectorTest method testArchetypeNotInRequestDefaultsInBatchMode.

public void testArchetypeNotInRequestDefaultsInBatchMode() throws PrompterException, IOException, UnknownGroup, ArchetypeSelectionFailure, UnknownArchetype, ArchetypeNotDefined {
    ArchetypeGenerationRequest request = new ArchetypeGenerationRequest();
    MockControl control = MockControl.createControl(ArchetypeSelectionQueryer.class);
    ArchetypeSelectionQueryer queryer = (ArchetypeSelectionQueryer) control.getMock();
    // expect it to not be called
    control.replay();
    selector.setArchetypeSelectionQueryer(queryer);
    selector.selectArchetype(request, Boolean.FALSE, "");
    control.verify();
    assertEquals(DefaultArchetypeSelector.DEFAULT_ARCHETYPE_GROUPID, request.getArchetypeGroupId());
    assertEquals(DefaultArchetypeSelector.DEFAULT_ARCHETYPE_ARTIFACTID, request.getArchetypeArtifactId());
    assertEquals(DefaultArchetypeSelector.DEFAULT_ARCHETYPE_VERSION, request.getArchetypeVersion());
}
Also used : MockControl(org.easymock.MockControl) ArchetypeGenerationRequest(org.apache.maven.archetype.ArchetypeGenerationRequest)

Aggregations

MockControl (org.easymock.MockControl)21 Hashtable (java.util.Hashtable)8 Bundle (org.osgi.framework.Bundle)8 BundleContext (org.osgi.framework.BundleContext)8 ServiceRegistration (org.osgi.framework.ServiceRegistration)8 Archetype (org.apache.maven.archetype.catalog.Archetype)7 Prompter (org.codehaus.plexus.components.interactivity.Prompter)6 ArrayList (java.util.ArrayList)5 List (java.util.List)5 ArchetypeGenerationRequest (org.apache.maven.archetype.ArchetypeGenerationRequest)5 Collection (java.util.Collection)4 ArchetypeDefinition (org.apache.maven.archetype.ui.ArchetypeDefinition)4 ServiceFactory (org.osgi.framework.ServiceFactory)3 EventHook (org.osgi.framework.hooks.service.EventHook)3 FindHook (org.osgi.framework.hooks.service.FindHook)3 ListenerHook (org.osgi.framework.hooks.service.ListenerHook)3 ArchetypeArtifactManager (org.apache.maven.archetype.common.ArchetypeArtifactManager)2 UnknownArchetype (org.apache.maven.archetype.exception.UnknownArchetype)2 ProjectBuildingRequest (org.apache.maven.project.ProjectBuildingRequest)2 ServiceEvent (org.osgi.framework.ServiceEvent)2