Guest User

Untitled

a guest
Mar 13th, 2018
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. package pl.dynatrace.task;
  2.  
  3. import com.google.gson.Gson;
  4. import org.javalite.http.Http;
  5.  
  6. import java.io.IOException;
  7.  
  8. class RandomNumberGeneratorClient {
  9.  
  10. private static final String URL = "http://dt-gwitczak-recruitment.westeurope.cloudapp.azure.com:8080/rest/task";
  11. private static final String USERNAME = "candidate";
  12. private static final String PASSWORD = "abc123";
  13.  
  14. private final Gson gson;
  15.  
  16. RandomNumberGeneratorClient() {
  17. gson = new Gson();
  18. }
  19.  
  20.  
  21. RandomNumbersResponse readRandomNumbers() throws IOException {
  22.  
  23. return gson.fromJson(Http.get(URL).basic(USERNAME, PASSWORD).text(), RandomNumbersResponse.class);
  24. }
  25.  
  26. }
Add Comment
Please, Sign In to add comment