add Test / HgBrowseCommand shouldResolveBranchForRevision

This commit is contained in:
Eduard Heimbuch
2019-10-29 10:49:38 +01:00
parent 730646f4a8
commit a13d129eff

View File

@@ -33,6 +33,7 @@
package sonia.scm.repository.spi;
import com.aragost.javahg.commands.LogCommand;
import org.junit.Test;
import sonia.scm.repository.BrowserResult;
import sonia.scm.repository.FileObject;
@@ -40,6 +41,7 @@ import sonia.scm.repository.FileObject;
import java.io.IOException;
import java.util.Collection;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -79,6 +81,19 @@ public class HgBrowseCommandTest extends AbstractHgCommandTestBase {
assertEquals("c", c.getPath());
}
@Test
public void testBrowseShouldResolveBranchForRevision() throws IOException {
String defaultBranchRevision = new LogCommand(cmdContext.open()).rev("default").single().getNode();
BrowseCommandRequest browseCommandRequest = new BrowseCommandRequest();
browseCommandRequest.setRevision("default");
BrowserResult result = new HgBrowseCommand(cmdContext,
repository).getBrowserResult(browseCommandRequest);
assertThat(result.getRevision()).isEqualTo(defaultBranchRevision);
}
@Test
public void testBrowseSubDirectory() throws IOException {
BrowseCommandRequest request = new BrowseCommandRequest();