So I have a class that holds a bunch of methods(migrated from another project) that are suppose hit a REST API,but I don't know if they are working correctly.I want to create a driver class that i can run manually to test these methods.
For example, I have a get() method that hits the actual REST API, but how would I test the inner meat of the method like if it is building the query parameter correctly, etc. I was thinking of a test driver class that returns the the status code and then the object since it will hit the actual endpoint. Any thoughts? and ideas
Example of class get()
public Object get(String endpointName, String id) { UriBuilder uriBuilder = uriBuilder().path(DataConstants.PATH_GET); uriBuilder.queryParamIfPresent(GET_PARAM_ENDPOINT_NAME, optionalString(endpointName)); uriBuilder.path(requiredPath(GET_PARAM_ID, id)); try { String url = uriBuilder.build().toURL().toString(); String accessToken = this.clientHelper.accessToken(); ResponseEntity<String> result = HttpHelper.get(url, accessToken); return this.fromJsonString(result.getBody(), new TypeReference<Object>() {}); } catch (MalformedURLException e) { log.error(e.getLocalizedMessage(), e); } return null; }I was thinking of a test driver class that returns the the status code and then the object since it will hit the actual endpoint. Any thoughts? and ideas