alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (Groovy3720Bug.groovy)

This example Groovy source code file (Groovy3720Bug.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

anothernode3720, basenode3720, basenode3720, groovy3720bug, groovytestcase, mockfor, mockfor, mynode3720, mynode3720, stubfor, stubfor

The Groovy Groovy3720Bug.groovy source code

package groovy.bugs

import groovy.mock.interceptor.*

class Groovy3720Bug extends GroovyTestCase {
    void testCreateStubNode() {
        def stubNodeContext1 = new StubFor(AnotherNode3720) 
        assertNotNull stubNodeContext1.proxyInstance()

        def stubNodeContext2 = new StubFor(MyNode3720) 
        assertNotNull stubNodeContext2.proxyInstance()
    }

    void testCreateStubNodeDelegate() {
        def stubNodeContext1 = new StubFor(AnotherNode3720) 
        assertNotNull stubNodeContext1.proxyDelegateInstance()

        def stubNodeContext2 = new StubFor(MyNode3720) 
        assertNotNull stubNodeContext2.proxyDelegateInstance()
    }
    
    void testCreateMockNode() {
        def mockNodeContext1 = new MockFor(AnotherNode3720) 
        assertNotNull mockNodeContext1.proxyInstance()

        def mockNodeContext2 = new MockFor(MyNode3720) 
        assertNotNull mockNodeContext2.proxyInstance()
    }

    void testCreateMockNodeDelegate() {
        def mockNodeContext1 = new MockFor(AnotherNode3720) 
        assertNotNull mockNodeContext1.proxyDelegateInstance()

        def mockNodeContext2 = new MockFor(MyNode3720) 
        assertNotNull mockNodeContext2.proxyDelegateInstance()
    }
}

abstract class MyNode3720 {}

abstract class BaseNode3720 {
    abstract m1()
}

abstract class AnotherNode3720 extends BaseNode3720 {
    abstract m2()
}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy Groovy3720Bug.groovy source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.