CukedoctorDocumentBuilderImpl extends AsciiDocBuilder implements CukedoctorDocumentBuilder { public CukedoctorDocumentBuilder unNestTitle() { if (currentTitleNestingLevel == initialTitleNestingLevel) throw new NestingUnderflowException(initialTitleNestingLevel); currentTitleNestingLevel -= 1; return this; } CukedoctorDocumentBuilderImpl(); private  CukedoctorDocumentBuilderImpl(int initialTitleNestingLevel); @Override AttributesBuilder attributes(); @Override CukedoctorDocumentBuilder sideBarBlock(String text); @Override CukedoctorDocumentBuilder append(Object... text); @Override CukedoctorDocumentBuilder textLine(String text); @Override CukedoctorDocumentBuilder sectionTitleLevel5(String title); @Override CukedoctorDocumentBuilder title(String title); @Override CukedoctorDocumentBuilder nestTitle(); CukedoctorDocumentBuilder unNestTitle(); @Override CukedoctorDocumentBuilder titleThenNest(String title); void clear(); @Override CukedoctorDocumentBuilder createNestedBuilder(); @Override CukedoctorDocumentBuilder createPeerBuilder();  }
@Test(expected = CukedoctorDocumentBuilderImpl.NestingUnderflowException.class) public void shouldThrowIfUnNestingBeyondInitialLevel() { builder = createInstanceWithNestingLevel2(); builder.unNestTitle(); }