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

Function test_extract_imports

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

Source from the content-addressed store, hash-verified

899
900 #[test]
901 fn test_extract_imports() {
902 let mut parser = JavaParser::new();
903 let source = r#"
904import java.util.List;
905import java.util.Map;
906import static java.lang.Math.PI;
907
908public class App {}
909"#;
910 let entities = parser.extract(source, "App.java");
911
912 let imports: Vec<_> = entities
913 .iter()
914 .filter(|e| e.kind == EntityKind::Import)
915 .collect();
916 assert!(
917 imports.len() >= 3,
918 "Should find 3 imports, got: {:?}",
919 imports.iter().map(|e| &e.name).collect::<Vec<_>>()
920 );
921
922 assert!(
923 imports.iter().any(|e| e.name.contains("java.util.List")),
924 "Should find java.util.List import"
925 );
926 }
927
928 #[test]
929 fn test_extract_abstract_class() {

Callers

nothing calls this directly

Calls 3

extractMethod · 0.45
collectMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected