@Test
public void normalizeFormNameTest() {

    assertNull(normalizeFormName(null, false));
    assertEquals("Lorem", normalizeFormName("Lorem", false));
    assertEquals("Lorem ipsum", normalizeFormName("Lorem ipsum", false));
    assertEquals("Lorem ipsum", normalizeFormName("Lorem\nipsum", false));
    assertEquals("Lorem  ipsum", normalizeFormName("Lorem\n\nipsum", false));
    assertEquals(" Lorem ipsum ", normalizeFormName("\nLorem\nipsum\n", false));
    assertNull(normalizeFormName(null, true));
    assertNull(normalizeFormName("Lorem", true));
    assertNull(normalizeFormName("Lorem ipsum", true));
    assertEquals("Lorem ipsum", normalizeFormName("Lorem\nipsum", true));
    assertEquals("Lorem  ipsum", normalizeFormName("Lorem\n\nipsum", true));
    assertEquals(" Lorem ipsum ", normalizeFormName("\nLorem\nipsum\n", true));
}