BrokenEvent nanotests

com.brokenevent.nanotests
Class UrlAssert

java.lang.Object
  extended by com.brokenevent.nanotests.UrlAssert

public class UrlAssert
extends java.lang.Object

Helper class for URL-related asserts. These methods can be used directly: UrlAssert.assertUrlProtocol(...), however, they read better if they are referenced through static import:

 import static com.brokenevent.nanotests.UrlAssert.*;
    ...
    assertUrlProtocol(...);
 

Author:
BrokenEvent

Constructor Summary
protected UrlAssert()
          Protect constructor since it is a static only class
 
Method Summary
static void assertUrlDomain(java.lang.String expected, java.lang.String url)
          Asserts that the given URL's domain part is equal to the expected value.
static void assertUrlDomain(java.lang.String message, java.lang.String expected, java.lang.String url)
          Asserts that the given URL's domain part is equal to the expected value.
static void assertUrlHaveParam(java.lang.String url, java.lang.String paramName)
          Asserts that the given URL have param with the given name.
static void assertUrlHaveParam(java.lang.String message, java.lang.String url, java.lang.String paramName)
          Asserts that the given URL have param with the given name.
static void assertUrlParam(java.lang.String expectedValue, java.lang.String url, java.lang.String paramName)
          Asserts that the given URL contains given param and it equals the given value.
static void assertUrlParam(java.lang.String message, java.lang.String expectedValue, java.lang.String url, java.lang.String paramName)
          Asserts that the given URL contains given param and it equals the given value.
static void assertUrlProtocol(java.lang.String expected, java.lang.String url)
          Asserts that the given URL's protocol is equal to the expected value.
static void assertUrlProtocol(java.lang.String message, java.lang.String expected, java.lang.String url)
          Asserts that the given URL's protocol is equal to the expected value.
static void assertUrlResource(java.lang.String expected, java.lang.String url)
          Asserts that the given URL's resource part is equal to the expected value.
static void assertUrlResource(java.lang.String message, java.lang.String expected, java.lang.String url)
          Asserts that the given URL's resource part is equal to the expected value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlAssert

protected UrlAssert()
Protect constructor since it is a static only class

Method Detail

assertUrlProtocol

public static void assertUrlProtocol(java.lang.String expected,
                                     java.lang.String url)
Asserts that the given URL's protocol is equal to the expected value. If it isn't, an AssertionError is thrown.
URL example: http://test.com/testpage

Parameters:
expected - expected protocol value
url - url to check

assertUrlProtocol

public static void assertUrlProtocol(java.lang.String message,
                                     java.lang.String expected,
                                     java.lang.String url)
Asserts that the given URL's protocol is equal to the expected value. If it isn't, an AssertionError is thrown with the given message.
URL example: http://test.com/testpage

Parameters:
message - the identifying message for the AssertionError (null okay)
expected - expected protocol value
url - url to check

assertUrlDomain

public static void assertUrlDomain(java.lang.String expected,
                                   java.lang.String url)
Asserts that the given URL's domain part is equal to the expected value. If it isn't, an AssertionError is thrown.
URL example: http://test.com/testpage

Parameters:
expected - expected domain value
url - url to check

assertUrlDomain

public static void assertUrlDomain(java.lang.String message,
                                   java.lang.String expected,
                                   java.lang.String url)
Asserts that the given URL's domain part is equal to the expected value. If it isn't, an AssertionError is thrown with the given message.
URL example: http://test.com/testpage

Parameters:
message - the identifying message for the AssertionError (null okay)
expected - expected domain value
url - url to check

assertUrlResource

public static void assertUrlResource(java.lang.String expected,
                                     java.lang.String url)
Asserts that the given URL's resource part is equal to the expected value. If it isn't, an AssertionError is thrown.
URL example: http://test.com/testpage

Parameters:
expected - expected resource value
url - url to check

assertUrlResource

public static void assertUrlResource(java.lang.String message,
                                     java.lang.String expected,
                                     java.lang.String url)
Asserts that the given URL's resource part is equal to the expected value. If it isn't, an AssertionError is thrown with the given message.
URL example: http://test.com/testpage

Parameters:
message - the identifying message for the AssertionError (null okay)
expected - expected resource value
url - url to check

assertUrlParam

public static void assertUrlParam(java.lang.String expectedValue,
                                  java.lang.String url,
                                  java.lang.String paramName)
Asserts that the given URL contains given param and it equals the given value. If it isn't, an AssertionError is thrown.

Parameters:
expectedValue - expected param's value
url - url to check
paramName - param name to check its value

assertUrlParam

public static void assertUrlParam(java.lang.String message,
                                  java.lang.String expectedValue,
                                  java.lang.String url,
                                  java.lang.String paramName)
Asserts that the given URL contains given param and it equals the given value. If it isn't, an AssertionError is thrown with the given message.

Parameters:
message - the identifying message for the AssertionError (null okay)
expectedValue - expected param's value
url - url to check
paramName - param name to check its value

assertUrlHaveParam

public static void assertUrlHaveParam(java.lang.String url,
                                      java.lang.String paramName)
Asserts that the given URL have param with the given name. If it isn't, an AssertionError is thrown.

Parameters:
url - url to check
paramName - param name to check its existance

assertUrlHaveParam

public static void assertUrlHaveParam(java.lang.String message,
                                      java.lang.String url,
                                      java.lang.String paramName)
Asserts that the given URL have param with the given name. If it isn't, an AssertionError is thrown with the given message.

Parameters:
message - the identifying message for the AssertionError (null okay)
url - url to check
paramName - param name to check its existance

BrokenEvent nanotests