Last active
September 25, 2016 11:10
-
-
Save dherges/2c57f675c5df3353e7832734cf6c63ee 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
public class TwitterApiTest { | |
@Rule | |
public MockWebServerPlus server = new MockWebServerPlus(); | |
@Test | |
public void tweet_success() throws IOException { | |
server.enqueue("twitter/statuses/update_ok"); | |
final Response<Tweet> response = twitterApi() | |
.tweet("Too alarming now to talk about") | |
.execute(); | |
assertThat(response).hasBody(); | |
} | |
@Test | |
public void tweet_duplicate() throws IOException { | |
server.enqueue("twitter/statuses/update_duplicate"); | |
final Response<Tweet> response = twitterApi() | |
.tweet("Take those pictures down, shake it out") | |
.execute(); | |
assertThat(response).isForbidden(); | |
} | |
} |
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
statusCode : 403 | |
delay: 1500 |
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
statusCode : 200 | |
delay: 0 | |
body: 'twitter/statuses/update.json' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment