From 4d327b2a7a9f41ce42d55ec71299c31c47425add Mon Sep 17 00:00:00 2001 From: Ivan Vakhrushev Date: Mon, 11 Nov 2024 23:09:09 +0400 Subject: [PATCH] Add SkipIndexesByNamePredicate --- .../AbstractSkipTablesPredicate.java | 44 +++++-- .../SkipBySequenceNamePredicate.java | 14 +-- .../SkipDbObjectsByNamePredicate.java | 3 +- .../SkipIndexesByNamePredicate.java | 111 +++++++++++++++++ .../predicates/SkipTablesByNamePredicate.java | 4 +- .../AbstractSkipTablesPredicateTest.java | 2 +- .../SkipBySequenceNamePredicateTest.java | 4 +- .../SkipIndexesByNamePredicateTest.java | 117 ++++++++++++++++++ .../SkipTablesByNamePredicateTest.java | 4 +- .../FilterIndexesByNamePredicate.java | 2 + 10 files changed, 278 insertions(+), 27 deletions(-) create mode 100644 pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicate.java create mode 100644 pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicateTest.java diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicate.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicate.java index 147c297f..fe45b5b8 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicate.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicate.java @@ -13,6 +13,7 @@ import io.github.mfvanek.pg.model.DbObject; import io.github.mfvanek.pg.model.PgContext; import io.github.mfvanek.pg.model.table.TableNameAware; +import io.github.mfvanek.pg.model.validation.Validators; import java.util.Collection; import java.util.Locale; @@ -59,12 +60,7 @@ abstract class AbstractSkipTablesPredicate implements Predicate { * @throws NullPointerException if {@code pgContext} or {@code rawTableNamesToSkip} is null */ AbstractSkipTablesPredicate(@Nonnull final PgContext pgContext, @Nonnull final Collection rawTableNamesToSkip) { - Objects.requireNonNull(pgContext, "pgContext cannot be null"); - this.fullyQualifiedTableNamesToSkip = Objects.requireNonNull(rawTableNamesToSkip, "rawTableNamesToSkip cannot be null") - .stream() - .map(pgContext::enrichWithSchema) - .map(s -> s.toLowerCase(Locale.ROOT)) - .collect(Collectors.toUnmodifiableSet()); + this.fullyQualifiedTableNamesToSkip = prepareFullyQualifiedNamesToSkip(pgContext, rawTableNamesToSkip); } /** @@ -75,7 +71,7 @@ abstract class AbstractSkipTablesPredicate implements Predicate { * Otherwise, returns {@code true}. *

* - * @param dbObject the object to be tested + * @param dbObject the database object to test; must be non-null * @return {@code false} if the {@code DbObject} matches a table name in the skip set, {@code true} otherwise */ @Override @@ -86,4 +82,38 @@ public boolean test(@Nonnull final DbObject dbObject) { } return true; } + + /** + * Prepares a set of fully qualified names to skip by enriching each raw name with schema information from the provided + * PostgreSQL context and converting it to lowercase for case-insensitive matching. + * + * @param pgContext the PostgreSQL context used to enrich each raw name with schema information; must be non-null + * @param rawNamesToSkip the collection of raw names to skip; must be non-null + * @return an unmodifiable {@link Set} of fully qualified names to skip, in lowercase + * @throws NullPointerException if {@code pgContext} or {@code rawNamesToSkip} is null + */ + @Nonnull + static Set prepareFullyQualifiedNamesToSkip(@Nonnull final PgContext pgContext, + @Nonnull final Collection rawNamesToSkip) { + Objects.requireNonNull(pgContext, "pgContext cannot be null"); + return Objects.requireNonNull(rawNamesToSkip, "rawNamesToSkip cannot be null") + .stream() + .map(pgContext::enrichWithSchema) + .map(s -> s.toLowerCase(Locale.ROOT)) + .collect(Collectors.toUnmodifiableSet()); + } + + /** + * Prepares a set containing a single name to skip, after validating that it is non-blank. + * + * @param rawNameToSkip the raw name to skip; must be non-null and non-blank + * @param argumentName the name of the argument being checked + * @return a {@link Set} containing the single validated name to skip + * @throws IllegalArgumentException if {@code rawNameToSkip} is blank + * @throws NullPointerException if {@code rawNameToSkip} is null + */ + @Nonnull + static Set prepareSingleNameToSkip(@Nonnull final String rawNameToSkip, @Nonnull final String argumentName) { + return Set.of(Validators.notBlank(rawNameToSkip, argumentName)); + } } diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicate.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicate.java index f1c2584e..b722498c 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicate.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicate.java @@ -13,18 +13,17 @@ import io.github.mfvanek.pg.model.DbObject; import io.github.mfvanek.pg.model.PgContext; import io.github.mfvanek.pg.model.sequence.SequenceNameAware; -import io.github.mfvanek.pg.model.validation.Validators; import java.util.Collection; import java.util.Locale; -import java.util.Objects; import java.util.Set; import java.util.function.Predicate; -import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.concurrent.Immutable; import javax.annotation.concurrent.ThreadSafe; +import static io.github.mfvanek.pg.model.predicates.AbstractSkipTablesPredicate.prepareFullyQualifiedNamesToSkip; + /** * A predicate that filters out database objects based on a specified set of sequence names. * @@ -40,16 +39,11 @@ public final class SkipBySequenceNamePredicate implements Predicate { private final Set fullyQualifiedSequenceNamesToSkip; private SkipBySequenceNamePredicate(@Nonnull final PgContext pgContext, @Nonnull final Collection rawSequenceNamesToSkip) { - Objects.requireNonNull(pgContext, "pgContext cannot be null"); - this.fullyQualifiedSequenceNamesToSkip = Objects.requireNonNull(rawSequenceNamesToSkip, "rawSequenceNamesToSkip cannot be null") - .stream() - .map(pgContext::enrichWithSchema) - .map(s -> s.toLowerCase(Locale.ROOT)) - .collect(Collectors.toUnmodifiableSet()); + this.fullyQualifiedSequenceNamesToSkip = prepareFullyQualifiedNamesToSkip(pgContext, rawSequenceNamesToSkip); } private SkipBySequenceNamePredicate(@Nonnull final PgContext pgContext, @Nonnull final String rawSequenceNameToSkip) { - this(pgContext, Set.of(Validators.notBlank(rawSequenceNameToSkip, "rawSequenceNameToSkip"))); + this(pgContext, AbstractSkipTablesPredicate.prepareSingleNameToSkip(rawSequenceNameToSkip, "rawSequenceNameToSkip")); } /** diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipDbObjectsByNamePredicate.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipDbObjectsByNamePredicate.java index 00d89e38..591c2a26 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipDbObjectsByNamePredicate.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipDbObjectsByNamePredicate.java @@ -11,7 +11,6 @@ package io.github.mfvanek.pg.model.predicates; import io.github.mfvanek.pg.model.DbObject; -import io.github.mfvanek.pg.model.validation.Validators; import java.util.Collection; import java.util.Locale; @@ -53,7 +52,7 @@ private SkipDbObjectsByNamePredicate(@Nonnull final Collection fullyQual } private SkipDbObjectsByNamePredicate(@Nonnull final String fullyQualifiedObjectNameToSkip) { - this(Set.of(Validators.notBlank(fullyQualifiedObjectNameToSkip, "fullyQualifiedObjectNameToSkip"))); + this(AbstractSkipTablesPredicate.prepareSingleNameToSkip(fullyQualifiedObjectNameToSkip, "fullyQualifiedObjectNameToSkip")); } /** diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicate.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicate.java new file mode 100644 index 00000000..349258bf --- /dev/null +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicate.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2019-2024. Ivan Vakhrushev and others. + * https://github.com/mfvanek/pg-index-health + * + * This file is a part of "pg-index-health" - a Java library for + * analyzing and maintaining indexes health in PostgreSQL databases. + * + * Licensed under the Apache License 2.0 + */ + +package io.github.mfvanek.pg.model.predicates; + +import io.github.mfvanek.pg.model.DbObject; +import io.github.mfvanek.pg.model.PgContext; +import io.github.mfvanek.pg.model.index.IndexNameAware; + +import java.util.Collection; +import java.util.Locale; +import java.util.Set; +import java.util.function.Predicate; +import javax.annotation.Nonnull; +import javax.annotation.concurrent.Immutable; +import javax.annotation.concurrent.ThreadSafe; + +import static io.github.mfvanek.pg.model.predicates.AbstractSkipTablesPredicate.prepareFullyQualifiedNamesToSkip; + +/** + * A predicate that skips specified indexes by name in database objects implementing the {@link DbObject} interface. + * This class is immutable and thread-safe. + *

+ * It can be configured with either a single index name or a collection of index names to skip. The names are enriched + * with schema information, if available, to ensure they match the fully qualified index names in the database. + *

+ * + * @author Ivan Vakhrushev + * @see DbObject + * @see IndexNameAware + * @see PgContext + * @since 0.13.3 + */ +@Immutable +@ThreadSafe +public final class SkipIndexesByNamePredicate implements Predicate { + + private final Set fullyQualifiedIndexNamesToSkip; + + private SkipIndexesByNamePredicate(@Nonnull final PgContext pgContext, @Nonnull final Collection rawIndexNamesToSkip) { + this.fullyQualifiedIndexNamesToSkip = prepareFullyQualifiedNamesToSkip(pgContext, rawIndexNamesToSkip); + } + + private SkipIndexesByNamePredicate(@Nonnull final PgContext pgContext, @Nonnull final String rawIndexNameToSkip) { + this(pgContext, AbstractSkipTablesPredicate.prepareSingleNameToSkip(rawIndexNameToSkip, "rawIndexNameToSkip")); + } + + /** + * Tests whether the specified {@code DbObject} should be skipped based on its index name. + * + * @param dbObject the database object to test; must be non-null + * @return {@code true} if the {@code dbObject}'s index name does not match any of the names to skip; {@code false} otherwise + */ + @Override + public boolean test(@Nonnull final DbObject dbObject) { + if (!fullyQualifiedIndexNamesToSkip.isEmpty() && dbObject instanceof IndexNameAware) { + final IndexNameAware i = (IndexNameAware) dbObject; + return !fullyQualifiedIndexNamesToSkip.contains(i.getIndexName().toLowerCase(Locale.ROOT)); + } + return true; + } + + /** + * Creates a predicate to skip a single index name in the public schema. + * + * @param rawIndexNameToSkip the raw index name to skip; must be non-null and non-blank + * @return a {@link Predicate} to skip the specified index name + */ + public static Predicate ofName(@Nonnull final String rawIndexNameToSkip) { + return new SkipIndexesByNamePredicate(PgContext.ofPublic(), rawIndexNameToSkip); + } + + /** + * Creates a predicate to skip a collection of index names in the public schema. + * + * @param rawIndexNamesToSkip a collection of raw index names to skip; must be non-null + * @return a {@link Predicate} to skip the specified index names + */ + public static Predicate of(@Nonnull final Collection rawIndexNamesToSkip) { + return new SkipIndexesByNamePredicate(PgContext.ofPublic(), rawIndexNamesToSkip); + } + + /** + * Creates a predicate to skip a single index name in a specified schema context. + * + * @param pgContext the PostgreSQL context used to enrich the raw index name with schema information; must be non-null + * @param rawIndexNameToSkip the raw index name to skip; must be non-null and non-blank + * @return a {@link Predicate} to skip the specified index name + */ + public static Predicate ofName(@Nonnull final PgContext pgContext, @Nonnull final String rawIndexNameToSkip) { + return new SkipIndexesByNamePredicate(pgContext, rawIndexNameToSkip); + } + + /** + * Creates a predicate to skip a collection of index names in a specified schema context. + * + * @param pgContext the PostgreSQL context used to enrich each raw index name with schema information; must be non-null + * @param rawIndexNamesToSkip a collection of raw index names to skip; must be non-null + * @return a {@link Predicate} to skip the specified index names + */ + public static Predicate of(@Nonnull final PgContext pgContext, @Nonnull final Collection rawIndexNamesToSkip) { + return new SkipIndexesByNamePredicate(pgContext, rawIndexNamesToSkip); + } +} diff --git a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicate.java b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicate.java index 71b901bf..d6affc96 100644 --- a/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicate.java +++ b/pg-index-health-model/src/main/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicate.java @@ -12,10 +12,8 @@ import io.github.mfvanek.pg.model.DbObject; import io.github.mfvanek.pg.model.PgContext; -import io.github.mfvanek.pg.model.validation.Validators; import java.util.Collection; -import java.util.Set; import java.util.function.Predicate; import javax.annotation.Nonnull; import javax.annotation.concurrent.Immutable; @@ -42,7 +40,7 @@ private SkipTablesByNamePredicate(@Nonnull final PgContext pgContext, @Nonnull f } private SkipTablesByNamePredicate(@Nonnull final PgContext pgContext, @Nonnull final String rawTableNameToSkip) { - this(pgContext, Set.of(Validators.notBlank(rawTableNameToSkip, "rawTableNameToSkip"))); + this(pgContext, prepareSingleNameToSkip(rawTableNameToSkip, "rawTableNameToSkip")); } /** diff --git a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicateTest.java b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicateTest.java index 772e176a..50f2e695 100644 --- a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicateTest.java +++ b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/AbstractSkipTablesPredicateTest.java @@ -36,7 +36,7 @@ void shouldThrowExceptionWhenInvalidDataPassed() { final PgContext ctx = PgContext.ofPublic(); assertThatThrownBy(() -> new SkipTablesPredicate(ctx, null)) .isInstanceOf(NullPointerException.class) - .hasMessage("rawTableNamesToSkip cannot be null"); + .hasMessage("rawNamesToSkip cannot be null"); } @Test diff --git a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicateTest.java b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicateTest.java index 541010a8..e6c5eae6 100644 --- a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicateTest.java +++ b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipBySequenceNamePredicateTest.java @@ -45,7 +45,7 @@ void shouldThrowExceptionWhenInvalidDataPassed() { assertThatThrownBy(() -> SkipBySequenceNamePredicate.of(null)) .isInstanceOf(NullPointerException.class) - .hasMessage("rawSequenceNamesToSkip cannot be null"); + .hasMessage("rawNamesToSkip cannot be null"); assertThatThrownBy(() -> SkipBySequenceNamePredicate.of(null, null)) .isInstanceOf(NullPointerException.class) @@ -54,7 +54,7 @@ void shouldThrowExceptionWhenInvalidDataPassed() { final PgContext ctx = PgContext.ofPublic(); assertThatThrownBy(() -> SkipBySequenceNamePredicate.of(ctx, null)) .isInstanceOf(NullPointerException.class) - .hasMessage("rawSequenceNamesToSkip cannot be null"); + .hasMessage("rawNamesToSkip cannot be null"); assertThatThrownBy(() -> SkipBySequenceNamePredicate.ofName(ctx, null)) .isInstanceOf(NullPointerException.class) diff --git a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicateTest.java b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicateTest.java new file mode 100644 index 00000000..d6b1ca32 --- /dev/null +++ b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipIndexesByNamePredicateTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2019-2024. Ivan Vakhrushev and others. + * https://github.com/mfvanek/pg-index-health + * + * This file is a part of "pg-index-health" - a Java library for + * analyzing and maintaining indexes health in PostgreSQL databases. + * + * Licensed under the Apache License 2.0 + */ + +package io.github.mfvanek.pg.model.predicates; + +import io.github.mfvanek.pg.model.PgContext; +import io.github.mfvanek.pg.model.column.Column; +import io.github.mfvanek.pg.model.column.ColumnWithSerialType; +import io.github.mfvanek.pg.model.index.Index; +import io.github.mfvanek.pg.model.sequence.SequenceState; +import io.github.mfvanek.pg.model.table.Table; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import org.mockito.Mockito; + +import java.util.List; +import java.util.Set; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class SkipIndexesByNamePredicateTest { + + @SuppressWarnings("DataFlowIssue") + @Test + void shouldThrowExceptionWhenInvalidDataPassed() { + assertThatThrownBy(() -> SkipIndexesByNamePredicate.ofName(null)) + .isInstanceOf(NullPointerException.class) + .hasMessage("rawIndexNameToSkip cannot be null"); + + assertThatThrownBy(() -> SkipIndexesByNamePredicate.ofName("")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("rawIndexNameToSkip cannot be blank"); + + assertThatThrownBy(() -> SkipIndexesByNamePredicate.ofName(" ")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("rawIndexNameToSkip cannot be blank"); + + assertThatThrownBy(() -> SkipIndexesByNamePredicate.of(null)) + .isInstanceOf(NullPointerException.class) + .hasMessage("rawNamesToSkip cannot be null"); + + assertThatThrownBy(() -> SkipIndexesByNamePredicate.of(null, null)) + .isInstanceOf(NullPointerException.class) + .hasMessage("pgContext cannot be null"); + + final PgContext ctx = PgContext.ofPublic(); + assertThatThrownBy(() -> SkipIndexesByNamePredicate.of(ctx, null)) + .isInstanceOf(NullPointerException.class) + .hasMessage("rawNamesToSkip cannot be null"); + + assertThatThrownBy(() -> SkipIndexesByNamePredicate.ofName(ctx, null)) + .isInstanceOf(NullPointerException.class) + .hasMessage("rawIndexNameToSkip cannot be null"); + + assertThatThrownBy(() -> SkipIndexesByNamePredicate.ofName(ctx, "")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("rawIndexNameToSkip cannot be blank"); + + assertThatThrownBy(() -> SkipIndexesByNamePredicate.ofName(ctx, " ")) + .isInstanceOf(IllegalArgumentException.class) + .hasMessage("rawIndexNameToSkip cannot be blank"); + } + + @Test + void shouldNotCastObjectsWhenExclusionsIsEmpty() { + final Index mockIndex = Mockito.mock(Index.class); + assertThat(SkipIndexesByNamePredicate.of(List.of())) + .accepts(mockIndex); + Mockito.verify(mockIndex, Mockito.never()).getIndexName(); + } + + @Test + void shouldWorkForSingleIndex() { + assertThat(SkipIndexesByNamePredicate.ofName("i2")) + .accepts(Table.of("t", 0L)) + .accepts(Index.of("t1", "i1")) + .rejects(Index.of("t2", "i2")) + .rejects(Index.of("t2", "I2")); + + final PgContext ctx = PgContext.of("CUSTOM"); + assertThat(SkipIndexesByNamePredicate.ofName(ctx, "I2")) + .accepts(Table.of("custom.t", 0L)) + .accepts(Index.of("custom.t1", "custom.i1")) + .rejects(Index.of("custom.t2", "custom.i2")) + .rejects(Index.of("custom.T2", "custom.I2")); + } + + @Test + void shouldWorkForMultipleIndexes() { + assertThat(SkipIndexesByNamePredicate.of(Set.of("i1", "I2"))) + .accepts(Table.of("t", 0L)) + .accepts(SequenceState.of("s11", "int", 80.0)) + .accepts(ColumnWithSerialType.ofSerial(Column.ofNullable("t", "c"), "s1")) + .rejects(Index.of("t1", "i1")) + .rejects(Index.of("t2", "i1")) + .rejects(Index.of("T2", "I2")); + } + + @ParameterizedTest + @ValueSource(strings = {PgContext.DEFAULT_SCHEMA_NAME, "custom"}) + void shouldWorkWithCustomSchema(final String schemaName) { + final PgContext ctx = PgContext.of(schemaName); + assertThat(SkipIndexesByNamePredicate.of(ctx, Set.of("i1", "i2"))) + .accepts(Table.of(ctx.enrichWithSchema("t"), 0L)) + .accepts(Index.of(ctx.enrichWithSchema("t1"), ctx.enrichWithSchema("i11"))) + .rejects(Index.of(ctx.enrichWithSchema("t2"), ctx.enrichWithSchema("i2"))); + } +} diff --git a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicateTest.java b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicateTest.java index 7840303f..ed83ea00 100644 --- a/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicateTest.java +++ b/pg-index-health-model/src/test/java/io/github/mfvanek/pg/model/predicates/SkipTablesByNamePredicateTest.java @@ -42,7 +42,7 @@ void shouldThrowExceptionWhenInvalidDataPassed() { assertThatThrownBy(() -> SkipTablesByNamePredicate.of(null)) .isInstanceOf(NullPointerException.class) - .hasMessage("rawTableNamesToSkip cannot be null"); + .hasMessage("rawNamesToSkip cannot be null"); assertThatThrownBy(() -> SkipTablesByNamePredicate.of(null, null)) .isInstanceOf(NullPointerException.class) @@ -51,7 +51,7 @@ void shouldThrowExceptionWhenInvalidDataPassed() { final PgContext ctx = PgContext.ofPublic(); assertThatThrownBy(() -> SkipTablesByNamePredicate.of(ctx, null)) .isInstanceOf(NullPointerException.class) - .hasMessage("rawTableNamesToSkip cannot be null"); + .hasMessage("rawNamesToSkip cannot be null"); assertThatThrownBy(() -> SkipTablesByNamePredicate.ofName(ctx, null)) .isInstanceOf(NullPointerException.class) diff --git a/pg-index-health/src/main/java/io/github/mfvanek/pg/checks/predicates/FilterIndexesByNamePredicate.java b/pg-index-health/src/main/java/io/github/mfvanek/pg/checks/predicates/FilterIndexesByNamePredicate.java index 3df7e874..d1ce35af 100644 --- a/pg-index-health/src/main/java/io/github/mfvanek/pg/checks/predicates/FilterIndexesByNamePredicate.java +++ b/pg-index-health/src/main/java/io/github/mfvanek/pg/checks/predicates/FilterIndexesByNamePredicate.java @@ -22,7 +22,9 @@ * * @author Ivan Vakhrushev * @since 0.6.0 + * @deprecated This class has been replaced by {@link io.github.mfvanek.pg.model.predicates.SkipIndexesByNamePredicate} */ +@Deprecated(since = "0.13.3", forRemoval = true) public class FilterIndexesByNamePredicate extends AbstractFilterByName implements Predicate { private FilterIndexesByNamePredicate(@Nonnull final Collection exclusions) {