### Question:
SingleRequestUploader implements Uploader { @Override public Result publish(final Artifact artifact) throws InterruptedException, IOException, ExecutionException { final FileSet fileSet = this.getArtifactFiles(artifact); this.publish(artifact, fileSet); return artifact.getResult(); } SingleRequestUploader(
            final RequestFactory requestFactory,
            final Network network,
            final Log log); @Override Result publish(final Artifact artifact);  }### Answer:
@Test public void shouldBeSuccessOnCreateResponse() throws IOException, ExecutionException, InterruptedException { final Uploader uploader = new SingleRequestUploader(this.requestFactory, this.network, this.log); final Artifact artifact = new Artifact(this.store, new File("."), this.publication, Result.SUCCESS); final ApiResponse response = this.responseBuilder.create("post-apps-201.json", 201, "Success"); this.network.add(response); final Result result = uploader.publish(artifact); assertThat(result).isEqualTo(Result.SUCCESS); }
@Test public void shouldBeUnstableOnAlreadyExistsResponse() throws IOException, ExecutionException, InterruptedException { final Uploader uploader = new SingleRequestUploader(this.requestFactory, this.network, this.log); final Artifact artifact = new Artifact(this.store, new File("."), this.publication, Result.SUCCESS); final ApiResponse response = this.responseBuilder.create("post-apps-422.json", 422, "Success"); this.network.add(response); final Result result = uploader.publish(artifact); assertThat(result).isEqualTo(Result.UNSTABLE); }
@Test public void shouldBeUnstableOnEmptyResponse() throws IOException, ExecutionException, InterruptedException { final Uploader uploader = new SingleRequestUploader(this.requestFactory, this.network, this.log); final Artifact artifact = new Artifact(this.store, new File("."), this.publication, Result.SUCCESS); final Result result = uploader.publish(artifact); assertThat(result).isEqualTo(Result.UNSTABLE); }
@Test public void shouldBeNotBuildIfFileMissing() throws IOException, ExecutionException, InterruptedException { final Uploader uploader = new SingleRequestUploader(this.requestFactory, this.network, this.log); final Artifact artifact = new Artifact(this.store, new File("."), this.publication, Result.SUCCESS); this.publication.setArtifactPath("**/build/outputs/apk/missing-*.apk"); final Result result = uploader.publish(artifact); assertThat(result).isEqualTo(Result.NOT_BUILT); }