package org.schoellerfamily.gedbrowser.renderer.test;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;
import org.schoellerfamily.gedbrowser.datamodel.GedObject;
import org.schoellerfamily.gedbrowser.renderer.DefaultRenderer;
import org.schoellerfamily.gedbrowser.renderer.GedRenderer;
import org.schoellerfamily.gedbrowser.renderer.GedRendererFactory;
import org.schoellerfamily.gedbrowser.renderer.NullSectionRenderer;
import org.schoellerfamily.gedbrowser.renderer.RenderingContext;

 /**
  * @author Dick Schoeller
  */
public class NullSectionRendererTest {
    /** */
    private transient NullSectionRenderer nsr;

    /** */
    @Before
    public final void init() {
        final DefaultRenderer renderer =
                new DefaultRenderer(new GedObject(null) { },
                        new GedRendererFactory(),
                        RenderingContext.anonymous());
        nsr = (NullSectionRenderer) renderer
                .getSectionRenderer();
    }

    /** */
    @Test
    public final void testNullSectionRendererNullFalse01() {
        final StringBuilder builder = new StringBuilder();
        nsr.renderAsSection(builder, null, false, 0, 1);
        final String string = builder.toString();
        assertEquals("", string);
    }

    /** */
    @Test
    public final void testNullSectionRendererNullTrue01() {
        final StringBuilder builder = new StringBuilder();
        nsr.renderAsSection(builder, null, true, 0, 1);
        final String string = builder.toString();
        assertEquals("", string);
    }

    /** */
    @Test
    public final void testNullSectionRendererOuterFalse21() {
        final StringBuilder builder = new StringBuilder();
        nsr.renderAsSection(builder, new GedRenderer<GedObject>(null,
                new GedRendererFactory(),
                RenderingContext.anonymous()) {
        }, false, 2, 1);
        final String string = builder.toString();
        assertEquals("", string);
    }

    /** */
    @Test
    public final void testNullSectionRendererOuterTrue02() {
        final StringBuilder builder = new StringBuilder();
        nsr.renderAsSection(builder, new GedRenderer<GedObject>(null,
                new GedRendererFactory(),
                RenderingContext.anonymous()) {
        }, true, 0, 2);
        final String string = builder.toString();
        assertEquals("", string);
    }
}

@@ -1095,38 +1095,32 @@
 e01() %7B%0A        
-final 
 StringBuilder bu
@@ -1147,32 +1147,42 @@
 ilder();%0A       
+ builder =
  nsr.renderAsSec
@@ -1278,32 +1278,58 @@
    assertEquals(
+%22Expected a null string%22, 
 %22%22, string);%0A   
@@ -1413,38 +1413,32 @@
 e01() %7B%0A        
-final 
 StringBuilder bu
@@ -1465,32 +1465,42 @@
 ilder();%0A       
+ builder =
  nsr.renderAsSec
@@ -1595,32 +1595,58 @@
    assertEquals(
+%22Expected a null string%22, 
 %22%22, string);%0A   
@@ -1732,38 +1732,32 @@
 e21() %7B%0A        
-final 
 StringBuilder bu
@@ -1784,32 +1784,42 @@
 ilder();%0A       
+ builder =
  nsr.renderAsSec
@@ -2043,32 +2043,58 @@
    assertEquals(
+%22Expected a null string%22, 
 %22%22, string);%0A   
@@ -2183,30 +2183,24 @@
 ) %7B%0A        
-final 
 StringBuilde
@@ -2235,24 +2235,34 @@
 r();%0A       
+ builder =
  nsr.renderA
@@ -2497,16 +2497,42 @@
 tEquals(
+%22Expected a null string%22, 
 %22%22, stri

fix findbugs warnings