PushConnectionTest: Use Java 7 try-with-resources

Change-Id: I429066d2af9c5fb8bf8bc038b99ebe5a7dc09170
This commit is contained in:
Shawn Pearce 2016-07-05 12:32:24 -07:00
parent b57d060408
commit ae5870a1f2
1 changed files with 3 additions and 10 deletions

View File

@ -125,16 +125,9 @@ public void testWrongOldIdDoesNotReplace() throws IOException {
Map<String, RemoteRefUpdate> updates = new HashMap<>();
updates.put(rru.getRemoteName(), rru);
Transport tn = testProtocol.open(uri, client, "server");
try {
PushConnection connection = tn.openPush();
try {
connection.push(NullProgressMonitor.INSTANCE, updates);
} finally {
connection.close();
}
} finally {
tn.close();
try (Transport tn = testProtocol.open(uri, client, "server");
PushConnection connection = tn.openPush()) {
connection.push(NullProgressMonitor.INSTANCE, updates);
}
assertEquals(REJECTED_OTHER_REASON, rru.getStatus());