Package org.jmock

Examples of org.jmock.Mock.proxy()


  {
    //some very basic sanity test
    //
    DoubleRangeValidator validator = new DoubleRangeValidator();
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);

    Double values[]   = {200d,500d};
    validator.setMinimum(2);
    for (int i = 0; i < values.length ; i++)
View Full Code Here


    int[] minIntDigits   = {4, 1, 2, 1};
    int[] minFractDigits = {0, 2, 0, 2};

    NumberConverter converter   = getNumberConverter();
    Mock mock = mock(UIComponent.class);
    UIComponent component = (UIComponent) mock.proxy();

    setFacesContext(facesContext);
    try
    {
      converter.setLocale(Locale.US);
View Full Code Here

        Mock mock = mock( ClassFileVisitor.class );
        expectVisitClass( mock, "a.b.c", "class a.b.c" );
        expectVisitClass( mock, "x.y.z", "class x.y.z" );

        ClassFileVisitorUtils.accept( file.toURI().toURL(), (ClassFileVisitor) mock.proxy() );

        mock.verify();
    }

    public void testAcceptJarWithNonClassEntry()
View Full Code Here

        writeEntry( out, "a/b/c.jpg", "jpeg a.b.c" );
        out.close();

        Mock mock = mock( ClassFileVisitor.class );

        ClassFileVisitorUtils.accept( file.toURI().toURL(), (ClassFileVisitor) mock.proxy() );

        mock.verify();
    }

    public void testAcceptDir()
View Full Code Here

        Mock mock = mock( ClassFileVisitor.class );
        expectVisitClass( mock, "a.b.c", "class a.b.c" );
        expectVisitClass( mock, "x.y.z", "class x.y.z" );

        ClassFileVisitorUtils.accept( dir.toURI().toURL(), (ClassFileVisitor) mock.proxy() );

        FileUtils.deleteDirectory( dir );

        mock.verify();
    }
View Full Code Here

        File abDir = mkdirs( dir, "a/b" );
        createFile( abDir, "c.jpg", "jpeg a.b.c" );

        Mock mock = mock( ClassFileVisitor.class );

        ClassFileVisitorUtils.accept( dir.toURI().toURL(), (ClassFileVisitor) mock.proxy() );

        FileUtils.deleteDirectory( dir );

        mock.verify();
    }
View Full Code Here

        URL url = file.toURI().toURL();

        try
        {
            ClassFileVisitorUtils.accept( url, (ClassFileVisitor) mock.proxy() );
        }
        catch ( IllegalArgumentException exception )
        {
            assertEquals( "Cannot accept visitor on URL: " + url, exception.getMessage() );
        }
View Full Code Here

        URL url = new URL( "http://localhost/" );

        try
        {
            ClassFileVisitorUtils.accept( url, (ClassFileVisitor) mock.proxy() );
        }
        catch ( IllegalArgumentException exception )
        {
            assertEquals( "Cannot accept visitor on URL: " + url, exception.getMessage() );
        }
View Full Code Here

   * @throws ValidatorException  when test fails
   */
  public void testNull() throws ValidatorException
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    LongRangeValidator validator = new LongRangeValidator();

    doTestNull(facesContext, wrapper, validator);
  }
View Full Code Here

   * Test when context is set to null
   */
  public void testNullContext()
  {
    Mock mock = buildMockUIComponent();
    UIComponent component = (UIComponent) mock.proxy();
    MockUIComponentWrapper wrapper = new MockUIComponentWrapper(mock, component);
    LongRangeValidator validator = new LongRangeValidator();

    doTestNullContext(wrapper, validator);
  }
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.