def test_values1(self): actual = self.map.values() self.assertEqual(2, len(actual)) expected = [] expected.append(IdName(1, "a")) expected.append(IdName(2, "b")) self.assertEqual(expected, actual) self.map.get("c") actual = self.map.values() self.assertEqual(3, actual.size()) expected = [] expected.append(IdName(1, "a")) expected.append(IdName(2, "b")) expected.append(IdName("c")) self.assertEqual(expected, actual)
def test_add_id_name_coll(self): self.assertEqual(2, self.map.size()) self.assertRaises(IllegalArgumentException, self.map.add, IdName(1, "a")) self.assertEqual(2, self.map.size())
def setUp(self): self.a = IdName(1, "a") self.b = IdName(2, "b") self.map = IdNameMapTest() self.map.add(self.a) self.map.add(self.b)
def test_add_3_c_locked(self): self.assertEqual(2, self.map.size()) self.map.lock() self.assertRaises(IllegalStateException, self.map.add, IdName(3, "c")) self.assertEquals(2, self.map.size())
def makeNew(name): return IdName(name)