Created
January 16, 2018 21:16
-
-
Save finsterthecat/c241ef32ec783b97e51f756884224855 to your computer and use it in GitHub Desktop.
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
/* | |
* Used in our tests to make the RESTful calls | |
*/ | |
private ResultActions invokeAllHeroes() throws Exception { | |
return mvc.perform(get(BASE_URL).accept(MediaType.APPLICATION_JSON)); | |
} | |
private ResultActions invokeSearchHeroes(String term) throws Exception { | |
return mvc.perform(get(BASE_URL + "search/name?contains=" + term).accept(MediaType.APPLICATION_JSON)); | |
} | |
private ResultActions invokeGetHero(Long id) throws Exception { | |
return mvc.perform(get(BASE_URL + id).accept(MediaType.APPLICATION_JSON)); | |
} | |
private ResultActions invokeCreateHero(byte[] heroJson) throws Exception { | |
return mvc.perform(post(BASE_URL).content(heroJson).contentType(MediaType.APPLICATION_JSON) | |
.accept(MediaType.APPLICATION_JSON)); | |
} | |
private ResultActions invokeUpdateHero(Long id, byte[] heroJson) throws Exception { | |
return mvc.perform(put(BASE_URL + id).content(heroJson).contentType(MediaType.APPLICATION_JSON) | |
.accept(MediaType.APPLICATION_JSON)); | |
} | |
private ResultActions invokeDeleteHero(Long id) throws Exception { | |
return mvc.perform(delete(BASE_URL + id)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment