Search in sources :

Example 1 with UnitResponseTestUnit

use of info.xiancloud.core.test.output_test.UnitResponseTestUnit in project xian by happyyangyuan.

the class UnitRequestTest method testGetList.

@Test
public void testGetList() {
    List<Integer> list = new UnitRequest(new JSONObject() {

        {
            put("yy", new int[] { 0, 1 });
        }
    }).getList("yy");
    Assert.assertTrue(list.get(0) == 0);
    Assert.assertTrue(list.get(1) == 1);
    List<Unit> unitList = new UnitRequest(new JSONObject() {

        {
            put("yy", new Unit[] { new UnitResponseTestUnit() });
        }
    }).getList("yy");
    Assert.assertTrue(unitList.get(0).getName().equals(new UnitResponseTestUnit().getName()));
    List<UnitProxy> proxyList = new UnitRequest(new JSONObject() {

        {
            put("yy", new String[] { new UnitResponseTestUnit().toJSONString() });
        }
    }).getList("yy", UnitProxy.class);
    Assert.assertTrue(proxyList.get(0).getName().equals(new UnitResponseTestUnit().getName()));
}
Also used : UnitResponseTestUnit(info.xiancloud.core.test.output_test.UnitResponseTestUnit) UnitRequest(info.xiancloud.core.message.UnitRequest) JSONObject(com.alibaba.fastjson.JSONObject) Unit(info.xiancloud.core.Unit) UnitResponseTestUnit(info.xiancloud.core.test.output_test.UnitResponseTestUnit) UnitProxy(info.xiancloud.core.distribution.UnitProxy) Test(org.junit.Test)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1 Unit (info.xiancloud.core.Unit)1 UnitProxy (info.xiancloud.core.distribution.UnitProxy)1 UnitRequest (info.xiancloud.core.message.UnitRequest)1 UnitResponseTestUnit (info.xiancloud.core.test.output_test.UnitResponseTestUnit)1 Test (org.junit.Test)1