package de.is24.deadcode4j.plugin.stubs;

import org.apache.maven.model.Build;
import org.apache.maven.plugin.testing.stubs.ArtifactStub;
import org.apache.maven.plugin.testing.stubs.MavenProjectStub;

import java.util.Properties;

import static com.google.common.collect.Lists.newArrayList;

public class ProjectStub extends MavenProjectStub {

    public ProjectStub() {
        ArtifactStub artifact = new ArtifactStub();
        artifact.setGroupId("de.is24.junit");
        artifact.setArtifactId("project");
        artifact.setVersion("42");
        setArtifact(artifact);
        setGroupId(artifact.getGroupId());
        setArtifactId(artifact.getArtifactId());
        setVersion(artifact.getVersion());
        setPackaging("jar");

        setCompileSourceRoots(newArrayList("src/test/java/"));
    }

    @Override
    public Properties getProperties() {
        Properties properties = super.getProperties();
        properties.setProperty("project.build.sourceEncoding", "UTF-8");
        return properties;
    }

    @SuppressWarnings("UnusedDeclaration") // configured via POM
    public void setOutputDirectory(String directory) {
        Build build = new Build();
        build.setOutputDirectory(directory);
        setBuild(build);
    }

}

@@ -339,16 +339,82 @@
 Stub %7B%0A%0A
+    private final Properties properties = super.getProperties();%0A%0A
     publ
@@ -871,123 +871,8 @@
 ));%0A
-    %7D%0A%0A    @Override%0A    public Properties getProperties() %7B%0A        Properties properties = super.getProperties();
 %0A   
@@ -937,24 +937,85 @@
 , %22UTF-8%22);%0A
+    %7D%0A%0A    @Override%0A    public Properties getProperties() %7B%0A
         retu

make sure properties can be set