Package com.carrotsearch.randomizedtesting.validators

Source Code of com.carrotsearch.randomizedtesting.validators.EnsureAssertionsEnabled

package com.carrotsearch.randomizedtesting.validators;

import javax.xml.bind.ValidationException;

import com.carrotsearch.randomizedtesting.ClassValidator;

/**
* Prevent:
* <ol>
*   <li>execution without enabled (global) assertions (<code>-ea</code>).</li>
* </ol>
*/
public class EnsureAssertionsEnabled implements ClassValidator {
  @Override
  public void validate(Class<?> clazz) throws Throwable {
    try {
      assert false;
      throw new ValidationException("Enable assertions globally with -ea (currently disabled or filtered to selected packages).");
    } catch (AssertionError e) {
      // Ok, enabled.
    }
  }
}
TOP

Related Classes of com.carrotsearch.randomizedtesting.validators.EnsureAssertionsEnabled

TOP
Copyright © 2018 www.massapi.com. 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.