I tried to make fun of some maven classes.
I know that I can mock an interface or class with maps
def projectMock = [ getBasedir: { new File("") } ] as MavenProject
But how do I make fun of a method that receives parameters?
I tried using "MockFor" for this:
def artifactFactoryMockContext = new MockFor(ArtifactFactory) artifactFactoryMockContext.demand.createArtifact(1) {groupId, artifactId, version, classifier, type -> artifact } def artifactFactory = artifactFactoryMockContext.proxyInstance()
But I get an UnsupportedOperationException. What am I doing wrong here?
source share