public function testCount() { // Remove the following lines when you implement this test. $this->assertTrue($this->object->count() == 10); $this->object->add(99); $this->assertTrue($this->object->count() == 11); $this->object->clear(); $this->assertTrue($this->object->count() == 0); }
/** * This method tests the add and the get method * of the ArrayList. * * @return void */ public function testAddAndGetAndIsEmptyAndClear() { // initialize a new ArrayList $list = new ArrayList(); // check that the ArrayList is empty $this->assertTrue($list->isEmpty()); // add a new element $list->add("Test"); // get the element $this->assertEquals("Test", $list->get(0)); // check that the ArrayList is not empty $this->assertFalse($list->isEmpty()); // remove all elements $list->clear(); // check that the ArrayList is empty $this->assertTrue($list->isEmpty()); }
/** * Limpa a lista observador para que este objeto não tem mais observadores. */ public function deleteObservers() { $this->observers->clear(); }