Inline trivial helper method AbstractDaemonTest#previewSubmit

Change-Id: I4515240113524d0e3040be55b66da02aff20422e
This commit is contained in:
Han-Wen Nienhuys
2018-04-18 11:09:22 +02:00
parent 95f643fa52
commit 274cd4f071
3 changed files with 6 additions and 12 deletions

View File

@@ -1253,16 +1253,8 @@ public abstract class AbstractDaemonTest {
return ca;
}
protected BinaryResult submitPreview(String changeId) throws Exception {
return gApi.changes().id(changeId).current().submitPreview();
}
protected BinaryResult submitPreview(String changeId, String format) throws Exception {
return gApi.changes().id(changeId).current().submitPreview(format);
}
protected Map<Branch.NameKey, ObjectId> fetchFromSubmitPreview(String changeId) throws Exception {
try (BinaryResult result = submitPreview(changeId)) {
try (BinaryResult result = gApi.changes().id(changeId).current().submitPreview()) {
return fetchFromBundles(result);
}
}

View File

@@ -203,7 +203,8 @@ public abstract class AbstractSubmit extends AbstractDaemonTest {
// change 2 is not approved, but we ignore labels
approve(change3.getChangeId());
try (BinaryResult request = submitPreview(change4.getChangeId())) {
try (BinaryResult request =
gApi.changes().id(change4.getChangeId()).current().submitPreview()) {
assertThat(getSubmitType()).isEqualTo(SubmitType.CHERRY_PICK);
submit(change4.getChangeId());
} catch (RestApiException e) {

View File

@@ -265,7 +265,7 @@ public class SubmitByMergeIfNecessaryIT extends AbstractSubmitByMerge {
+ "and upload the rebased commit for review.";
// Get a preview before submitting:
try (BinaryResult r = submitPreview(change1b.getChangeId())) {
try (BinaryResult r = gApi.changes().id(change1b.getChangeId()).current().submitPreview()) {
// We cannot just use the ExpectedException infrastructure as provided
// by AbstractDaemonTest, as then we'd stop early and not test the
// actual submit.
@@ -517,7 +517,8 @@ public class SubmitByMergeIfNecessaryIT extends AbstractSubmitByMerge {
// get a preview before submitting:
File tempfile;
try (BinaryResult request = submitPreview(change1.getChangeId(), "tgz")) {
try (BinaryResult request =
gApi.changes().id(change1.getChangeId()).current().submitPreview("tgz")) {
assertThat(request.getContentType()).isEqualTo("application/x-gzip");
tempfile = File.createTempFile("test", null);
request.writeTo(Files.newOutputStream(tempfile.toPath()));