A project I'm working on interacts heavily with Subversion, using svnkit.
Are there any examples on running a mock in-memory svn instance, to help facilitate testing etc?
Cheers
Marty
It's quite straightforward to create a temporary SVN repository on the filesystem to use during the test which you can delete immediately at the end of the test. You would use file:// protocol to access it.
import static org.junit.Assert.*;
import java.io.*;
import org.apache.commons.io.FileUtils;
import org.junit.*;
import org.tmatesoft.svn.core.*;
public class SVNTest {
private static final String path = "/tmp/testrepo";
SVNURL tgtURL;
@Before
public void setUp() throws Exception {
SVNRepositoryFactoryImpl.setup();
tgtURL = SVNRepositoryFactory.createLocalRepository( new File( path ), true , false );
}
@After
public void tearDown() throws IOException {
FileUtils.deleteDirectory(new File(path));
}
@Test
public void test() {
fail("Not yet implemented");
}
}
Why don't you just create a simple SVN repository with mock data ? It's just a few commands.
you may be intested in mockito , that should work fine with SVNkit
my 0.02$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.