Skip to content

Instantly share code, notes, and snippets.

@dherges
Created September 25, 2016 12:20
Show Gist options
  • Save dherges/883c0cff85ac901900782c8f3dfd59d5 to your computer and use it in GitHub Desktop.
Save dherges/883c0cff85ac901900782c8f3dfd59d5 to your computer and use it in GitHub Desktop.
ok-testing-reloaded-medium
import static org.assertj.core.api.Assertions.assertThat;
import static ext.assertj.MyAssertions.assertThat;
@RunWith(SparkRunner.class)
@SparkApplicationTest(value = TwitterApp.class, port = 4444)
public class TwitterAppTest {
private final OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
@Test
public void test() throws IOException {
final Request request = new Request.Builder()
.get()
.url("http://localhost:4444/statuses/retweets/123")
.build();
final Response response = okHttpClient.newCall(request).execute();
assertThat(response.body().string()).startsWith("[{\"favorited\":true,\"id\":123");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment