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

Function test_extract_enum

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

Source from the content-addressed store, hash-verified

837
838 #[test]
839 fn test_extract_enum() {
840 let mut parser = JavaParser::new();
841 let source = r#"
842public enum Status {
843 ACTIVE,
844 INACTIVE,
845 PENDING;
846
847 public boolean isActive() {
848 return this == ACTIVE;
849 }
850}
851"#;
852 let entities = parser.extract(source, "Status.java");
853
854 let status = entities
855 .iter()
856 .find(|e| e.name == "Status" && e.kind == EntityKind::Enum);
857 assert!(status.is_some(), "Should find Status enum");
858 assert!(status.unwrap().exported);
859
860 // Should find method inside enum
861 let is_active = entities.iter().find(|e| e.name == "isActive");
862 assert!(is_active.is_some(), "Should find isActive method in enum");
863 }
864
865 #[test]
866 fn test_extract_fields() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected