MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_extract_constructor

Function test_extract_constructor

atomic-semantic/src/parsers/java.rs:786–810  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

784
785 #[test]
786 fn test_extract_constructor() {
787 let mut parser = JavaParser::new();
788 let source = r#"
789public class User {
790 public User(String name, int age) {
791 }
792}
793"#;
794 let entities = parser.extract(source, "User.java");
795
796 let constructor = entities
797 .iter()
798 .find(|e| e.name == "User" && e.kind == EntityKind::Method);
799 assert!(constructor.is_some(), "Should find User constructor");
800 assert!(
801 constructor
802 .unwrap()
803 .signature
804 .as_ref()
805 .unwrap()
806 .contains("(String name, int age)"),
807 "Constructor signature: {:?}",
808 constructor.unwrap().signature
809 );
810 }
811
812 #[test]
813 fn test_extract_interface() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected