Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

java unit test an api

@Test
public void
  givenUserExists_whenUserInformationIsRetrieved_thenRetrievedResourceIsCorrect()
  throws ClientProtocolException, IOException {
  
    // Given
    HttpUriRequest request = new HttpGet( "https://api.github.com/users/eugenp" );
 
    // When
    HttpResponse response = HttpClientBuilder.create().build().execute( request );
 
    // Then
    GitHubUser resource = RetrieveUtil.retrieveResourceFromResponse(
      response, GitHubUser.class);
    assertThat( "eugenp", Matchers.is( resource.getLogin() ) );
}
Comment

PREVIOUS NEXT
Code Example
Java :: primitive data types in java 
Java :: arraylist of double 
Java :: sort a string array java 
Java :: testing the web layer without authentication spring 
Java :: java stack methods 
Java :: javac clear 
Java :: repository query spring boot 
Java :: intellisense for eclipse java 
Java :: find minimum in array java 
Java :: docker java image 
Java :: how to initialize array in java with 0 
Java :: car class java 
Java :: java split string array 
Java :: java write in a file without overwriting 
Java :: skip values in a for loop java 
Java :: spring db properties 
Java :: close keyboard android 
Java :: java logger with different colors 
Java :: array arraylist java 
Java :: is a and has a relationship in java 
Java :: Java char data type 
Java :: flink prometheus alert on failed jobs 
Java :: javafx rectangle border size 
Java :: what is maven artifact 
Java :: pre increment and post increments 
Java :: convert int to byte java 
Java :: chenge font android studio 
Java :: imageview.setbackground 
Java :: how to change java version in pom.xml 
Java :: java_remove last char 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =