Here you can find the source of assertComparison(T actual, T expected)
Parameter | Description |
---|---|
T | the type of comparable objects |
actual | specify a object to be compared |
expected | specify a object to be expected |
public static <T extends Comparable<T>> boolean assertComparison(T actual, T expected)
//package com.java2s; //License from project: Apache License public class Main { /**// w ww .j a v a2 s. c o m * assert the equality of two generic objects using compareTo() operator * * @param <T> the type of comparable objects * * @param actual * specify a object to be compared * * @param expected * specify a object to be expected * * @return true if equal according to compareTo() */ public static <T extends Comparable<T>> boolean assertComparison(T actual, T expected) { boolean ret = false; if ((expected == null) && (actual == null)) { ret = true; } else if (expected != null) { ret = expected.compareTo(actual) == 0; } return ret; } }