package fi.helsinki.cs.tmc.cli.command;

import fi.helsinki.cs.tmc.cli.Application;
import fi.helsinki.cs.tmc.cli.CliContext;
import fi.helsinki.cs.tmc.cli.io.TestIo;

import org.junit.Before;
import org.junit.Test;

public class DocumentCommandTest {

    private Application app;
    private CliContext ctx;
    private TestIo io;

    @Before
    public void setUp() {
        io = new TestIo();
        ctx = new CliContext(io);
        app = new Application(ctx);
    }

    @Test
    public void run() throws InterruptedException {
        app = new Application(ctx);

        String[] args = {"document", "-s", "0"};
        app.run(args);
        io.assertContains("dev team");
    }
}

@@ -34,16 +34,122 @@
 mmand;%0A%0A
+import static org.mockito.Mockito.when;%0Aimport static org.powermock.api.mockito.PowerMockito.mockStatic;%0A%0A
 import f
@@ -225,16 +225,66 @@
 ontext;%0A
+import fi.helsinki.cs.tmc.cli.io.EnvironmentUtil;%0A
 import f
@@ -365,16 +365,239 @@
 t.Test;%0A
+import org.junit.runner.RunWith;%0Aimport org.powermock.core.classloader.annotations.PrepareForTest;%0Aimport org.powermock.modules.junit4.PowerMockRunner;%0A%0A@RunWith(PowerMockRunner.class)%0A@PrepareForTest(EnvironmentUtil.class)
 %0Apublic 
@@ -840,16 +840,126 @@
 on(ctx);
+%0A%0A        mockStatic(EnvironmentUtil.class);%0A        when(EnvironmentUtil.getTerminalWidth()).thenReturn(100);
 %0A    %7D%0A%0A
@@ -1020,16 +1020,77 @@
 ption %7B%0A
+        when(EnvironmentUtil.isWindows()).thenReturn(false);%0A
         
@@ -1221,16 +1221,334 @@
 ns(%22
-dev team
+Original dev team%22);%0A    %7D%0A%0A    @Test%0A    public void failOnWindows() throws InterruptedException %7B%0A        when(EnvironmentUtil.isWindows()).thenReturn(true);%0A        app = new Application(ctx);%0A%0A        String%5B%5D args = %7B%22document%22, %22-s%22, %220%22%7D;%0A        app.run(args);%0A        io.assertContains(%22Command document doesn't exist
 %22);%0A

Fix document command test in Windows.