new test case, WIP

This commit is contained in:
2024-08-28 09:57:36 -04:00
parent 88776bca71
commit 5790e115e5

View File

@@ -1,9 +1,13 @@
package com.voronsky.unifi4j; package com.voronsky.unifi4j;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import java.util.Objects; import java.util.ArrayList;
import java.util.List;
public class UnifiTests { public class UnifiTests {
@@ -19,5 +23,27 @@ public class UnifiTests {
assert response.getStatusCode().is2xxSuccessful(); assert response.getStatusCode().is2xxSuccessful();
assert !response.getBody().isEmpty(); assert !response.getBody().isEmpty();
try{
JSONObject jsonObject = new JSONObject(response.getBody());
System.out.println(jsonObject);
} catch (JSONException err){
System.out.println(err.toString());
}
}
@Test
public void GetHardwaresTest(){
List<String> response = new ArrayList<>();
System.out.println("UNIFI_KEY: "+System.getenv("UNIFI_KEY"));
Unifi unifi = new Unifi("https://api.ui.com/ea", System.getenv("UNIFI_KEY"));
try {
response = unifi.getHardware();
}
catch(Exception e){
System.out.println("Exception: "+e);
assert false;
}
System.out.println(response);
} }
} }