Created
September 25, 2016 12:20
-
-
Save dherges/883c0cff85ac901900782c8f3dfd59d5 to your computer and use it in GitHub Desktop.
ok-testing-reloaded-medium
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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