package net.raymanoz.migrate;
import static org.junit.Assert.assertNotNull;
import net.raymanoz.config.Configuration;
import net.raymanoz.io.File;
import net.raymanoz.util.DirType;
import org.junit.Test;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class ScriptCreatorAssemblerImplTest {
private final Configuration config = mock(Configuration.class);
private ScriptCreatorAssemblerImpl assembler= new ScriptCreatorAssemblerImpl(config);
private File mockFile(String name, DirType dirType, Long dbVersion){
File result = mock(File.class);
when(result.getName()).thenReturn(name);
when(result.getDBVersion()).thenReturn(dbVersion);
return result;
}
@Test
public void testNewScriptList() {
String fileName = "1.sql";
File mockFile = mockFile(fileName, DirType.SCRIPT, 1L);
assertNotNull("Assembler should return a script list", assembler.newScriptList(new File[]{mockFile}, 1, 1));
}
@Test
public void testNewFile() {
String fileName = ".";
File mockFile = mockFile(fileName, DirType.SCRIPT, 1L);
assertNotNull("Assembler should return a not null File", assembler.newFile(mockFile, "asdf"));
}
@Test
public void testNewFileUtil() {
assertNotNull("Assember should return a FileUtil", assembler.newFileUtil());
}
}