mirror of
https://github.com/Voronsky/unifi4j.git
synced 2025-12-12 16:16:34 -05:00
new test case, WIP
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user