package ca.antonious.viewcelladapter.decoratortests;

import org.junit.Test;

import ca.antonious.viewcelladapter.TestViewCell;
import ca.antonious.viewcelladapter.decorators.HeaderSectionDecorator;
import ca.antonious.viewcelladapter.sections.AbstractSection;
import ca.antonious.viewcelladapter.sections.Section;
import ca.antonious.viewcelladapter.viewcells.AbstractViewCell;

import static org.junit.Assert.*;

/**
 * Created by George on 2016-12-18.
 */

public class HeaderSectionDecoratorTests {

    @Test
    public void test_getZero_returnsHeader() {
        AbstractSection section = new Section();
        AbstractViewCell headerViewCell = new TestViewCell("HEADER");
        HeaderSectionDecorator headerSectionDecorator = new HeaderSectionDecorator(section, headerViewCell);

        AbstractViewCell expectedViewCell = headerViewCell;
        AbstractViewCell actualViewCell = headerSectionDecorator.get(0);

        assertEquals(expectedViewCell, actualViewCell);
    }

    @Test
    public void test_getItemCount_ifDecoratedSectionIsEmptyAndShouldShowHeaderIfEmpty_thenReturnsOne() {
        AbstractSection section = new Section();
        AbstractViewCell headerViewCell = new TestViewCell("HEADER");
        HeaderSectionDecorator headerSectionDecorator = new HeaderSectionDecorator(section, headerViewCell);

        int expectedItemCount = 1;
        int actualItemCount = headerSectionDecorator.getItemCount();

        assertEquals(expectedItemCount, actualItemCount);
    }

    @Test
    public void test_getItemCount_ifDecoratedSectionIsEmptyAndShouldNotShowHeaderIfEmpty_thenReturnsZero() {
        AbstractSection section = new Section();
        AbstractViewCell headerViewCell = new TestViewCell("HEADER");
        HeaderSectionDecorator headerSectionDecorator = new HeaderSectionDecorator(section, headerViewCell);
        headerSectionDecorator.setShowHeaderIfEmpty(false);

        int expectedItemCount = 0;
        int actualItemCount = headerSectionDecorator.getItemCount();

        assertEquals(expectedItemCount, actualItemCount);
    }

}

@@ -972,32 +972,655 @@
 ewCell);%0A    %7D%0A%0A
+    @Test%0A    public void test_getOne_ifDecoratedSectionIsNotEmpty_thenReturnsFirstItemInSection() %7B%0A        AbstractViewCell headerViewCell = new TestViewCell(%22HEADER%22);%0A        AbstractViewCell sectionItem1 = new TestViewCell(%22ITEM1%22);%0A%0A        Section section = new Section();%0A        section.add(sectionItem1);%0A%0A        HeaderSectionDecorator headerSectionDecorator = new HeaderSectionDecorator(section, headerViewCell);%0A%0A        AbstractViewCell expectedViewCell = headerViewCell;%0A        AbstractViewCell actualViewCell = headerSectionDecorator.get(1);%0A%0A        assertEquals(expectedViewCell, actualViewCell);%0A    %7D%0A%0A
     @Test%0A    pu

Add test for getting the first item in a section wrapped by a header