### Question:
GfmIdGenerationStrategy extends IdGenerationStrategy { @Override public String generateId(String headingText) { String id = headingText.toLowerCase(Locale.getDefault()); id = id.replaceAll("[^a-z0-9_-]", "-"); CharMatcher hyphenMatcher = CharMatcher.is('-'); id = hyphenMatcher.trimFrom(hyphenMatcher.collapseFrom(id, '-')); return id; }  @Override String generateId(String headingText);  }### Answer:
@Test public void withNonAlphaNumeric() { assertEquals("one-two", strategy.generateId("%One & Two!")); }
@Test public void withMultipleConsecutiveSpaces() { assertEquals("with-spaces", strategy.generateId("with spaces")); }
@Test public void withLeadingSpaces() { assertEquals("withleadingspaces", strategy.generateId(" withleadingspaces")); }
@Test public void withUnderscore() { assertEquals("with_underscore", strategy.generateId("with_underscore")); }
@Test public void withHyphen() { assertEquals("with-hyphen", strategy.generateId("with-hyphen")); }
@Test public void alphaNumeric() { assertEquals("alpha01234numeric", strategy.generateId("alpha01234numeric")); }
@Test public void mixedCase() { assertEquals("mixedcase", strategy.generateId("MixedCase")); }
@Test public void allWhitespace() { assertEquals("", strategy.generateId(" \t ")); }