Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: MIT License 

public class Main {
    /**
     * Ensure that the two values given are equal, if not fail the test
     * 
     * @param a1
     *            The first value to compare
     * @param a2
     *            The second value to compare
     */
    public static void assertEquals(float a1, float a2) {
        if (a1 != a2) {
            throw new RuntimeException("TEST FAILS: " + a1 + " should be " + a2);
        }
    }

    /**
     * Ensure that the two values given are equal, if not fail the test
     * 
     * @param a1
     *            The first value to compare
     * @param a2
     *            The second value to compare
     */
    public static void assertEquals(int a1, int a2) {
        if (a1 != a2) {
            throw new RuntimeException("TEST FAILS: " + a1 + " should be " + a2);
        }
    }

    /**
     * Ensure that the two values given are equal, if not fail the test
     * 
     * @param a1
     *            The first value to compare
     * @param a2
     *            The second value to compare
     */
    public static void assertEquals(Object a1, Object a2) {
        if (!a1.equals(a2)) {
            throw new RuntimeException("TEST FAILS: " + a1 + " should be " + a2);
        }
    }
}