001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014package de.softwareforge.testing.postgres.junit5; 015 016import java.lang.annotation.ElementType; 017import java.lang.annotation.Retention; 018import java.lang.annotation.RetentionPolicy; 019import java.lang.annotation.Target; 020 021import org.junit.jupiter.api.extension.ExtendWith; 022 023/** 024 * {@code RequirePostgresVersion} signals the annotated test class or method that it only should execute if the PostgreSQL server is within a specific range. 025 * If the version is outside the range, the annotated test class or method is skipped. 026 * <p> 027 * PostgreSQL versions are interpreted as described in the <a href="https://www.postgresql.org/support/versioning/">Versioning Policy</a> and structured as 028 * "major.minor.patch". Versions can be abbreviated, e.g. "13" is interpreted as "13.0.0". 029 * <p> 030 * Using "0.0.0" or the empty string will skip the respective boundary check. 031 * <p> 032 * 033 * @since 4.1 034 */ 035@Target({ElementType.TYPE, ElementType.METHOD}) 036@Retention(RetentionPolicy.RUNTIME) 037@ExtendWith({PostgresVersionCondition.class}) 038public @interface RequirePostgresVersion { 039 040 /** 041 * Sets the minimum required version. This check is inclusive; the database must have at least the version specified. 042 * 043 * @return The minimum required version. Default is the empty string (ignore the check). 044 */ 045 String atLeast() default ""; 046 047 /** 048 * Sets the upper boundary version. The check is <b>exclusive</b>, the database version must be less than this version. 049 * 050 * @return The maximum allowed version. Default is the empty string (ignore the check). 051 */ 052 String lessThan() default ""; 053}