Package net.raymanoz.migrate

Source Code of net.raymanoz.migrate.ScriptAssemblerImplTest

package net.raymanoz.migrate;

import static org.junit.Assert.assertNotNull;
import net.raymanoz.io.File;
import net.raymanoz.ui.UserInteractionStrategy;
import net.raymanoz.util.Properties;
import net.raymanoz.util.ScriptExecuterCommandLineParser;
import net.raymanoz.util.ScriptExecuterCommandLineParserImpl;

import static org.mockito.Mockito.*;

import org.junit.Test;
import static org.junit.Assert.*;

import net.raymanoz.config.Configuration;

public class ScriptAssemblerImplTest {
 
  private final Configuration config = mock(Configuration.class);
  private final Properties properties = mock(Properties.class);
  private final UserInteractionStrategy userInteractionStrategy = mock(UserInteractionStrategy.class);

  private ScriptAssemblerImpl uut = new ScriptAssemblerImpl(config);
 
  @Test
  public void shouldBeAbleToCreateAProcessBuilder() {
    assertNotNull("Assembler should return a process builder", uut.newProcessBuilder());
  }
 
  @Test
  public void shouldBeAbleToCreateAnInputStreamPrinter() {
    assertNotNull("Assembler should return an InputStreamPrinter", uut.newInputStreamPrinter(null, null, userInteractionStrategy));
  }
 
  @Test
  public void shouldBeAbleToGetConfigFromAssembler() {
    assertEquals("Assembler should return a Configurtaion", config, uut.getConfiguration());
  }
 
  @Test
  public void shouldBeAbleToGetFileUtilFromAssembler() {
    assertNotNull("Assembler should return a FileUtil", uut.getFileUtil());
  }
 
  @Test
  public void shouldBeAbleToCreateNewFile() {
    assertNotNull("Assembler should create a new file", uut.newFile(mock(File.class), "file.sql"));
  }
 
  @Test
  public void shouldBeAbleToGetResourceBundle() {
    when(config.uMigrateProperties()).thenReturn(properties);
    assertEquals("Assembler should return the resource bundle", properties, uut.getProperties());
 
 
  @Test
  public void shouldBeAbleToCreateNewScriptExecuterCommandLineParser() {
    when(config.getExecutionCommand()).thenReturn("${script}");
    ScriptExecuterCommandLineParser parser = uut.getScriptExecuterCommandLineParser();
    assertNotNull(parser);
    assertEquals(ScriptExecuterCommandLineParserImpl.class, parser.getClass());
    verify(config).getExecutionCommand();
  }
}
TOP

Related Classes of net.raymanoz.migrate.ScriptAssemblerImplTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.