jython / tests / python / custom_proxymaker / junit_test.py

from org.junit.Assert import assertEquals
from org.junit import Test
from java.lang import (Object, Void, Long)
from java.lang import Exception as JavaException
import sys
import time

from org.python.compiler.custom_proxymaker import MiniClampMaker

from clamp import ClampMethod

class JUnitTest(Object):
    __proxymaker__ = MiniClampMaker
    __java_package__ = 'custom_proxymaker.tests'

    def testAddition(self):
        assertEquals(4, 1 + 3)
    testAddition._clamp = ClampMethod('testAddition',Void.TYPE,[],[],{Test:None},[{}])

    def testJavaException(self):
        raise JavaException()
    testJavaException._clamp = ClampMethod('testJavaException', Void.TYPE, [], [JavaException], {Test:{'expected':JavaException}}, [{}])

    def testTimeout(self):
    testTimeout._clamp = ClampMethod('testTimeout', Void.TYPE, [], [], {Test:{'timeout':Long(1000)}}, [{}])
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.