gordonad / powermock

Automatically exported from code.google.com/p/powermock
0 stars 0 forks source link

Support recursive partial mocking #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be cool to support "recursive partial mocking". 

Imagine this: 
void addFolderToLogPaths(final File logFolder, final List<LogFile> logFileList,
        final Collection<ITargetPersistenceUnit> persistentUnits) {
        if (!logFolder.isDirectory()) {
            throw new IllegalArgumentException("logPath is not a directory.");
        }

        final File[] allLogFiles = logFolder.listFiles();
        for (File fileOrDirectory : allLogFiles) {
            if (fileOrDirectory.isDirectory()) {
                addFolderToLogPaths(fileOrDirectory, logFileList,
persistentUnits);
            } else {
                logFileList.add(new
LogFile(getRelativeLogPath(fileOrDirectory), fileOrDirectory.lastModified(),
                    isFileReplayable(persistentUnits, fileOrDirectory)));
            }
        }
    }

We could implement so that one call to addFolderToLogPaths (the actual test
invocation) passes the MockGateway but sequential invocations should be
mocked. 

Original issue reported on code.google.com by johan.ha...@gmail.com on 1 Oct 2008 at 12:54