diff --git a/commons/audit/core/src/test/java/org/forgerock/audit/AuditServiceImplTest.java b/commons/audit/core/src/test/java/org/forgerock/audit/AuditServiceImplTest.java index 5f8e6f43d..957cd8d48 100644 --- a/commons/audit/core/src/test/java/org/forgerock/audit/AuditServiceImplTest.java +++ b/commons/audit/core/src/test/java/org/forgerock/audit/AuditServiceImplTest.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2015-2016 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.audit; @@ -28,7 +29,6 @@ import static org.forgerock.json.resource.Requests.newQueryRequest; import static org.forgerock.json.resource.Responses.newQueryResponse; import static org.forgerock.json.resource.Responses.newResourceResponse; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.any; import static org.mockito.Mockito.eq; @@ -70,6 +70,7 @@ import org.forgerock.services.context.Context; import org.forgerock.services.context.RootContext; import org.forgerock.util.promise.Promise; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; @@ -108,7 +109,7 @@ public void shouldDelegateCreateRequestToRegisteredHandler() throws Exception { //then assertThat(auditService.isAuditing("access")).isTrue(); - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .succeeded() .withObject() .isInstanceOf(ResourceResponse.class); @@ -133,7 +134,7 @@ public void shouldIgnoreCreateRequestIfAuditEventTopicNotMappedToHandler() throw //then assertThat(auditService.isAuditing(topic)).isFalse(); - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .succeeded() .withObject() .isInstanceOf(ResourceResponse.class); @@ -158,7 +159,7 @@ public void shouldFailCreateRequestIfAuditEventTopicIsNotKnown() throws ServiceU //then assertThat(auditService.isAuditing("unknownTopic")).isFalse(); - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(ResourceException.class); } @@ -187,7 +188,7 @@ public void shouldFailCreateRequestIfHandlerConfiguredForQueriesThrowsException( //then verify(queryHandler, times(1)).publishEvent(any(Context.class), eq("access"), any(JsonValue.class)); verify(otherHandler, times(1)).publishEvent(any(Context.class), eq("access"), any(JsonValue.class)); - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(InternalServerErrorException.class); } @@ -244,7 +245,7 @@ public void shouldDelegateReadRequestToConfiguredHandlerForQueries() throws Exce auditService.handleRead(new RootContext(), readRequest); //then - assertThat(promise).isSameAs(dummyResponse); + AssertJPromiseAssert.assertThat(promise).isSameAs(dummyResponse); verifyZeroInteractions(otherAuditEventHandler); } @@ -260,7 +261,7 @@ public void shouldNotSupportDeleteOfAuditEvents() throws ResourceException { Requests.newDeleteRequest("_id")); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(NotSupportedException.class); } @@ -278,7 +279,7 @@ public void shouldNotSupportPatchOfAuditEvents() throws ResourceException { Requests.newPatchRequest("_id")); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(NotSupportedException.class); } @@ -296,7 +297,7 @@ public void shouldNotSupportUpdateOfAuditEvents() throws ResourceException { Requests.newUpdateRequest("_id", new JsonValue(new HashMap()))); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(NotSupportedException.class); } @@ -314,7 +315,7 @@ public void shouldNotSupportActions() throws ResourceException { Requests.newActionRequest("access", "unknownAction")); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(BadRequestException.class); } @@ -342,7 +343,7 @@ public void shouldDelegateQueryRequestToConfiguredHandlerForQueries() throws Exc //then verify(eventHandler).queryEvents( any(Context.class), any(String.class), any(QueryRequest.class), any(QueryResourceHandler.class)); - assertThat(promise).isSameAs(queryResponsePromise); + AssertJPromiseAssert.assertThat(promise).isSameAs(queryResponsePromise); } @Test @@ -364,7 +365,7 @@ public void shouldFailCreateRequestIfAuditEventIsMissingTransactionId() throws R auditService.handleCreate(new RootContext(), createRequest); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(BadRequestException.class); } @@ -388,7 +389,7 @@ public void shouldFailCreateRequestIfAuditEventIsMissingTimestamp() throws Resou auditService.handleCreate(new RootContext(), createRequest); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(BadRequestException.class); } @@ -559,7 +560,7 @@ public void shouldFailCreateRequestIfAuditServiceIsShutdown() throws Exception { auditService.handleCreate(new RootContext(), createRequest); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(ServiceUnavailableException.class) .hasMessage("AuditService not running"); @@ -576,7 +577,7 @@ public void shouldFailReadRequestIfAuditServiceIsShutdown() { auditService.handleRead(new RootContext(), readRequest); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(ServiceUnavailableException.class) .hasMessage("AuditService not running"); @@ -594,7 +595,7 @@ public void shouldFailQueryRequestIfAuditServiceIsShutdown() { mock(QueryResourceHandler.class)); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .failedWithException() .isInstanceOf(ServiceUnavailableException.class) .hasMessage("AuditService not running"); @@ -654,7 +655,7 @@ public void shouldNotDelegateCreateRequestToADisabledHandler() throws Exception //then assertThat(auditService.isAuditing(topic)).isFalse(); - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .succeeded() .withObject() .isInstanceOf(ResourceResponse.class); @@ -689,7 +690,7 @@ public void shouldDelegateFilteredCreateRequestToRegisteredHandler() throws Exce //then assertThat(auditService.isAuditing(topic)).isTrue(); - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .succeeded() .withObject() .isInstanceOf(ResourceResponse.class); @@ -721,7 +722,7 @@ public void shouldNotDelegateReadRequestToConfiguredHandlerForQueriesWhenNoResou auditService.handleRead(new RootContext(), readRequest); //then - assertThat(promise).failedWithException().isInstanceOf(BadRequestException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(BadRequestException.class); verifyZeroInteractions(otherAuditEventHandler); } @@ -747,7 +748,7 @@ public void shouldNotDelegateReadRequestToConfiguredHandlerForQueriesWhenInvalid auditService.handleRead(new RootContext(), readRequest); //then - assertThat(promise).failedWithException().isInstanceOf(BadRequestException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(BadRequestException.class); verifyZeroInteractions(otherAuditEventHandler); } diff --git a/commons/audit/handler-csv/src/test/java/org/forgerock/audit/handlers/csv/CsvAuditEventHandlerTest.java b/commons/audit/handler-csv/src/test/java/org/forgerock/audit/handlers/csv/CsvAuditEventHandlerTest.java index f0da34774..815b91aa3 100644 --- a/commons/audit/handler-csv/src/test/java/org/forgerock/audit/handlers/csv/CsvAuditEventHandlerTest.java +++ b/commons/audit/handler-csv/src/test/java/org/forgerock/audit/handlers/csv/CsvAuditEventHandlerTest.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2015-2016 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.audit.handlers.csv; @@ -22,7 +23,6 @@ import static org.forgerock.audit.AuditServiceProxy.*; import static org.forgerock.audit.handlers.csv.CsvAuditEventHandler.*; import static org.forgerock.json.JsonValue.*; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.mockito.Mockito.*; import java.io.File; @@ -61,6 +61,7 @@ import org.forgerock.services.context.RootContext; import org.forgerock.util.promise.Promise; import org.forgerock.util.promise.ResultHandler; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; import org.mockito.ArgumentCaptor; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -154,7 +155,7 @@ public void testCreatingAuditLogEntry() throws Exception { csvHandler.publishEvent(context, "access", createRequest.getContent()); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .succeeded() .withObject() .isInstanceOf(ResourceResponse.class); @@ -182,7 +183,7 @@ public void testReadingAuditLogEntry() throws Exception { csvHandler.readEvent(context, "access", readRequest.getResourcePathObject().tail(1).toString()); //then - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .succeeded() .withObject() .isInstanceOf(ResourceResponse.class); @@ -230,7 +231,7 @@ public void testQueryOnAuditLogEntry() throws Exception { csvHandler.queryEvents(context, "access", queryRequest, queryResourceHandler); //then - assertThat(promise).succeeded(); + AssertJPromiseAssert.assertThat(promise).succeeded(); verify(queryResourceHandler).handleResource(resourceCaptor.capture()); final ResourceResponse resource = resourceCaptor.getValue(); @@ -268,7 +269,7 @@ private ResourceResponse createAccessEvent(AuditEventHandler auditEventHandler) final Promise promise = auditEventHandler.publishEvent(context, "access", createRequest.getContent()); - assertThat(promise) + AssertJPromiseAssert.assertThat(promise) .succeeded() .isInstanceOf(ResourceResponse.class); diff --git a/commons/audit/handler-elasticsearch/src/test/java/org/forgerock/audit/handlers/elasticsearch/ElasticsearchAuditEventHandlerTest.java b/commons/audit/handler-elasticsearch/src/test/java/org/forgerock/audit/handlers/elasticsearch/ElasticsearchAuditEventHandlerTest.java index ab38e89cf..50c58e693 100644 --- a/commons/audit/handler-elasticsearch/src/test/java/org/forgerock/audit/handlers/elasticsearch/ElasticsearchAuditEventHandlerTest.java +++ b/commons/audit/handler-elasticsearch/src/test/java/org/forgerock/audit/handlers/elasticsearch/ElasticsearchAuditEventHandlerTest.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2016 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.audit.handlers.elasticsearch; @@ -22,7 +23,6 @@ import static org.forgerock.json.JsonValue.json; import static org.forgerock.json.JsonValue.object; import static org.forgerock.util.promise.Promises.newResultPromise; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -64,6 +64,7 @@ import org.forgerock.util.promise.NeverThrowsException; import org.forgerock.util.promise.Promise; import org.forgerock.util.query.QueryFilter; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.testng.annotations.BeforeTest; @@ -170,7 +171,7 @@ public void testFailedQuery() throws Exception { handler.queryEvents(mock(Context.class), "access", queryRequest, queryResourceHandler); // then - assertThat(result).failedWithException().isInstanceOf(InternalServerErrorException.class); + AssertJPromiseAssert.assertThat(result).failedWithException().isInstanceOf(InternalServerErrorException.class); } @Test @@ -213,7 +214,7 @@ public void testFailedRead() throws Exception { handler.readEvent(context, "authentication", "fake-id-that-does-not-exist"); // then - assertThat(responsePromise).failedWithException().isInstanceOf(NotFoundException.class); + AssertJPromiseAssert.assertThat(responsePromise).failedWithException().isInstanceOf(NotFoundException.class); } @Test diff --git a/commons/audit/handler-jms/src/test/java/org/forgerock/audit/handlers/jms/JmsAuditEventHandlerTest.java b/commons/audit/handler-jms/src/test/java/org/forgerock/audit/handlers/jms/JmsAuditEventHandlerTest.java index 46163eca8..17f7c13c3 100644 --- a/commons/audit/handler-jms/src/test/java/org/forgerock/audit/handlers/jms/JmsAuditEventHandlerTest.java +++ b/commons/audit/handler-jms/src/test/java/org/forgerock/audit/handlers/jms/JmsAuditEventHandlerTest.java @@ -12,7 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2016 ForgeRock AS. - * Portions copyright 2024 3A Systems LLC. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.audit.handlers.jms; @@ -22,7 +22,6 @@ import static org.forgerock.audit.json.AuditJsonConfig.parseAuditEventHandlerConfiguration; import static org.forgerock.json.JsonValue.*; import static org.forgerock.json.test.assertj.AssertJJsonValueAssert.assertThat; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Mockito.anyBoolean; @@ -59,6 +58,7 @@ import org.forgerock.json.resource.ResourceException; import org.forgerock.json.resource.ResourceResponse; import org.forgerock.util.promise.Promise; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; import org.mockito.ArgumentCaptor; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; @@ -299,7 +299,7 @@ public void testJmsAuditEventHandlerPublishWithFailedRetry() throws Exception { jmsAuditEventHandler.publishEvent(null, "TEST_AUDIT", json(object(field("name", "TestEvent")))); // then - assertThat(promise).failedWithException().isInstanceOf(InternalServerErrorException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(InternalServerErrorException.class); } @@ -323,7 +323,7 @@ public void testQueryNotSupported() throws Exception { Promise response = jmsAuditEventHandler.queryEvents(null, "TEST_AUDIT", Requests.newQueryRequest(""), null); - assertThat(response).failedWithException().isInstanceOf(NotSupportedException.class); + AssertJPromiseAssert.assertThat(response).failedWithException().isInstanceOf(NotSupportedException.class); } @Test @@ -348,7 +348,7 @@ public void testReadNotSupported() throws Exception { // then - assertThat(response).failedWithException().isInstanceOf(NotSupportedException.class); + AssertJPromiseAssert.assertThat(response).failedWithException().isInstanceOf(NotSupportedException.class); } private JmsAuditEventHandlerConfiguration getDefaultConfiguration() throws Exception { diff --git a/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/ModuleAuditingIT.java b/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/ModuleAuditingIT.java index 2ca88be8d..f3f83502d 100644 --- a/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/ModuleAuditingIT.java +++ b/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/ModuleAuditingIT.java @@ -12,12 +12,12 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2014-2016 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.caf.authn; import static org.assertj.core.api.Assertions.assertThat; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.assertj.core.data.MapEntry.entry; import static org.forgerock.caf.authn.AuthModuleParameters.moduleArray; import static org.forgerock.caf.authn.AuthModuleParameters.moduleParams; @@ -42,6 +42,7 @@ import org.forgerock.services.context.RootContext; import org.forgerock.util.promise.NeverThrowsException; import org.forgerock.util.promise.Promise; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.testng.annotations.DataProvider; @@ -163,7 +164,7 @@ public void auditing(String dataName, AuthModuleParameters sessionModuleParams, Promise result = handler.handle(new AttributesContext(new RootContext()), request); - assertThat(result).succeeded(); + AssertJPromiseAssert.assertThat(result).succeeded(); assertThat(result.get().getStatus().getCode()).isEqualTo(expectedResponseStatus); JsonValue auditRecords = getAuditRecords(handler); diff --git a/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/TestFramework.java b/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/TestFramework.java index fb41b3458..aafa8d768 100644 --- a/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/TestFramework.java +++ b/commons/auth-filters/authn-filter/jaspi-functional-tests/src/test/java/org/forgerock/caf/authn/TestFramework.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2014-2016 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.caf.authn; @@ -20,7 +21,6 @@ import static org.assertj.core.api.Assertions.*; import static org.forgerock.caf.authn.test.ProtectedResource.*; import static org.forgerock.json.JsonValue.*; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.testng.Assert.fail; import java.util.ArrayList; @@ -43,6 +43,7 @@ import org.forgerock.util.promise.Promise; import com.fasterxml.jackson.databind.ObjectMapper; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; /** * Test framework for running tests and verifing results against the JASPI runtime. @@ -84,7 +85,7 @@ private static void configureRuntime(Handler handler, Class result = handler.handle(new AttributesContext(new RootContext()), request); - assertThat(result).succeeded(); + AssertJPromiseAssert.assertThat(result).succeeded(); assertThat(result.get().getStatus()).isEqualTo(Status.OK); } @@ -101,7 +102,7 @@ static JsonValue getAuditRecords(Handler handler) throws Exception { request.getHeaders().add(ContentTypeHeader.valueOf("application/json; charset=UTF-8")); Promise result = handler.handle(new AttributesContext(new RootContext()), request); - assertThat(result).succeeded(); + AssertJPromiseAssert.assertThat(result).succeeded(); assertThat(result.get().getStatus()).isEqualTo(Status.OK); return json(result.get().getEntity().getJson()); } @@ -176,7 +177,7 @@ static void runTest(Handler handler, String resourceName, AuthModuleParameters s Promise result = handler.handle(new AttributesContext(new RootContext()), request); - assertThat(result).succeeded(); + AssertJPromiseAssert.assertThat(result).succeeded(); Response response = result.get(); diff --git a/commons/auth-filters/authn-filter/jaspi-runtime/src/test/java/org/forgerock/caf/authentication/framework/JaspiAdaptersTest.java b/commons/auth-filters/authn-filter/jaspi-runtime/src/test/java/org/forgerock/caf/authentication/framework/JaspiAdaptersTest.java index b961a1bd3..12da726be 100644 --- a/commons/auth-filters/authn-filter/jaspi-runtime/src/test/java/org/forgerock/caf/authentication/framework/JaspiAdaptersTest.java +++ b/commons/auth-filters/authn-filter/jaspi-runtime/src/test/java/org/forgerock/caf/authentication/framework/JaspiAdaptersTest.java @@ -12,13 +12,13 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2015 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.caf.authentication.framework; import static org.assertj.core.api.Assertions.assertThat; import static org.forgerock.caf.authentication.framework.JaspiAdapters.MESSAGE_INFO_CONTEXT_KEY; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.*; @@ -44,6 +44,7 @@ import org.forgerock.http.protocol.Request; import org.forgerock.http.protocol.Response; import org.forgerock.util.promise.Promise; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; import org.testng.annotations.Test; public class JaspiAdaptersTest { @@ -66,7 +67,7 @@ public void adaptedAsyncServerAuthContextShouldAdaptSuccessfulValidateRequestCal asyncAuthContext.validateRequest(messageContext, clientSubject, serviceSubject); //Then - assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SUCCESS); + AssertJPromiseAssert.assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SUCCESS); } @Test @@ -87,7 +88,7 @@ public void adaptedAsyncServerAuthContextShouldAdaptFailedValidateRequestCall() asyncAuthContext.validateRequest(messageContext, clientSubject, serviceSubject); //Then - assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); } @Test @@ -107,7 +108,7 @@ public void adaptedAsyncServerAuthContextShouldAdaptSuccessfulSecureResponseCall asyncAuthContext.secureResponse(messageContext, serviceSubject); //Then - assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SEND_SUCCESS); + AssertJPromiseAssert.assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SEND_SUCCESS); } @Test @@ -127,7 +128,7 @@ public void adaptedAsyncServerAuthContextShouldAdaptFailedSecureResponseCall() t asyncAuthContext.secureResponse(messageContext, serviceSubject); //Then - assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); } @Test @@ -143,7 +144,7 @@ public void adaptedAsyncServerAuthContextShouldAdaptSuccessfulCleanSubjectCall() Promise promise = asyncAuthContext.cleanSubject(messageContext, clientSubject); //Then - assertThat(promise).succeeded().withObject().isNull(); + AssertJPromiseAssert.assertThat(promise).succeeded().withObject().isNull(); verify(authContext).cleanSubject(any(MessageInfo.class), eq(clientSubject)); } @@ -163,7 +164,7 @@ public void adaptedAsyncServerAuthContextShouldAdaptFailedCleanSubjectCall() thr Promise promise = asyncAuthContext.cleanSubject(messageContext, clientSubject); //Then - assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); } @Test @@ -196,7 +197,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptSuccessfulGetInitializeCall() asyncAuthModule.initialize(requestPolicy, responsePolicy, handler, options); //Then - assertThat(promise).succeeded().withObject().isNull(); + AssertJPromiseAssert.assertThat(promise).succeeded().withObject().isNull(); verify(authModule).initialize(requestPolicy, responsePolicy, handler, options); } @@ -218,7 +219,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptFailedGetInitializeCall() thr asyncAuthModule.initialize(requestPolicy, responsePolicy, handler, options); //Then - assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); } @Test @@ -255,7 +256,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptSuccessfulValidateRequestCall asyncAuthModule.validateRequest(messageInfo, clientSubject, serviceSubject); //Then - assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SUCCESS); + AssertJPromiseAssert.assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SUCCESS); } @Test @@ -276,7 +277,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptFailedValidateRequestCall() t asyncAuthModule.validateRequest(messageInfo, clientSubject, serviceSubject); //Then - assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); } @Test @@ -296,7 +297,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptSuccessfulSecureResponseCall( asyncAuthModule.secureResponse(messageInfo, serviceSubject); //Then - assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SEND_SUCCESS); + AssertJPromiseAssert.assertThat(promise).succeeded().withObject().isEqualTo(AuthStatus.SEND_SUCCESS); } @Test @@ -316,7 +317,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptFailedSecureResponseCall() th asyncAuthModule.secureResponse(messageInfo, serviceSubject); //Then - assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); } @Test @@ -332,7 +333,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptSuccessfulCleanSubjectCall() Promise promise = asyncAuthModule.cleanSubject(messageInfo, clientSubject); //Then - assertThat(promise).succeeded().withObject().isNull(); + AssertJPromiseAssert.assertThat(promise).succeeded().withObject().isNull(); verify(authModule).cleanSubject(any(MessageInfo.class), eq(clientSubject)); } @@ -352,7 +353,7 @@ public void adaptedAsyncServerAuthModuleShouldAdaptFailedCleanSubjectCall() thro Promise promise = asyncAuthModule.cleanSubject(messageInfo, clientSubject); //Then - assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); + AssertJPromiseAssert.assertThat(promise).failedWithException().isInstanceOf(AuthenticationException.class); } @Test diff --git a/commons/http-framework/binding-test-utils/pom.xml b/commons/http-framework/binding-test-utils/pom.xml index 6718770a7..45d53cb63 100644 --- a/commons/http-framework/binding-test-utils/pom.xml +++ b/commons/http-framework/binding-test-utils/pom.xml @@ -13,6 +13,7 @@ ~ information: "Portions copyright [year] [name of copyright owner]". ~ ~ Copyright 2016 ForgeRock AS. + ~ Portions copyright 2020-2026 3A Systems LLC. --> @@ -48,6 +49,11 @@ testng compile + + org.assertj + assertj-core + compile + org.mockito mockito-all diff --git a/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RequestsTest.java b/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RequestsTest.java index 57514eef4..0848a34b2 100644 --- a/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RequestsTest.java +++ b/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RequestsTest.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2013-2015 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.json.resource; @@ -73,7 +74,7 @@ public void testResourceIdEscaping1() { Request r = Requests.newReadRequest("test/users/forward%2fslash"); assertThat(r.getResourcePath()).isEqualTo("test/users/forward%2fslash"); assertThat(r.getResourcePathObject().leaf()).isEqualTo("forward/slash"); - assertThat(r.getResourcePathObject().iterator()).hasSize(3); + assertThat(r.getResourcePathObject().iterator()).toIterable().hasSize(3); } @Test @@ -81,7 +82,7 @@ public void testResourceIdEscaping2() { Request r = Requests.newReadRequest("test/users", "forward/slash"); assertThat(r.getResourcePath()).isEqualTo("test/users/forward%2Fslash"); assertThat(r.getResourcePathObject().leaf()).isEqualTo("forward/slash"); - assertThat(r.getResourcePathObject().iterator()).hasSize(3); + assertThat(r.getResourcePathObject().iterator()).toIterable().hasSize(3); } @Test @@ -90,7 +91,7 @@ public void testNewResourceIdEscaping() { Requests.newCreateRequest("test/users", "forward/slash", new JsonValue(null)); assertThat(r.getResourcePath()).isEqualTo("test/users"); assertThat(r.getResourcePathObject().leaf()).isEqualTo("users"); - assertThat(r.getResourcePathObject().iterator()).hasSize(2); + assertThat(r.getResourcePathObject().iterator()).toIterable().hasSize(2); assertThat(r.getNewResourceId()).isEqualTo("forward/slash"); } diff --git a/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RouterTest.java b/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RouterTest.java index 5239078f0..8af323ef3 100644 --- a/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RouterTest.java +++ b/commons/rest/json-resource/src/test/java/org/forgerock/json/resource/RouterTest.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2015 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.json.resource; @@ -22,7 +23,6 @@ import static org.forgerock.http.routing.RoutingMode.STARTS_WITH; import static org.forgerock.json.resource.RouteMatchers.requestUriMatcher; import static org.forgerock.json.resource.Router.uriTemplate; -import static org.forgerock.util.test.assertj.AssertJPromiseAssert.assertThat; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.*; import static org.mockito.Mockito.mock; @@ -33,6 +33,7 @@ import org.forgerock.services.context.Context; import org.forgerock.http.routing.UriRouterContext; import org.forgerock.util.promise.Promise; +import org.forgerock.util.test.assertj.AssertJPromiseAssert; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; import org.testng.annotations.DataProvider; @@ -297,7 +298,7 @@ public void handleCreateShouldReturn404ResponseExceptionIfNoRouteFound() { Promise promise = router.handleCreate(context, request); //Then - assertThat(promise).failedWithException(); + AssertJPromiseAssert.assertThat(promise).failedWithException(); try { promise.getOrThrowUninterruptibly(); failBecauseExceptionWasNotThrown(ResourceException.class); @@ -320,7 +321,7 @@ public void handleReadShouldReturn404ResponseExceptionIfNoRouteFound() { Promise promise = router.handleRead(context, request); //Then - assertThat(promise).failedWithException(); + AssertJPromiseAssert.assertThat(promise).failedWithException(); try { promise.getOrThrowUninterruptibly(); failBecauseExceptionWasNotThrown(ResourceException.class); @@ -343,7 +344,7 @@ public void handleUpdateShouldReturn404ResponseExceptionIfNoRouteFound() { Promise promise = router.handleUpdate(context, request); //Then - assertThat(promise).failedWithException(); + AssertJPromiseAssert.assertThat(promise).failedWithException(); try { promise.getOrThrowUninterruptibly(); failBecauseExceptionWasNotThrown(ResourceException.class); @@ -366,7 +367,7 @@ public void handleDeleteShouldReturn404ResponseExceptionIfNoRouteFound() { Promise promise = router.handleDelete(context, request); //Then - assertThat(promise).failedWithException(); + AssertJPromiseAssert.assertThat(promise).failedWithException(); try { promise.getOrThrowUninterruptibly(); failBecauseExceptionWasNotThrown(ResourceException.class); @@ -389,7 +390,7 @@ public void handlePatchShouldReturn404ResponseExceptionIfNoRouteFound() { Promise promise = router.handlePatch(context, request); //Then - assertThat(promise).failedWithException(); + AssertJPromiseAssert.assertThat(promise).failedWithException(); try { promise.getOrThrowUninterruptibly(); failBecauseExceptionWasNotThrown(ResourceException.class); @@ -412,7 +413,7 @@ public void handleActionShouldReturn404ResponseExceptionIfNoRouteFound() { Promise promise = router.handleAction(context, request); //Then - assertThat(promise).failedWithException(); + AssertJPromiseAssert.assertThat(promise).failedWithException(); try { promise.getOrThrowUninterruptibly(); failBecauseExceptionWasNotThrown(ResourceException.class); @@ -436,7 +437,7 @@ public void handleQueryShouldReturn404ResponseExceptionIfNoRouteFound() { Promise promise = router.handleQuery(context, request, resultHandler); //Then - assertThat(promise).failedWithException(); + AssertJPromiseAssert.assertThat(promise).failedWithException(); try { promise.getOrThrowUninterruptibly(); failBecauseExceptionWasNotThrown(ResourceException.class); diff --git a/commons/util/test-utils/pom.xml b/commons/util/test-utils/pom.xml index a0e445670..22eea628a 100644 --- a/commons/util/test-utils/pom.xml +++ b/commons/util/test-utils/pom.xml @@ -12,6 +12,7 @@ ~ information: "Portions copyright [year] [name of copyright owner]". ~ ~ Copyright 2015 ForgeRock AS. + ~ Portions copyright 2020-2026 3A Systems LLC. --> 4.0.0 @@ -35,6 +36,7 @@ org.assertj assertj-core true + compile org.testng diff --git a/commons/util/test-utils/src/main/java/org/forgerock/json/test/assertj/AssertJJsonValueAssert.java b/commons/util/test-utils/src/main/java/org/forgerock/json/test/assertj/AssertJJsonValueAssert.java index 66a02c445..bdd4bf725 100644 --- a/commons/util/test-utils/src/main/java/org/forgerock/json/test/assertj/AssertJJsonValueAssert.java +++ b/commons/util/test-utils/src/main/java/org/forgerock/json/test/assertj/AssertJJsonValueAssert.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2015-2016 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.json.test.assertj; @@ -127,7 +128,7 @@ public ArrayJsonValueAssert isArray() { * Check that the {@link JsonValue} is a set. * @return The {@link AbstractIterableAssert} representation of this Assert instance. */ - public AbstractIterableAssert, Object> isSet() { + public AbstractIterableAssert, Object, ?> isSet() { isNotNull(); if (!actual.isSet()) { failWithMessage("Expected %s to be a set", actual.getPointer()); @@ -534,7 +535,7 @@ public ObjectJsonValueAssert doesNotContain(MapEntry... entries) { /** Class for assertions on array {@link JsonValue}. */ public static final class ArrayJsonValueAssert extends AbstractJsonValueAssert { - private AbstractListAssert, Object> listAssert; + private AbstractListAssert, Object, ?> listAssert; private ArrayJsonValueAssert(JsonValue value) { super(ArrayJsonValueAssert.class, value); diff --git a/commons/util/test-utils/src/main/java/org/forgerock/util/test/assertj/AssertJPromiseAssert.java b/commons/util/test-utils/src/main/java/org/forgerock/util/test/assertj/AssertJPromiseAssert.java index 0899886a2..053dc11b4 100644 --- a/commons/util/test-utils/src/main/java/org/forgerock/util/test/assertj/AssertJPromiseAssert.java +++ b/commons/util/test-utils/src/main/java/org/forgerock/util/test/assertj/AssertJPromiseAssert.java @@ -12,6 +12,7 @@ * information: "Portions copyright [year] [name of copyright owner]". * * Copyright 2015-2016 ForgeRock AS. + * Portions copyright 2020-2026 3A Systems LLC. */ package org.forgerock.util.test.assertj; @@ -90,7 +91,7 @@ private SuccessfulPromiseAssert(Object actual) { * @return A {@link AbstractIterableAssert} instance for making assertions on the value. */ @SuppressWarnings("unchecked") - public AbstractIterableAssert, T> withIterable() { + public AbstractIterableAssert, T, ?> withIterable() { isInstanceOf(Iterable.class); return Assertions.assertThat((Iterable) actual); } @@ -102,7 +103,7 @@ private SuccessfulPromiseAssert(Object actual) { * @return A {@link AbstractListAssert} instance for making assertions on the value. */ @SuppressWarnings("unchecked") - public AbstractListAssert, T> withList() { + public AbstractListAssert, T, ?> withList() { isInstanceOf(List.class); return Assertions.assertThat((List) actual); } diff --git a/commons/xcite-maven-plugin/pom.xml b/commons/xcite-maven-plugin/pom.xml index 208659e24..a7a290ed6 100644 --- a/commons/xcite-maven-plugin/pom.xml +++ b/commons/xcite-maven-plugin/pom.xml @@ -18,6 +18,7 @@ ! Portions Copyright [yyyy] [name of copyright owner] ! ! Copyright 2015 ForgeRock AS. + ! Portions copyright 2020-2026 3A Systems LLC. ! --> @@ -65,7 +66,6 @@ org.assertj assertj-core - 1.6.1 test diff --git a/persistit/pom.xml b/persistit/pom.xml index 0c4d4a914..9c572c1c7 100644 --- a/persistit/pom.xml +++ b/persistit/pom.xml @@ -38,13 +38,6 @@ 4.13.1 test - - - org.assertj - assertj-core - 1.7.0 - test - diff --git a/pom.xml b/pom.xml index 53522a04b..825f7a947 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ your own identifying information: "Portions Copyrighted [year] [name of copyright owner]" - Portions Copyright 2017-2025 3A Systems, LLC. + Portions Copyright 2017-2026 3A Systems, LLC. --> @@ -317,7 +317,8 @@ org.assertj assertj-core - 2.4.1 + 3.27.7 + test