Package org.jmock

Examples of org.jmock.Expectations


        final GradleInternal gradle = context.mock(GradleInternal.class);
        final SettingsLocation settingsLocation = new SettingsLocation(settingsDir, settingsScriptSource);

        PropertiesLoadingSettingsProcessor processor = new PropertiesLoadingSettingsProcessor(delegate);

        context.checking(new Expectations() {{
            one(propertiesLoader).loadProperties(settingsDir, startParameter);
            one(delegate).process(gradle, settingsLocation, urlClassLoader, startParameter, propertiesLoader);
            will(returnValue(settings));
        }});
View Full Code Here


    private final Gradle gradle = context.mock(Gradle.class);
    private final DefaultCacheRepository repository = new DefaultCacheRepository(homeDir, CacheUsage.ON, cacheFactory);

    @Before
    public void setup() {
        context.checking(new Expectations() {{
            Project project = context.mock(Project.class);

            allowing(cache).getBaseDir();
            will(returnValue(tmpDir.getDir()));
            allowing(gradle).getRootProject();
View Full Code Here

        }});
    }

    @Test
    public void createsGlobalCache() {
        context.checking(new Expectations() {{
            one(cacheFactory).open(sharedCacheDir.file(version, "a/b/c"), CacheUsage.ON, Collections.EMPTY_MAP);
            will(returnValue(cache));
        }});

        assertThat(repository.cache("a/b/c").open(), sameInstance(cache));
View Full Code Here

        assertThat(repository.cache("a/b/c").open(), sameInstance(cache));
    }

    @Test
    public void createsGlobalCacheWithProperties() {
        context.checking(new Expectations() {{
            one(cacheFactory).open(sharedCacheDir.file(version, "a/b/c"), CacheUsage.ON, properties);
            will(returnValue(cache));
        }});

        assertThat(repository.cache("a/b/c").withProperties(properties).open(), sameInstance(cache));
View Full Code Here

    }

    @Test
    public void createsCacheForAGradleInstance() {

        context.checking(new Expectations() {{
            one(cacheFactory).open(buildRootDir.file(".gradle", version, "a/b/c"), CacheUsage.ON,
                    Collections.EMPTY_MAP);
            will(returnValue(cache));
        }});
View Full Code Here

    @Test
    public void createsCacheForAFile() {
        final TestFile dir = tmpDir.createDir("otherDir");

        context.checking(new Expectations() {{
            one(cacheFactory).open(dir.file(".gradle", version, "a/b/c"), CacheUsage.ON, Collections.EMPTY_MAP);
            will(returnValue(cache));
        }});

        assertThat(repository.cache("a/b/c").forObject(dir).open(), sameInstance(cache));
View Full Code Here

        assertThat(repository.cache("a/b/c").forObject(dir).open(), sameInstance(cache));
    }

    @Test
    public void createsCrossVersionCache() {
        context.checking(new Expectations() {{
            one(cacheFactory).open(sharedCacheDir.file("noVersion", "a/b/c"), CacheUsage.ON, Collections.singletonMap(
                    "gradle.version", version));
            will(returnValue(cache));
        }});
View Full Code Here

        assertThat(repository.cache("a/b/c").invalidateOnVersionChange().open(), sameInstance(cache));
    }

    @Test
    public void createsCrossVersionCacheForAGradleInstance() {
        context.checking(new Expectations() {{
            one(cacheFactory).open(buildRootDir.file(".gradle", "noVersion", "a/b/c"), CacheUsage.ON,
                    Collections.singletonMap("gradle.version", version));
            will(returnValue(cache));
        }});
View Full Code Here

        }
    }

    private IProjectRegistry<ProjectIdentifier> registry(final ProjectIdentifier... projects) {
        final IProjectRegistry<ProjectIdentifier> registry = context.mock(IProjectRegistry.class, String.valueOf(counter++));
        context.checking(new Expectations(){{
            allowing(registry).getAllProjects();
            will(returnValue(toSet(projects)));
        }});
        return registry;
    }
View Full Code Here

        return registry;
    }

    private ProjectIdentifier project(final File projectDir) {
        final ProjectIdentifier projectIdentifier = context.mock(ProjectIdentifier.class, String.valueOf(counter++));
        context.checking(new Expectations(){{
            allowing(projectIdentifier).getProjectDir();
            will(returnValue(projectDir));
        }});
        return projectIdentifier;
    }
View Full Code Here

TOP

Related Classes of org.jmock.Expectations

Copyright © 2018 www.massapicom. 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.