NodeId { public String ehrscape(){ String ehrscapeId = name.replaceAll("/| |-", "_").toLowerCase(); ehrscapeId = ehrscapeId.replaceAll("([_])\\1{1,}", "$1"); return new SnakeCase(ehrscapeId).camelToSnake(); } NodeId(String name); String ehrscape();  }
@Test public void testFormatting(){ assertEquals("uri_resource_identifier", new NodeId("URI - resource identifier").ehrscape()); assertEquals("relationship_role", new NodeId("Relationship/ role").ehrscape()); assertEquals("state_definition", new NodeId("State - definition").ehrscape()); assertEquals("date_time", new NodeId("Date/Time").ehrscape()); assertEquals("heading1", new NodeId("Heading1").ehrscape()); assertEquals("heading_1", new NodeId("Heading 1").ehrscape()); assertEquals("slot_to_contain_other_cluster_archetypes", new NodeId("Slot to contain other Cluster archetypes").ehrscape()); assertEquals("allergies_and_adverse_reactions", new NodeId("Allergies and adverse reactions").ehrscape()); }