mirror of
https://github.com/revanced/jadb.git
synced 2024-11-19 10:39:23 +01:00
Refactor: Using FakeAdbServer in unit tests.
This commit is contained in:
parent
aecd17a446
commit
1ff8504e3d
@ -8,17 +8,18 @@ import se.vidstige.jadb.JadbConnection;
|
||||
import se.vidstige.jadb.JadbDevice;
|
||||
import se.vidstige.jadb.server.AdbServer;
|
||||
import se.vidstige.jadb.server.SocketServer;
|
||||
import se.vidstige.jadb.test.fakes.FakeAdbServer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MockedTestCases {
|
||||
|
||||
private SocketServer server;
|
||||
private FakeAdbServer server;
|
||||
private JadbConnection connection;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception{
|
||||
server = new AdbServer(15037);
|
||||
server = new FakeAdbServer(15037);
|
||||
server.start();
|
||||
connection = new JadbConnection("localhost", 15037);
|
||||
}
|
||||
|
27
test/se/vidstige/jadb/test/fakes/FakeAdbServer.java
Normal file
27
test/se/vidstige/jadb/test/fakes/FakeAdbServer.java
Normal file
@ -0,0 +1,27 @@
|
||||
package se.vidstige.jadb.test.fakes;
|
||||
|
||||
import se.vidstige.jadb.server.AdbDeviceResponder;
|
||||
import se.vidstige.jadb.server.AdbResponder;
|
||||
import se.vidstige.jadb.server.AdbServer;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by vidstige on 2014-03-20.
|
||||
*/
|
||||
public class FakeAdbServer implements AdbResponder, AdbDeviceResponder {
|
||||
private final AdbServer server;
|
||||
|
||||
public FakeAdbServer(int port) {
|
||||
server = new AdbServer(port);
|
||||
}
|
||||
|
||||
|
||||
public void start() throws InterruptedException {
|
||||
server.start();
|
||||
}
|
||||
|
||||
public void stop() throws IOException, InterruptedException {
|
||||
server.stop();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user