mirror of
https://github.com/revanced/jadb.git
synced 2025-02-10 17:26:46 +01:00
better assert messages on unit test fail
This commit is contained in:
parent
081154ee1e
commit
fd1a833e6d
@ -186,10 +186,18 @@ public class FakeAdbServer implements AdbResponder {
|
||||
}
|
||||
|
||||
public void verifyExpectations() {
|
||||
org.junit.Assert.assertEquals(0, fileExpectations.size());
|
||||
org.junit.Assert.assertEquals(0, shellExpectations.size());
|
||||
org.junit.Assert.assertEquals(0, listExpectations.size());
|
||||
org.junit.Assert.assertEquals(0, tcpipExpectations.size());
|
||||
for (FileExpectation expectation : fileExpectations) {
|
||||
org.junit.Assert.fail(expectation.toString());
|
||||
}
|
||||
for (ShellExpectation expectation : shellExpectations) {
|
||||
org.junit.Assert.fail(expectation.toString());
|
||||
}
|
||||
for (ListExpectation expectation : listExpectations) {
|
||||
org.junit.Assert.fail(expectation.toString());
|
||||
}
|
||||
for (int expectation : tcpipExpectations) {
|
||||
org.junit.Assert.fail("Expected tcp/ip on" + expectation);
|
||||
}
|
||||
}
|
||||
|
||||
private static class FileExpectation implements ExpectationBuilder {
|
||||
@ -233,6 +241,11 @@ public class FakeAdbServer implements AdbResponder {
|
||||
public void returnFile(ByteArrayOutputStream buffer) throws IOException {
|
||||
buffer.write(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Expected file " + path;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ShellExpectation {
|
||||
@ -254,6 +267,11 @@ public class FakeAdbServer implements AdbResponder {
|
||||
public void writeOutputTo(DataOutputStream stdout) throws IOException {
|
||||
stdout.write(this.stdout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Expected shell " + command;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ListExpectation {
|
||||
@ -282,6 +300,11 @@ public class FakeAdbServer implements AdbResponder {
|
||||
public List<RemoteFile> getFiles() {
|
||||
return Collections.unmodifiableList(files);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Expected file list " + remotePath;
|
||||
}
|
||||
|
||||
private static class MockFileEntry extends RemoteFile {
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user