Examples of Expectations


Examples of com.volantis.testtools.mock.expectations.Expectations

        //   Set Expectations
        // =====================================================================

        // The different parts of the "b c" selector can be created in any
        // order but that must be before the composite matcher is created.
        final Expectations bcParts = new UnorderedExpectations() {
            public void add() {
                expectTypeSelectorWithDefaultNamespace("b", blocal, bsequence);

                expectTypeSelectorWithDefaultNamespace("c", clocal, csequence);
            }
        };

        final Expectations bcComposite = new OrderedExpectations() {
            public void add() {

                add(bcParts);

                factoryMock.expects.createCompositeMatcher(bsequence, csequence,
                        Operator.DESCENDANT, matcherBuilderContextMock)
                        .returns(b_cMatcher);
            }
        };

        // The different parts of the "a > (b c)" selector can be created in
        // any order but that must be before the composite matcher is created.
        final Expectations a_bcParts = new UnorderedExpectations() {
            public void add() {

                add(bcComposite);

                expectTypeSelectorWithDefaultNamespace("a", alocal, asequence);
            }
        };

        final Expectations a_bcComposite = new OrderedExpectations() {
            public void add() {

                add(a_bcParts);

                factoryMock.expects.createCompositeMatcher(
View Full Code Here

Examples of mockit.Expectations

    @Test
    public void closeIfError(
            @Injectable final  InputStreamReader reader,
            @Injectable final CSVParser parser) throws IOException {
        new Expectations() {
            {
                parser.getLine();
                result = new String[] {"1"};

                parser.getLine();
View Full Code Here

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

Examples of org.jmock.Expectations

    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

Examples of org.jmock.Expectations

        }});
    }

    @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

Examples of org.jmock.Expectations

        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

Examples of org.jmock.Expectations

    }

    @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

Examples of org.jmock.Expectations

    @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

Examples of org.jmock.Expectations

        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

Examples of org.jmock.Expectations

        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
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.