/* 
 * This file is part of the PDF Split And Merge source code
 * Created on 14/lug/2014
 * Copyright 2013-2014 by Andrea Vacondio (andrea.vacondio@gmail.com).
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as 
 * published by the Free Software Foundation, either version 3 of the 
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.pdfsam.ui.commons;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

import java.io.File;

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

/**
 * @author Andrea Vacondio
 *
 */
public class SetDestinationRequestTest {

    private static final String PARENT = "/parent/path";
    private File file;

    @Before
    public void setUp() {
        file = mock(File.class);
        when(file.getParent()).thenReturn(PARENT);
    }

    @Test(expected = IllegalArgumentException.class)
    public void nullArg() {
        SetDestinationRequest.requestDestination(null, "module");
    }

    @Test
    public void fallback() {
        assertTrue(SetDestinationRequest.requestFallbackDestination(file, "module").isFallback());
        assertFalse(SetDestinationRequest.requestDestination(file, "module").isFallback());
    }

    @Test
    public void footprint() {
        SetDestinationRequest victim = SetDestinationRequest.requestFallbackDestination(file, "module");
        assertEquals("/parent/path/PDFsam_module.pdf", victim.getFootprint().getAbsolutePath());
    }
}

@@ -991,111 +991,107 @@
 ue;%0A
+%0A
 import 
-static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.io.Fi
+java.io.File;%0Aimport java.io.IOException;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Ru
 le;%0A
-%0A
 impo
@@ -1095,38 +1095,36 @@
 mport org.junit.
-Before
+Test
 ;%0Aimport org.jun
@@ -1126,20 +1126,37 @@
 g.junit.
-Test
+rules.TemporaryFolder
 ;%0A%0A/**%0A 
@@ -1233,209 +1233,185 @@
 t %7B%0A
-%0A    private static final String PARENT = %22/parent/path%22;%0A    private File file;%0A%0A    @Before%0A    public void setUp() %7B%0A        file = mock(File.class);%0A        when(file.getParent()).thenReturn(PARENT
+    @Rule%0A    public TemporaryFolder temp = new TemporaryFolder();%0A%0A    private File file;%0A%0A    @Before%0A    public void setUp() throws IOException %7B%0A        file = temp.newFile(
 );%0A 
@@ -1977,40 +1977,73 @@
 als(
-%22/parent/path/PDFsam_module.pdf%22
+new File(file.getParent(), %22PDFsam_module.pdf%22).getAbsolutePath()
 , vi
@@ -2061,16 +2061,33 @@
 tprint()
+%0A                
 .getAbso

fix #51: fixed failing unit test on Windows systems