@@ -0,0 +1,3431 @@
+/*%0A * The MIT License%0A *%0A * Copyright 2017 Mark Waite.%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included in%0A * all copies or substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN%0A * THE SOFTWARE.%0A */%0Apackage hudson.plugins.git;%0A%0Aimport hudson.model.Run;%0Aimport hudson.scm.RepositoryBrowser;%0Aimport java.util.Iterator;%0Aimport java.util.List;%0Aimport java.util.ArrayList;%0A%0Aimport org.junit.Test;%0Aimport static org.hamcrest.Matchers.*;%0Aimport static org.junit.Assert.*;%0Aimport org.junit.Before;%0A%0Apublic class GitChangeSetListTest %7B%0A%0A    private final GitChangeSetList emptyChangeSetList;%0A    private GitChangeSetList changeSetList;%0A    private GitChangeSet changeSet;%0A%0A    public GitChangeSetListTest() %7B%0A        RepositoryBrowser%3C?%3E browser = null;%0A        Run build = null;%0A        emptyChangeSetList = new GitChangeSetList(build, browser, new ArrayList%3CGitChangeSet%3E());%0A    %7D%0A%0A    @Before%0A    public void createGitChangeSetList() %7B%0A        RepositoryBrowser%3C?%3E browser = null;%0A        Run build = null;%0A        List%3CGitChangeSet%3E logs = new ArrayList%3C%3E();%0A        List%3CString%3E changeSetText = new ArrayList%3C%3E();%0A        changeSet = new GitChangeSet(changeSetText, true);%0A        assertTrue(logs.add(changeSet));%0A        assertThat(changeSet.getParent(), is(nullValue()));%0A        changeSetList = new GitChangeSetList(build, browser, logs);%0A        // assertThat(changeSet.getParent(), is(changeSetList));%0A    %7D%0A%0A    @Test%0A    public void testIsEmptySet() %7B%0A        assertFalse(changeSetList.isEmptySet());%0A    %7D%0A%0A    @Test%0A    public void testIsEmptySetReallyEmpty() %7B%0A        assertTrue(emptyChangeSetList.isEmptySet());%0A    %7D%0A%0A    @Test%0A    public void testIterator() %7B%0A        Iterator%3CGitChangeSet%3E iterator = changeSetList.iterator();%0A        GitChangeSet firstChangeSet = iterator.next();%0A        assertThat(firstChangeSet, is(changeSet));%0A        assertFalse(iterator.hasNext());%0A    %7D%0A%0A    @Test%0A    public void testIteratorReallyE() %7B%0A        Iterator%3CGitChangeSet%3E iterator = emptyChangeSetList.iterator();%0A        assertFalse(iterator.hasNext());%0A    %7D%0A%0A    @Test%0A    public void testGetLogs() %7B%0A        List%3CGitChangeSet%3E result = changeSetList.getLogs();%0A        assertThat(result, contains(changeSet));%0A    %7D%0A%0A    @Test%0A    public void testGetLogsReallyEmpty() %7B%0A        List%3CGitChangeSet%3E result = emptyChangeSetList.getLogs();%0A        assertThat(result, is(empty()));%0A    %7D%0A%0A    @Test%0A    public void testGetKind() %7B%0A        assertThat(changeSetList.getKind(), is(%22git%22));%0A    %7D%0A%7D%0A

Add unit tests for GitChangeSetList