package hudson.plugins.emailext.plugins.content;

import hudson.model.AbstractBuild;
import hudson.model.User;
import hudson.scm.ChangeLogSet;
import hudson.scm.EditType;

import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

/**
 * Created by acearl on 12/3/2014.
 */
public class ScriptContentChangeLogSet extends ChangeLogSet<ChangeLogSet.Entry> {

    public ScriptContentChangeLogSet(AbstractBuild build) {
        super(build, null);
    }

    @Override
    public boolean isEmptySet() {
        return false;
    }

    public Iterator iterator() {
        return Arrays.asList(new Entry() {
            @Override
            public String getMsg() {
                return "COMMIT MESSAGE";
            }

            @Override
            public User getAuthor() {
                User user = mock(User.class);
                when(user.getDisplayName()).thenReturn("Kohsuke Kawaguchi");
                when(user.getFullName()).thenReturn("Kohsuke Kawaguchi");
                return user;
            }

            @Override
            public Collection<String> getAffectedPaths() {
                return Arrays.asList("path1", "path2");
            }

            @Override
            public String getMsgAnnotated() {
                return getMsg();
            }

            @Override
            public Collection<? extends AffectedFile> getAffectedFiles() {
                return Arrays.asList(
                        new AffectedFile() {
                            public String getPath() {
                                return "path1";
                            }

                            public EditType getEditType() {
                                return EditType.EDIT;
                            }
                        },
                        new AffectedFile() {
                            public String getPath() {
                                return "path2";
                            }

                            public EditType getEditType() {
                                return EditType.ADD;
                            }
                        });
            }
        }).iterator();
    }
}

@@ -228,16 +228,47 @@
 ction;%0D%0A
+import java.util.Collections;%0D%0A
 import j
@@ -730,33 +730,45 @@
      return 
-Arrays.as
+Collections.singleton
 List(new Ent

Replace Arrays.asList with Collections.singletonList where possible