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

Function test_extract_enum

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

Source from the content-addressed store, hash-verified

814
815 #[test]
816 fn test_extract_enum() {
817 let mut parser = JavaParser::new();
818 let source = r#"
819public enum Status {
820 ACTIVE,
821 INACTIVE,
822 PENDING;
823
824 public boolean isActive() {
825 return this == ACTIVE;
826 }
827}
828"#;
829 let entities = parser.extract(source, "Status.java");
830
831 let status = entities
832 .iter()
833 .find(|e| e.name == "Status" && e.kind == EntityKind::Enum);
834 assert!(status.is_some(), "Should find Status enum");
835 assert!(status.unwrap().exported);
836
837 // Should find method inside enum
838 let is_active = entities.iter().find(|e| e.name == "isActive");
839 assert!(is_active.is_some(), "Should find isActive method in enum");
840 }
841
842 #[test]
843 fn test_extract_fields() {

Callers

nothing calls this directly

Calls 2

extractMethod · 0.45
iterMethod · 0.45

Tested by

no test coverage detected