@Test public void testAddUser() throws Exception { User user = new User(110115716); // Adiciona um User 11/0115716 ArrayList<Materia> matList = new ArrayList<>(); // ArrayList<MateriaCursada> hisList = new ArrayList<>(); // matList.add(new Materia()); // hisList.add(new MateriaCursada()); // Cria ArrayLists de matérias com uma informação apenas db.addUser(user, matList, hisList); // assertNotNull(db.getUser(0)); // Checa se existe o user recém-criado assertEquals(db.getUser(0).getMatricula(), 110115716); // Checa a matrícula }
@Test public void testGetUser1() throws Exception { User user = new User(110115716); // Adiciona um User 11/0115716 ArrayList<Materia> matList = new ArrayList<>(); // ArrayList<MateriaCursada> hisList = new ArrayList<>(); // matList.add(new Materia()); // hisList.add(new MateriaCursada()); // Cria ArrayLists de matérias com uma informação apenas db.addUser(user, matList, hisList); User userNew = db.getUser("110115716"); // Adicionei um "mock" com 11/0115716 assertNotNull(user); }
@Test public void testGetUser() throws Exception { User user = new User(110115716); // Adiciona um User 11/0115716 ArrayList<Materia> matList = new ArrayList<>(); // ArrayList<MateriaCursada> hisList = new ArrayList<>(); // matList.add(new Materia()); // hisList.add(new MateriaCursada()); // Cria ArrayLists de matérias com uma informação apenas db.addUser(user, matList, hisList); User userNew = db.getUser(0); // Verifica se há um user no DB assertNotNull(userNew); // }
@Test public void testDelUser() throws Exception { User user = new User(110115716); // Adiciona um User 11/0115716 ArrayList<Materia> matList = new ArrayList<>(); // ArrayList<MateriaCursada> hisList = new ArrayList<>(); // matList.add(new Materia()); // hisList.add(new MateriaCursada()); // Cria ArrayLists de matérias com uma informação apenas db.addUser(user, matList, hisList); db.delUser(db.getUser(0)); assertNull(db.getUser(0)); // Verifica se a exclusão foi efetuada. }
@Test public void testUpdUser() throws Exception { User user = new User(110115716); // Adiciona um User 11/0115716 ArrayList<Materia> matList = new ArrayList<>(); // ArrayList<MateriaCursada> hisList = new ArrayList<>(); // matList.add(new Materia()); // hisList.add(new MateriaCursada()); // Cria ArrayLists de matérias com uma informação apenas db.addUser(user, matList, hisList); db.updUser( db.getUser(0)); // TODO dar um jeito de verificar as informações além do status do objeto assertNotNull(db.getUser(0)); // }
@Test public void testPrintDB() throws Exception { db.printDB(); }
@Test public void testDropDB() throws Exception { db.dropDB(); assertNull(db.getUser(0)); }
@Test public void testOnUpgrade() throws Exception { DBCore newDB = new DBCore(main); newDB.onUpgrade(db.getWritableDatabase(), 0, 1); assertNotNull(newDB); }
@Test public void testOnCreate() throws Exception { assertNotNull(db.getWritableDatabase()); assertNotNull(db.getReadableDatabase()); }
@After public void tearDown() throws Exception { db.close(); super.tearDown(); }