diff --git a/modules/dxp/apps/portal-search-tuning/portal-search-tuning-rankings-web/src/test/java/com/liferay/portal/search/tuning/rankings/web/internal/index/name/RankingIndexNameBuilderImplTest.java b/modules/dxp/apps/portal-search-tuning/portal-search-tuning-rankings-web/src/test/java/com/liferay/portal/search/tuning/rankings/web/internal/index/name/RankingIndexNameBuilderImplTest.java index c81ddf926af89c..0b23f2ce9cb9e5 100644 --- a/modules/dxp/apps/portal-search-tuning/portal-search-tuning-rankings-web/src/test/java/com/liferay/portal/search/tuning/rankings/web/internal/index/name/RankingIndexNameBuilderImplTest.java +++ b/modules/dxp/apps/portal-search-tuning/portal-search-tuning-rankings-web/src/test/java/com/liferay/portal/search/tuning/rankings/web/internal/index/name/RankingIndexNameBuilderImplTest.java @@ -15,6 +15,8 @@ import org.junit.Rule; import org.junit.Test; +import org.mockito.Mockito; + /** * @author André de Oliveira */ @@ -28,7 +30,7 @@ public class RankingIndexNameBuilderImplTest { @Test public void testMultiTenancy() { _assertIndexName( - 2021, companyId -> "liferay-" + companyId, + 2021, _createIndexNameBuilder(), "liferay-2021-search-tuning-rankings"); } @@ -47,4 +49,19 @@ private void _assertIndexName( Assert.assertEquals(expected, rankingIndexName.getIndexName()); } + private IndexNameBuilder _createIndexNameBuilder() { + IndexNameBuilder indexNameBuilder = Mockito.mock( + IndexNameBuilder.class); + + Mockito.when( + indexNameBuilder.getIndexName(Mockito.anyLong()) + ).then( + invocation -> + "liferay-" + + String.valueOf(invocation.getArgument(0, Long.class)) + ); + + return indexNameBuilder; + } + } \ No newline at end of file diff --git a/modules/dxp/apps/portal-search-tuning/portal-search-tuning-synonyms-web/src/test/java/com/liferay/portal/search/tuning/synonyms/web/internal/index/name/SynonymSetIndexNameBuilderImplTest.java b/modules/dxp/apps/portal-search-tuning/portal-search-tuning-synonyms-web/src/test/java/com/liferay/portal/search/tuning/synonyms/web/internal/index/name/SynonymSetIndexNameBuilderImplTest.java index 7260865005a383..b3936895cf6454 100644 --- a/modules/dxp/apps/portal-search-tuning/portal-search-tuning-synonyms-web/src/test/java/com/liferay/portal/search/tuning/synonyms/web/internal/index/name/SynonymSetIndexNameBuilderImplTest.java +++ b/modules/dxp/apps/portal-search-tuning/portal-search-tuning-synonyms-web/src/test/java/com/liferay/portal/search/tuning/synonyms/web/internal/index/name/SynonymSetIndexNameBuilderImplTest.java @@ -15,6 +15,8 @@ import org.junit.Rule; import org.junit.Test; +import org.mockito.Mockito; + /** * @author André de Oliveira */ @@ -28,7 +30,7 @@ public class SynonymSetIndexNameBuilderImplTest { @Test public void testMultiTenancy() { _assertIndexName( - 2021, companyId -> "liferay-" + companyId, + 2021, _createIndexNameBuilder(), "liferay-2021-search-tuning-synonyms"); } @@ -48,4 +50,19 @@ private void _assertIndexName( Assert.assertEquals(expected, synonymSetIndexName.getIndexName()); } + private IndexNameBuilder _createIndexNameBuilder() { + IndexNameBuilder indexNameBuilder = Mockito.mock( + IndexNameBuilder.class); + + Mockito.when( + indexNameBuilder.getIndexName(Mockito.anyLong()) + ).then( + invocation -> + "liferay-" + + String.valueOf(invocation.getArgument(0, Long.class)) + ); + + return indexNameBuilder; + } + } \ No newline at end of file