def test_add_nested_class_multiple(self): """Tests adding multiple nested classes to this class.""" test_node = class_dependency.JavaClass(self.TEST_PKG, self.TEST_CLS) test_node.add_nested_class(self.UNIQUE_KEY_1) test_node.add_nested_class(self.UNIQUE_KEY_2) self.assertEqual(test_node.nested_classes, {self.UNIQUE_KEY_1, self.UNIQUE_KEY_2})
def test_add_nested_class_duplicate(self): """Tests that adding the same nested class twice will not dupe.""" test_node = class_dependency.JavaClass(self.TEST_PKG, self.TEST_CLS) test_node.add_nested_class(self.UNIQUE_KEY_1) test_node.add_nested_class(self.UNIQUE_KEY_1) self.assertEqual(test_node.nested_classes, {self.UNIQUE_KEY_1})
def test_initialization(self): """Tests that JavaClass is initialized correctly.""" test_node = class_dependency.JavaClass(self.TEST_PKG, self.TEST_CLS) self.assertEqual(test_node.name, f'{self.TEST_PKG}.{self.TEST_CLS}') self.assertEqual(test_node.package, self.TEST_PKG) self.assertEqual(test_node.class_name, self.TEST_CLS)
def test_equality(self): """Tests that two JavaClasses with the same package+class are equal.""" test_node = class_dependency.JavaClass(self.TEST_PKG, self.TEST_CLS) equal_node = class_dependency.JavaClass(self.TEST_PKG, self.TEST_CLS) self.assertEqual(test_node, equal_node)
def test_initialization(self): """Tests that the JavaClass's unique_key was initialized correctly.""" test_node = class_dependency.JavaClass(self.TEST_PKG, self.TEST_CLS) self.assertEqual(test_node.name, f'{self.TEST_PKG}.{self.TEST_CLS}')