import java.util.Locale;

public class Chapter15Testing {
    static String normalize(String input) {
        if (input == null) {
            return "";
        }
        return input.strip().toLowerCase(Locale.ROOT);
    }

    static void verify(String description, Object expected, Object actual) {
        if (!expected.equals(actual)) {
            throw new AssertionError(
                    description + " | expected=" + expected + ", actual=" + actual);
        }
    }

    public static void main(String[] args) {
        verify("removes spaces", "help", normalize("  help "));
        verify("ignores uppercase", "tip", normalize("TIP"));
        verify("handles null", "", normalize(null));
        System.out.println("3 tests passed.");
    }
}
