From 376c20f45457c0db11850c6e45e11ee764072508 Mon Sep 17 00:00:00 2001 From: Matthias Sohn Date: Thu, 18 Jul 2019 13:25:39 +0200 Subject: [PATCH] Add missing javadoc in org.eclipse.jgit.junit Change-Id: Ib709ef050bec31c87f542fb2cc977863dda93ef9 Signed-off-by: Matthias Sohn --- .../org/eclipse/jgit/junit/RepeatRule.java | 18 +++ .../eclipse/jgit/junit/TestRepository.java | 139 ++++++++++++++++++ 2 files changed, 157 insertions(+) diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java index a76f348536..8636f2a0aa 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/RepeatRule.java @@ -81,13 +81,31 @@ public class RepeatRule implements TestRule { private static Logger LOG = Logger .getLogger(RepeatRule.class.getName()); + /** + * Exception thrown if repeated execution of a test annotated with + * {@code @Repeat} failed. + */ public static class RepeatedTestException extends RuntimeException { private static final long serialVersionUID = 1L; + /** + * Constructor + * + * @param message + * the error message + */ public RepeatedTestException(String message) { super(message); } + /** + * Constructor + * + * @param message + * the error message + * @param cause + * exception causing this exception + */ public RepeatedTestException(String message, Throwable cause) { super(message, cause); } diff --git a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java index c9fa2f506c..49a2b2010d 100644 --- a/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java +++ b/org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/TestRepository.java @@ -1059,6 +1059,14 @@ public class TestRepository { parents.add(prior.create()); } + /** + * set parent commit + * + * @param p + * parent commit + * @return this commit builder + * @throws Exception + */ public CommitBuilder parent(RevCommit p) throws Exception { if (parents.isEmpty()) { DirCacheBuilder b = tree.builder(); @@ -1071,29 +1079,71 @@ public class TestRepository { return this; } + /** + * Get parent commits + * + * @return parent commits + */ public List parents() { return Collections.unmodifiableList(parents); } + /** + * Remove parent commits + * + * @return this commit builder + */ public CommitBuilder noParents() { parents.clear(); return this; } + /** + * Remove files + * + * @return this commit builder + */ public CommitBuilder noFiles() { tree.clear(); return this; } + /** + * Set top level tree + * + * @param treeId + * the top level tree + * @return this commit builder + */ public CommitBuilder setTopLevelTree(ObjectId treeId) { topLevelTree = treeId; return this; } + /** + * Add file with given content + * + * @param path + * path of the file + * @param content + * the file content + * @return this commit builder + * @throws Exception + */ public CommitBuilder add(String path, String content) throws Exception { return add(path, blob(content)); } + /** + * Add file with given path and blob + * + * @param path + * path of the file + * @param id + * blob for this file + * @return this commit builder + * @throws Exception + */ public CommitBuilder add(String path, RevBlob id) throws Exception { return edit(new PathEdit(path) { @@ -1105,6 +1155,13 @@ public class TestRepository { }); } + /** + * Edit the index + * + * @param edit + * the index record update + * @return this commit builder + */ public CommitBuilder edit(PathEdit edit) { DirCacheEditor e = tree.editor(); e.add(edit); @@ -1112,6 +1169,13 @@ public class TestRepository { return this; } + /** + * Remove a file + * + * @param path + * path of the file + * @return this commit builder + */ public CommitBuilder rm(String path) { DirCacheEditor e = tree.editor(); e.add(new DeletePath(path)); @@ -1120,49 +1184,111 @@ public class TestRepository { return this; } + /** + * Set commit message + * + * @param m + * the message + * @return this commit builder + */ public CommitBuilder message(String m) { message = m; return this; } + /** + * Get the commit message + * + * @return the commit message + */ public String message() { return message; } + /** + * Tick the clock + * + * @param secs + * number of seconds + * @return this commit builder + */ public CommitBuilder tick(int secs) { tick = secs; return this; } + /** + * Set author and committer identity + * + * @param ident + * identity to set + * @return this commit builder + */ public CommitBuilder ident(PersonIdent ident) { author = ident; committer = ident; return this; } + /** + * Set the author identity + * + * @param a + * the author's identity + * @return this commit builder + */ public CommitBuilder author(PersonIdent a) { author = a; return this; } + /** + * Get the author identity + * + * @return the author identity + */ public PersonIdent author() { return author; } + /** + * Set the committer identity + * + * @param c + * the committer identity + * @return this commit builder + */ public CommitBuilder committer(PersonIdent c) { committer = c; return this; } + /** + * Get the committer identity + * + * @return the committer identity + */ public PersonIdent committer() { return committer; } + /** + * Insert changeId + * + * @return this commit builder + */ public CommitBuilder insertChangeId() { changeId = ""; return this; } + /** + * Insert given changeId + * + * @param c + * changeId + * @return this commit builder + */ public CommitBuilder insertChangeId(String c) { // Validate, but store as a string so we can use "" as a sentinel. ObjectId.fromString(c); @@ -1170,6 +1296,13 @@ public class TestRepository { return this; } + /** + * Create the commit + * + * @return the new commit + * @throws Exception + * if creation failed + */ public RevCommit create() throws Exception { if (self == null) { TestRepository.this.tick(tick); @@ -1230,6 +1363,12 @@ public class TestRepository { + cid.getName() + "\n"); //$NON-NLS-1$ } + /** + * Create child commit builder + * + * @return child commit builder + * @throws Exception + */ public CommitBuilder child() throws Exception { return new CommitBuilder(this); } -- 2.39.5