// Path: src/main/java/com/github/vbauer/jconditions/core/CheckerContext.java
// public class CheckerContext<T> {
// 
//     private final Object instance;
//     private final T annotation;
// 
// 
//     public CheckerContext(final Object instance, final T annotation) {
//         this.instance = instance;
//         this.annotation = annotation;
//     }
// 
// 
//     public Object getInstance() {
//         return instance;
//     }
// 
//     public T getAnnotation() {
//         return annotation;
//     }
// 
// }
// 
// Path: src/main/java/com/github/vbauer/jconditions/core/ConditionChecker.java
// public interface ConditionChecker<T> {
// 
//     /**
//      * Checks if execution of test method should be continued or not.
//      *
//      * @param context input data for checker
//      * @return true if execution should be continued and false - otherwise
//      * @throws Exception on any error (it is the same as false in return value)
//      */
//     boolean isSatisfied(CheckerContext<T> context) throws Exception;
// 
// }
// 
// Path: src/main/java/com/github/vbauer/jconditions/util/PropUtils.java
// public final class PropUtils {
// 
//     private static final String VAR_PREFIX = "${";
//     private static final String VAR_POSTFIX = "}";
// 
// 
//     private PropUtils() {
//         throw new UnsupportedOperationException();
//     }
// 
// 
//     public static String getSystemProperty(final String key) {
//         final Map<String, String> properties = getSystemProperties();
//         return properties.get(key);
//     }
// 
//     public static Map<String, String> getSystemProperties() {
//         final Map<String, String> result = new HashMap<>();
//         result.putAll(System.getenv());
//         result.putAll(convertPropertiesToMap(System.getProperties()));
//         return result;
//     }
// 
//     public static Map<String, String> convertPropertiesToMap(final Properties properties) {
//         final Map<String, String> result = new HashMap<>();
//         for (final String name : properties.stringPropertyNames()) {
//             result.put(name, properties.getProperty(name));
//         }
//         return result;
//     }
// 
//     public static String injectProperties(final String text) {
//         if (text != null && text.contains(VAR_PREFIX)) {
//             String result = text;
//             final Map<String, String> systemProperties = getSystemProperties();
//             for (final Map.Entry<String, String> entry : systemProperties.entrySet()) {
//                 final String key = entry.getKey();
//                 final String value = entry.getValue();
//                 result = result.replace(VAR_PREFIX + key + VAR_POSTFIX, value);
//             }
//             return result;
//         }
//         return text;
//     }
// 
//     public static boolean hasAnyWithProperties(final String value, final String... variants) {
//         for (final String operationSystem : variants) {
//             final String injected = injectProperties(operationSystem);
//             if (TextUtils.containsIgnoreCase(value, injected)) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
// }


import com.github.vbauer.jconditions.annotation.IfJavaVersion;
import com.github.vbauer.jconditions.core.CheckerContext;
import com.github.vbauer.jconditions.core.ConditionChecker;
import com.github.vbauer.jconditions.util.PropUtils;
package com.github.vbauer.jconditions.checker;


/**
 * @author Vladislav Bauer
 */

public class IfJavaVersionChecker implements ConditionChecker<IfJavaVersion> {

    private static final String PROPERTY_JAVA_VERSION = "java.version";


    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isSatisfied(final CheckerContext<IfJavaVersion> context) {
        final IfJavaVersion annotation = context.getAnnotation();
        final String[] versions = annotation.value();
        return PropUtils.hasAnyWithProperties(javaVersion(), versions);
    }


    public static String javaVersion() {
// Path: src/main/java/com/github/vbauer/jconditions/core/CheckerContext.java
// public class CheckerContext<T> {
// 
//     private final Object instance;
//     private final T annotation;
// 
// 
//     public CheckerContext(final Object instance, final T annotation) {
//         this.instance = instance;
//         this.annotation = annotation;
//     }
// 
// 
//     public Object getInstance() {
//         return instance;
//     }
// 
//     public T getAnnotation() {
//         return annotation;
//     }
// 
// }
// 
// Path: src/main/java/com/github/vbauer/jconditions/core/ConditionChecker.java
// public interface ConditionChecker<T> {
// 
//     /**
//      * Checks if execution of test method should be continued or not.
//      *
//      * @param context input data for checker
//      * @return true if execution should be continued and false - otherwise
//      * @throws Exception on any error (it is the same as false in return value)
//      */
//     boolean isSatisfied(CheckerContext<T> context) throws Exception;
// 
// }
// 
// Path: src/main/java/com/github/vbauer/jconditions/util/PropUtils.java
// public final class PropUtils {
// 
//     private static final String VAR_PREFIX = "${";
//     private static final String VAR_POSTFIX = "}";
// 
// 
//     private PropUtils() {
//         throw new UnsupportedOperationException();
//     }
// 
// 
//     public static String getSystemProperty(final String key) {
//         final Map<String, String> properties = getSystemProperties();
//         return properties.get(key);
//     }
// 
//     public static Map<String, String> getSystemProperties() {
//         final Map<String, String> result = new HashMap<>();
//         result.putAll(System.getenv());
//         result.putAll(convertPropertiesToMap(System.getProperties()));
//         return result;
//     }
// 
//     public static Map<String, String> convertPropertiesToMap(final Properties properties) {
//         final Map<String, String> result = new HashMap<>();
//         for (final String name : properties.stringPropertyNames()) {
//             result.put(name, properties.getProperty(name));
//         }
//         return result;
//     }
// 
//     public static String injectProperties(final String text) {
//         if (text != null && text.contains(VAR_PREFIX)) {
//             String result = text;
//             final Map<String, String> systemProperties = getSystemProperties();
//             for (final Map.Entry<String, String> entry : systemProperties.entrySet()) {
//                 final String key = entry.getKey();
//                 final String value = entry.getValue();
//                 result = result.replace(VAR_PREFIX + key + VAR_POSTFIX, value);
//             }
//             return result;
//         }
//         return text;
//     }
// 
//     public static boolean hasAnyWithProperties(final String value, final String... variants) {
//         for (final String operationSystem : variants) {
//             final String injected = injectProperties(operationSystem);
//             if (TextUtils.containsIgnoreCase(value, injected)) {
//                 return true;
//             }
//         }
//         return false;
//     }
// 
// }


// Path: src/main/java/com/github/vbauer/jconditions/checker/IfJavaVersionChecker.java
import com.github.vbauer.jconditions.annotation.IfJavaVersion;
import com.github.vbauer.jconditions.core.CheckerContext;
import com.github.vbauer.jconditions.core.ConditionChecker;
import com.github.vbauer.jconditions.util.PropUtils;

package com.github.vbauer.jconditions.checker;


/**
 * @author Vladislav Bauer
 */

public class IfJavaVersionChecker implements ConditionChecker<IfJavaVersion> {

    private static final String PROPERTY_JAVA_VERSION = "java.version";


    /**
     * {@inheritDoc}
     */
    @Override
    public boolean isSatisfied(final CheckerContext<IfJavaVersion> context) {
        final IfJavaVersion annotation = context.getAnnotation();
        final String[] versions = annotation.value();
        return PropUtils.hasAnyWithProperties(javaVersion(), versions);
    }


    public static String javaVersion() {
        return PropUtils.getSystemProperty(PROPERTY_JAVA_VERSION).toLowerCase();