Search in sources :

Example 1 with CommonModule

use of com.google.startupos.common.CommonModule in project startup-os by google.

the class InitCommandTest method setup.

@Before
public void setup() {
    // XXX parametrize test
    FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix());
    TestComponent component = DaggerInitCommandTest_TestComponent.builder().commonModule(new CommonModule() {

        @Provides
        @Singleton
        @Override
        public FileSystem provideDefaultFileSystem() {
            return fileSystem;
        }
    }).build();
    initCommand = component.getCommand();
    fileUtils = component.getFileUtils();
}
Also used : FileSystem(java.nio.file.FileSystem) CommonModule(com.google.startupos.common.CommonModule) Before(org.junit.Before)

Example 2 with CommonModule

use of com.google.startupos.common.CommonModule in project startup-os by google.

the class WorkspaceCommandTest method setup.

@Before
public void setup() throws IOException {
    // XXX parametrize test
    FileSystem fileSystem = Jimfs.newFileSystem(Configuration.unix());
    TestComponent component = DaggerWorkspaceCommandTest_TestComponent.builder().commonModule(new CommonModule() {

        @Override
        @Provides
        @Singleton
        public FileSystem provideDefaultFileSystem() {
            return fileSystem;
        }
    }).aaModule(new AaModule() {

        @Override
        @Provides
        @Singleton
        @Named("Base path")
        public String provideBasePath(FileUtils fileUtils) {
            return "/base";
        }
    }).build();
    fileUtils = component.getFileUtils();
    initEmptyWorkspace();
    workspaceCommand = component.getCommand();
    outContent = new ByteArrayOutputStream();
    errContent = new ByteArrayOutputStream();
    System.setOut(new PrintStream(outContent));
    System.setErr(new PrintStream(errContent));
    Flags.resetForTesting();
    WorkspaceCommand.force.resetValueForTesting();
}
Also used : PrintStream(java.io.PrintStream) AaModule(com.google.startupos.tools.reviewer.aa.AaModule) FileUtils(com.google.startupos.common.FileUtils) Singleton(javax.inject.Singleton) FileSystem(java.nio.file.FileSystem) CommonModule(com.google.startupos.common.CommonModule) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Provides(dagger.Provides) Before(org.junit.Before)

Example 3 with CommonModule

use of com.google.startupos.common.CommonModule in project startup-os by google.

the class FileUtilsTest method setup.

@Before
public void setup() {
    fileSystem = Jimfs.newFileSystem(fileSystemConfig);
    CommonComponent commonComponent = DaggerCommonComponent.builder().commonModule(new CommonModule() {

        @Provides
        @Singleton
        @Override
        public FileSystem provideDefaultFileSystem() {
            return fileSystem;
        }
    }).build();
    fileUtils = commonComponent.getFileUtils();
}
Also used : CommonModule(com.google.startupos.common.CommonModule) DaggerCommonComponent(com.google.startupos.common.DaggerCommonComponent) CommonComponent(com.google.startupos.common.CommonComponent) Before(org.junit.Before)

Aggregations

CommonModule (com.google.startupos.common.CommonModule)3 Before (org.junit.Before)3 FileSystem (java.nio.file.FileSystem)2 CommonComponent (com.google.startupos.common.CommonComponent)1 DaggerCommonComponent (com.google.startupos.common.DaggerCommonComponent)1 FileUtils (com.google.startupos.common.FileUtils)1 AaModule (com.google.startupos.tools.reviewer.aa.AaModule)1 Provides (dagger.Provides)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 Singleton (javax.inject.Singleton)1