diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2014-01-27 07:56:25 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2014-01-27 07:57:23 +0100 |
commit | 862dcc753c7f3f0f3baed6679517edf3655ea1ec (patch) | |
tree | 4c36c6c211d2da763eb1aac98a6ff1c7e49577d2 /sonar-testing-harness | |
parent | 04bc6b52d79e9d357078b28a083e63d267f33d8b (diff) | |
download | sonarqube-862dcc753c7f3f0f3baed6679517edf3655ea1ec.tar.gz sonarqube-862dcc753c7f3f0f3baed6679517edf3655ea1ec.zip |
SONAR-5010 fix handling of HTTP status
Diffstat (limited to 'sonar-testing-harness')
-rw-r--r-- | sonar-testing-harness/src/main/java/org/sonar/api/server/ws/WsTester.java | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/api/server/ws/WsTester.java b/sonar-testing-harness/src/main/java/org/sonar/api/server/ws/WsTester.java index 664cae76f43..4e1c774e74d 100644 --- a/sonar-testing-harness/src/main/java/org/sonar/api/server/ws/WsTester.java +++ b/sonar-testing-harness/src/main/java/org/sonar/api/server/ws/WsTester.java @@ -97,6 +97,7 @@ public class WsTester { public class TestStream implements Response.Stream { private String mediaType; + private int status; @CheckForNull public String mediaType() { @@ -110,12 +111,17 @@ public class WsTester { } @Override + public Response.Stream setStatus(int i) { + this.status = i; + return this; + } + + @Override public OutputStream output() { return output; } } - private int status = 200; private final ByteArrayOutputStream output = new ByteArrayOutputStream(); @Override @@ -133,21 +139,11 @@ public class WsTester { return new TestStream(); } - @Override - public int status() { - return status; - } - - @Override - public Response setStatus(int httpStatus) { - this.status = httpStatus; - return this; - } @Override - public void noContent() { - setStatus(204); + public Response noContent() { IOUtils.closeQuietly(output); + return this; } } @@ -159,13 +155,8 @@ public class WsTester { this.response = response; } - public Result assertStatus(int httpStatus) { - assertThat(httpStatus).isEqualTo(response.status()); - return this; - } - public Result assertNoContent() { - assertStatus(204); + //FIXME return this; } |