From 62f0e3f50596588f57f98f5239fc207d7dfe72e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Pfeuffer?= Date: Mon, 6 Aug 2018 14:06:36 +0200 Subject: [PATCH] Add checks to repository tests --- .../java/sonia/scm/it/RepositoriesITCase.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scm-it/src/test/java/sonia/scm/it/RepositoriesITCase.java b/scm-it/src/test/java/sonia/scm/it/RepositoriesITCase.java index a6efc64c3f..749875f122 100644 --- a/scm-it/src/test/java/sonia/scm/it/RepositoriesITCase.java +++ b/scm-it/src/test/java/sonia/scm/it/RepositoriesITCase.java @@ -155,22 +155,25 @@ public class RepositoriesITCase { @Test public void shouldCloneRepository() throws IOException { - RepositoryClient rc = createRepositoryClient(); - assertEquals(1, rc.getWorkingCopy().list().length); + RepositoryClient client = createRepositoryClient(); + assertEquals("expected metadata dir", 1, client.getWorkingCopy().list().length); } @Test public void shouldCommitFiles() throws IOException { - RepositoryClient rc = createRepositoryClient(); + RepositoryClient client = createRepositoryClient(); for (int i = 0; i < 5; i++) { - createRandomFile(rc); + createRandomFile(client); } - commit(rc, "added some test files"); + commit(client); + + RepositoryClient checkClient = createRepositoryClient(); + assertEquals("expected 5 files and metadata dir", 6, checkClient.getWorkingCopy().list().length); } - public static void createRandomFile(RepositoryClient client) throws IOException { + private static void createRandomFile(RepositoryClient client) throws IOException { String uuid = UUID.randomUUID().toString(); String name = "file-" + uuid + ".uuid"; @@ -182,8 +185,8 @@ public class RepositoriesITCase { client.getAddCommand().add(name); } - public static void commit(RepositoryClient repositoryClient, String message) throws IOException { - repositoryClient.getCommitCommand().commit(AUTHOR, message); + private static void commit(RepositoryClient repositoryClient) throws IOException { + repositoryClient.getCommitCommand().commit(AUTHOR, "commit"); if ( repositoryClient.isCommandSupported(ClientCommand.PUSH) ) { repositoryClient.getPushCommand().push(); }