Package com.dyuproject.json.test

Examples of com.dyuproject.json.test.Employee


        String resource = "src/test/resources/com/dyuproject/json/test/employee.json";
        StandardJSON json = new StandardJSON();
        File file = new File(resource);
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        Map<String,Object> map = (Map<String,Object>)json.parse(new ReaderSource(reader));
        Employee e = (Employee)map.get("employee");
        assertTrue(e!=null);
        assertTrue("John".equals(e.getFirstName()));
        List<Task> tasks = e.getTasks();
        assertTrue(tasks!=null && tasks.size()==3);
        assertTrue("10".equals(tasks.get(0).getStatus()));
        assertTrue("15".equals(tasks.get(1).getStatus()));
        assertTrue("20".equals(tasks.get(2).getStatus()));
    }
View Full Code Here


        String resource = "src/test/resources/com/dyuproject/json/test/employees.json";
        StandardJSON json = new StandardJSON(new OverloadConvertorCache());
        File file = new File(resource);
        BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
        Map<String,Object> map = (Map<String,Object>)json.parse(new ReaderSource(reader));
        Employee e = (Employee)map.get("employee");
        BusyEmployee be = (BusyEmployee)map.get("busy_employee");
        assertTrue(e!=null);
        assertTrue(be!=null);
        assertTrue("John".equals(e.getFirstName()));
        assertTrue("John".equals(be.getFirstName()));
        checkTasks(e.getTasks());
        checkTasks(be.getTasks());
        checkExtraTasks(be.getExtraTasks());
    }
View Full Code Here

TOP

Related Classes of com.dyuproject.json.test.Employee

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.