Package org.hibernate.validator.constraints

Examples of org.hibernate.validator.constraints.URL


    regexpURLValidator = new RegexpURLValidator();
  }

  @Test
  public void valid_urls_pass_validation() {
    URL url = AnnotationFactory.create( descriptor );
    urlValidator.initialize( url );
    assertValidUrls( urlValidator );

    regexpURLValidator.initialize( url );
    assertValidUrls( regexpURLValidator );
View Full Code Here


  }

  @Test
  @TestForIssue(jiraKey = "HV-502")
  public void url_validators_can_handle_character_sequences() {
    URL url = AnnotationFactory.create( descriptor );

    urlValidator.initialize( url );
    assertValidCharSequenceUrls( urlValidator );

    regexpURLValidator.initialize( url );
View Full Code Here

  }

  @Test
  public void http_protocol_can_be_verified_explicitly() {
    descriptor.setValue( "protocol", "http" );
    URL url = AnnotationFactory.create( descriptor );

    urlValidator.initialize( url );
    assertHttpProtocolMatch( urlValidator );

    regexpURLValidator.initialize( url );
View Full Code Here

  }

  @Test
  public void file_protocol_can_be_verified_explicitly() {
    descriptor.setValue( "protocol", "file" );
    URL url = AnnotationFactory.create( descriptor );

    urlValidator.initialize( url );
    assertFileProtocolMatch( urlValidator );

    regexpURLValidator.initialize( url );
View Full Code Here

  }

  @Test
  public void port_can_be_verified_explicitly() {
    descriptor.setValue( "port", 21 );
    URL url = AnnotationFactory.create( descriptor );

    urlValidator.initialize( url );
    assertPortMatch( urlValidator );

    regexpURLValidator.initialize( url );
View Full Code Here

  }

  @Test
  public void host_can_be_verified_explicitly() {
    descriptor.setValue( "host", "foobar.com" );
    URL url = AnnotationFactory.create( descriptor );

    urlValidator.initialize( url );
    assertHostMatch( urlValidator );

    regexpURLValidator.initialize( url );
View Full Code Here

  @Test
  public void protocol_host_and_port_can_be_verified_explicitly() {
    descriptor.setValue( "protocol", "http" );
    descriptor.setValue( "host", "www.hibernate.org" );
    descriptor.setValue( "port", 80 );
    URL url = AnnotationFactory.create( descriptor );

    URLValidator validator = new URLValidator();
    validator.initialize( url );

    urlValidator.initialize( url );
View Full Code Here

  }

  @Test
  @TestForIssue(jiraKey = "HV-323")
  public void the_empty_string_is_considered_a_valid_url() {
    URL url = AnnotationFactory.create( descriptor );
    urlValidator.initialize( url );
    assertTrue( urlValidator.isValid( "", null ) );

    regexpURLValidator.initialize( url );
    assertTrue( regexpURLValidator.isValid( "", null ) );
View Full Code Here

TOP

Related Classes of org.hibernate.validator.constraints.URL

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.