diff --git a/src/se/vidstige/jadb/DeviceWatcher.java b/src/se/vidstige/jadb/DeviceWatcher.java index facf092..3965e60 100644 --- a/src/se/vidstige/jadb/DeviceWatcher.java +++ b/src/se/vidstige/jadb/DeviceWatcher.java @@ -1,6 +1,5 @@ package se.vidstige.jadb; -import java.util.List; import java.io.IOException; public class DeviceWatcher implements Runnable { diff --git a/src/se/vidstige/jadb/JadbConnection.java b/src/se/vidstige/jadb/JadbConnection.java index 5cd59fb..9658a61 100644 --- a/src/se/vidstige/jadb/JadbConnection.java +++ b/src/se/vidstige/jadb/JadbConnection.java @@ -2,7 +2,6 @@ package se.vidstige.jadb; import java.io.IOException; import java.net.Socket; -import java.net.SocketException; import java.util.ArrayList; import java.util.List; diff --git a/src/se/vidstige/jadb/managers/PackageManager.java b/src/se/vidstige/jadb/managers/PackageManager.java index f630368..45aebfb 100644 --- a/src/se/vidstige/jadb/managers/PackageManager.java +++ b/src/se/vidstige/jadb/managers/PackageManager.java @@ -90,6 +90,7 @@ public class PackageManager { public void launch(Package name) throws IOException, JadbException { InputStream s = device.executeShell("monkey", "-p", name.toString(), "-c", "android.intent.category.LAUNCHER", "1"); + s.close(); } // @@ -132,7 +133,7 @@ public class PackageManager { new InstallOption("-d"); /** - * This option is sSupported only from Android 6.X+ + * This option is supported only from Android 6.X+ */ public static final InstallOption GRANT_ALL_PERMISSIONS = new InstallOption("-g"); diff --git a/test/se/vidstige/jadb/test/integration/RealDeviceTestCases.java b/test/se/vidstige/jadb/test/integration/RealDeviceTestCases.java index 134353f..92a6d60 100644 --- a/test/se/vidstige/jadb/test/integration/RealDeviceTestCases.java +++ b/test/se/vidstige/jadb/test/integration/RealDeviceTestCases.java @@ -1,5 +1,6 @@ package se.vidstige.jadb.test.integration; +import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Rule; @@ -49,6 +50,7 @@ public class RealDeviceTestCases { @Test public void testGetDevices() throws Exception { List actual = jadb.getDevices(); + Assert.assertNotNull(actual); //Assert.assertEquals("emulator-5554", actual.get(0).getSerial()); } @@ -92,7 +94,8 @@ public class RealDeviceTestCases { any.pull(new RemoteFile("/file/does/not/exist"), temporaryFolder.newFile("xyz")); } - @Test + @SuppressWarnings("deprecation") + @Test public void testShellExecuteTwice() throws Exception { JadbDevice any = jadb.getAnyDevice(); any.executeShell(System.out, "ls /"); diff --git a/test/se/vidstige/jadb/test/unit/AdbOutputStreamFixture.java b/test/se/vidstige/jadb/test/unit/AdbOutputStreamFixture.java index 5dae716..09a012d 100644 --- a/test/se/vidstige/jadb/test/unit/AdbOutputStreamFixture.java +++ b/test/se/vidstige/jadb/test/unit/AdbOutputStreamFixture.java @@ -13,8 +13,12 @@ public class AdbOutputStreamFixture { private byte[] passthrough(byte[] input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); OutputStream sut = new AdbFilterOutputStream(output); - sut.write(input); - sut.flush(); + try { + sut.write(input); + sut.flush(); + } finally { + sut.close(); + } return output.toByteArray(); } diff --git a/test/se/vidstige/jadb/test/unit/MockedTestCases.java b/test/se/vidstige/jadb/test/unit/MockedTestCases.java index 5e2383b..14dbbf9 100644 --- a/test/se/vidstige/jadb/test/unit/MockedTestCases.java +++ b/test/se/vidstige/jadb/test/unit/MockedTestCases.java @@ -8,7 +8,6 @@ import se.vidstige.jadb.JadbConnection; import se.vidstige.jadb.JadbDevice; import se.vidstige.jadb.JadbException; import se.vidstige.jadb.RemoteFile; -import se.vidstige.jadb.managers.PropertyManager; import se.vidstige.jadb.test.fakes.FakeAdbServer; import java.io.ByteArrayInputStream; @@ -18,7 +17,6 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.List; -import java.util.Map; public class MockedTestCases {