From 4d5b3c8a32e846823f5a382830a0457a8365dd63 Mon Sep 17 00:00:00 2001 From: Karsten Thoms Date: Sun, 17 Nov 2024 06:26:03 +0100 Subject: [PATCH] chore(tests): Resolve Sonar assertj warnings (#212) chore(tests): resolve Sonar issues for assertj (#27) replace isEqualTo(true) by isTrue() replace isEqualTo(false) by isFalse() replace isEqualTo(0) by isZero() replace hasSize(0) by isEmpty() replace toString()).isEqualTo by hasToString() replace .size()).isEqualTo by .hasSize(() replace `.size()).isZero()` by `).isEmpty()`` replace `.isEqualTo(0L)` by `.isZero()`` replace `.contains(String).isTrue()` by `.contains(String)` replace `map.get(KEY).isEqualTo` by `containsEntry` replace `size().isZero()` by `isEmpty()` replace `keySet()).contains` by `containsKey()` replace `.isGreaterThan(0)` by `.isPositive()` chain assertion statements related to #27 --- .../operaton/bpm/client/client/ClientIT.java | 2 +- .../bpm/client/topic/TopicSubscriptionIT.java | 60 +++--- .../client/variable/FileSerializationIT.java | 10 +- .../client/variable/XmlSerializationIT.java | 8 +- .../bpm/client/variable/pa/PaExceptionIT.java | 4 +- .../ExponentialBackoffStrategyTest.java | 6 +- .../ExponentialErrorBackoffStrategyTest.java | 8 +- .../testing/ProcessEngineLoggingRuleTest.java | 16 +- .../test/variables/FileValueTypeImplTest.java | 27 +-- .../operaton/commons/utils/IoUtilTest.java | 5 +- .../utils/cache/ConcurrentLruCacheTest.java | 2 +- .../connect/httpclient/HttpRequestTest.java | 17 +- .../deploy/DeployChangedOnlyDisabledTest.java | 2 +- .../deploy/DeployChangedOnlyEnabledTest.java | 2 +- .../deploy/DeployChangedOnlyUnsetTest.java | 2 +- .../identity/LdapConfigurationTest.java | 2 +- .../dmn/engine/api/DmnDecisionResultTest.java | 24 +-- .../api/DmnDecisionTableResultTest.java | 22 +-- .../api/DmnEngineMetricCollectorTest.java | 14 +- .../bpm/dmn/engine/api/ParseDecisionTest.java | 18 +- .../DmnDecisionEvaluationListenerTest.java | 36 ++-- ...mnDecisionTableEvaluationListenerTest.java | 4 +- .../engine/el/ExpressionEvaluationTest.java | 8 +- .../evaluate/DmnDecisionEvaluationTest.java | 24 +-- .../transform/DmnTransformListenerTest.java | 4 +- .../engine/transform/DmnTransformTest.java | 41 ++-- .../feel/function/CustomFunctionTest.java | 27 ++- .../ConnectProcessEnginePluginTest.java | 2 +- .../LdapEnableSortControlSupportTest.java | 24 +-- .../impl/ldap/LdapGroupLargeQueryTest.java | 4 +- .../impl/ldap/LdapGroupQueryTest.java | 10 +- .../impl/ldap/LdapQueryToleranceTest.java | 8 +- .../impl/ldap/LdapUserLargeQueryTest.java | 4 +- .../identity/impl/ldap/LdapUserQueryTest.java | 2 +- ...onQueryWithCustomIdentityProviderTest.java | 2 +- .../ldap/posix/LdapPosixGroupQueryTest.java | 2 +- ...seExecutionRestServiceInteractionTest.java | 2 +- ...aseInstanceRestServiceInteractionTest.java | 2 +- .../ExecutionRestServiceInteractionTest.java | 36 ++-- ...essInstanceRestServiceInteractionTest.java | 2 +- .../engine/rest/TaskRestServiceQueryTest.java | 63 +++---- ...iableLocalRestResourceInteractionTest.java | 2 +- ...skVariableRestResourceInteractionTest.java | 2 +- .../rest/TenantRestServiceQueryTest.java | 2 +- .../rest/impl/FetchAndLockHandlerTest.java | 90 ++++----- .../EmbeddedProcessApplicationTest.java | 2 +- .../StartManagedThreadPoolStepTest.java | 27 ++- .../impl/parser/BpmPlatformXmlParserTest.java | 2 +- .../cfg/CompositeProcessEnginePluginTest.java | 16 +- .../bpm/engine/impl/test/TestHelperTest.java | 13 +- .../AuthorizationLoggingTest.java | 2 +- .../ManagementAuthorizationTest.java | 32 ++-- .../SchemaLogQueryAuthorizationTest.java | 10 +- ...rocessInstancesBatchAuthorizationTest.java | 2 +- ...rocessInstancesBatchAuthorizationTest.java | 2 +- ...oricProcessInstancesAuthorizationTest.java | 2 +- ...oricDecisionInstanceAuthorizationTest.java | 4 +- .../OptimizeServiceAuthorizationTest.java | 52 ++---- .../task/HandleTaskAuthorizationTest.java | 6 +- .../test/api/cfg/DeploymentCacheCfgTest.java | 9 +- .../ExternalTaskQueryByCreateTimeTest.java | 14 +- .../externaltask/ExternalTaskServiceTest.java | 34 ++-- .../test/api/filter/FilterPropertiesTest.java | 65 +++---- .../engine/test/api/form/FormServiceTest.java | 12 +- .../api/form/RetrieveOperatonFormRefTest.java | 8 +- ...icDecisionInstanceStatisticsQueryTest.java | 26 +-- .../test/api/history/HistoryCleanupTest.java | 2 +- .../HistoryServiceAsyncOperationsTest.java | 41 ++-- .../HistoricRootProcessInstanceTest.java | 8 +- .../RemovalTimeStrategyStartTest.java | 10 +- .../batch/BatchSetRemovalTimeTest.java | 4 +- ...tchSetRemovalTimeUserOperationLogTest.java | 2 +- .../HistoryCleanupRemovalTimeTest.java | 176 +++++++----------- .../identity/CustomPasswordPolicyTest.java | 2 +- .../IdentityServiceAuthorizationsTest.java | 8 +- .../identity/IdentityServiceTenantTest.java | 14 +- .../api/identity/IdentityServiceTest.java | 6 +- .../api/identity/PasswordHashingTest.java | 2 +- .../PasswordPolicyConfigurationTest.java | 20 +- .../test/api/identity/TenantQueryTest.java | 16 +- .../api/mgmt/BatchStatisticsQueryTest.java | 12 +- .../ManagementServiceAsyncOperationsTest.java | 26 +-- .../test/api/mgmt/ManagementServiceTest.java | 2 +- .../ProcessDefinitionStatisticsQueryTest.java | 4 +- .../mgmt/PropertyUserOperationLogTest.java | 10 +- .../api/mgmt/metrics/TaskMetricsTest.java | 6 +- .../telemetry/TelemetryConfigurationTest.java | 16 +- .../telemetry/TelemetryDynamicDataTest.java | 26 ++- .../MultiTenancyDecisionEvaluationTest.java | 2 +- ...ltiTenancyDecisionTableEvaluationTest.java | 2 +- .../MultiTenancyExecutionPropagationTest.java | 6 +- .../MultiTenancyFilterServiceTest.java | 4 +- .../MultiTenancyMessageCorrelationTest.java | 14 +- .../MultiTenancyRepositoryServiceTest.java | 2 +- .../MultiTenancySignalReceiveTest.java | 10 +- .../MultiTenancyTimerStartEventTest.java | 8 +- .../MultiTenancyUserOperationLogTest.java | 44 ++--- .../multitenancy/TenantIdProviderTest.java | 88 ++++----- .../MultiTenancyCaseDefinitionQueryTest.java | 4 +- .../MultiTenancyCaseExecutionQueryTest.java | 4 +- .../MultiTenancyCaseInstanceQueryTest.java | 4 +- ...HistoricCaseActivityInstanceQueryTest.java | 8 +- ...iTenancyHistoricCaseInstanceQueryTest.java | 8 +- ...ltiTenancyDecisionDefinitionQueryTest.java | 4 +- ...cisionRequirementsDefinitionQueryTest.java | 4 +- .../MultiTenancyDeploymentQueryTest.java | 4 +- ...ultiTenancyEventSubscriptionQueryTest.java | 4 +- .../query/MultiTenancyExecutionQueryTest.java | 4 +- .../MultiTenancyExternalTaskQueryTest.java | 6 +- .../query/MultiTenancyIncidentQueryTest.java | 6 +- .../MultiTenancyJobDefinitionQueryTest.java | 4 +- .../query/MultiTenancyJobQueryTest.java | 4 +- ...ultiTenancyProcessDefinitionQueryTest.java | 4 +- .../MultiTenancyProcessInstanceQueryTest.java | 4 +- .../MultiTenancyStatisticsQueryTest.java | 2 +- .../query/MultiTenancyTaskQueryTest.java | 8 +- ...MultiTenancyUserOperationLogQueryTest.java | 6 +- ...MultiTenancyVariableInstanceQueryTest.java | 6 +- ...ancyHistoricActivityInstanceQueryTest.java | 8 +- ...ancyHistoricDecisionInstanceQueryTest.java | 8 +- ...icDecisionInstanceStatisticsQueryTest.java | 2 +- ...cyHistoricDetailFormPropertyQueryTest.java | 8 +- ...HistoricDetailVariableUpdateQueryTest.java | 8 +- ...ltiTenancyHistoricExternalTaskLogTest.java | 16 +- ...nancyHistoricIdentityLinkLogQueryTest.java | 6 +- ...MultiTenancyHistoricIncidentQueryTest.java | 8 +- .../MultiTenancyHistoricJobLogQueryTest.java | 8 +- ...nancyHistoricProcessInstanceQueryTest.java | 8 +- ...iTenancyHistoricTaskInstanceQueryTest.java | 8 +- ...ancyHistoricVariableInstanceQueryTest.java | 8 +- ...edDecisionInstanceStatisticsQueryTest.java | 2 +- ...nancyJobDefinitionSuspensionStateTest.java | 52 +++--- .../MultiTenancyJobSuspensionStateTest.java | 22 +-- ...onSuspensionStateTenantIdProviderTest.java | 8 +- ...yProcessDefinitionSuspensionStateTest.java | 68 +++---- ...ncyProcessInstanceSuspensionStateTest.java | 64 +++---- ...enancyCaseInstanceCmdsTenantCheckTest.java | 8 +- ...iTenancyDeploymentCmdsTenantCheckTest.java | 10 +- ...enancyExternalTaskCmdsTenantCheckTest.java | 8 +- ...enancyHistoricDataCmdsTenantCheckTest.java | 36 ++-- ...ocessInstanceReportCmdTenantCheckTest.java | 6 +- ...enancyIdentityLinkCmdsTenantCheckTest.java | 16 +- ...yMessageCorrelationCmdTenantCheckTest.java | 16 +- ...essageEventReceivedCmdTenantCheckTest.java | 4 +- ...yProcessDefinitionCmdsTenantCheckTest.java | 8 +- ...enancySignalReceiveCmdTenantCheckTest.java | 14 +- ...TenancyTaskServiceCmdsTenantCheckTest.java | 8 +- ...toricActivityInstancesForOptimizeTest.java | 46 ++--- ...letedHistoricIncidentsForOptimizeTest.java | 22 +-- ...storicProcessInstancesForOptimizeTest.java | 40 ++-- ...dHistoricTaskInstancesForOptimizeTest.java | 14 +- ...toricDecisionInstancesForOptimizeTest.java | 42 ++--- ...storicIdentityLinkLogsForOptimizeTest.java | 42 ++--- ...tHistoricOperationLogsForOptimizeTest.java | 67 +++---- ...istoricVariableUpdatesForOptimizeTest.java | 34 ++-- ...tOpenHistoricIncidentsForOptimizeTest.java | 24 +-- ...toricActivityInstancesForOptimizeTest.java | 42 ++--- ...storicProcessInstancesForOptimizeTest.java | 40 ++-- ...gHistoricTaskInstancesForOptimizeTest.java | 40 ++-- .../BoundedNumberOfMaxResultsDelegate.java | 10 +- .../BoundedNumberOfMaxResultsTest.java | 41 ++-- .../repository/CaseDefinitionQueryTest.java | 6 +- .../DecisionDefinitionQueryTest.java | 8 +- ...cisionRequirementsDefinitionQueryTest.java | 36 ++-- .../DeleteProcessDefinitionTest.java | 58 +++--- .../HistoryTimeToLiveDeploymentTest.java | 2 +- .../ProcessDefinitionQueryTest.java | 53 +++--- .../runtime/CorrelateAllMessageBatchTest.java | 83 ++++----- .../runtime/CreateAndResolveIncidentTest.java | 10 +- .../runtime/IncidentUserOperationLogTest.java | 16 +- ...essInstanceModificationSubProcessTest.java | 14 +- .../runtime/ProcessInstanceQueryOrTest.java | 4 +- .../api/runtime/ProcessInstanceQueryTest.java | 64 ++----- ...ssInstanceTerminationCascadeStateTest.java | 2 +- .../api/runtime/RootProcessInstanceTest.java | 4 +- .../RuntimeServiceAsyncOperationsTest.java | 39 ++-- .../test/api/runtime/RuntimeServiceTest.java | 2 +- .../api/runtime/SetVariablesBatchTest.java | 34 ++-- .../api/runtime/TransientVariableTest.java | 4 +- .../message/MessageCorrelationTest.java | 6 +- .../migration/MigrationUserTaskTest.java | 54 +++--- .../api/task/TaskQueryExpressionTest.java | 2 +- .../engine/test/api/task/TaskQueryTest.java | 68 ++----- .../AbstractVariableIgnoreCaseTest.java | 2 +- ...eExecutionQueryVariableIgnoreCaseTest.java | 2 +- ...OperatonFormDefinitionStrictParseTest.java | 4 +- .../bpmn/callactivity/CallActivityTest.java | 4 +- .../bpmn/deployment/BpmnDeploymentTest.java | 68 ++++--- ...pensationEventParseInvalidProcessTest.java | 2 +- ...BoundaryTimerNonInterruptingEventTest.java | 4 +- .../UpdateDuedateOnRecurringTimerTest.java | 8 +- .../bpmn/external/ExternalTaskParseTest.java | 2 +- .../EventBasedGatewayInputOutputTest.java | 4 +- .../bpmn/gateway/InclusiveGatewayTest.java | 4 +- .../MultiInstanceVariablesTest.java | 4 +- .../TaskListenerDelegateCompletionTest.java | 2 +- .../TaskListenerEventLifecycleTest.java | 52 +++--- .../bpmn/tasklistener/TaskListenerTest.java | 8 +- .../concurrency/ConcurrentDeploymentTest.java | 2 +- .../ConcurrentJobExecutorTest.java | 2 +- .../DeleteProcessDefinitionTest.java | 8 +- .../DmnBusinessRuleTaskResultMappingTest.java | 2 +- .../deployment/DecisionDefinitionTest.java | 4 +- .../OperatonFormDefinitionDeploymentTest.java | 4 +- .../CompositeHistoryEventHandlerTest.java | 2 +- .../history/HistoricActivityInstanceTest.java | 2 +- ...storicCaseActivityStatisticsQueryTest.java | 2 +- .../HistoricExternalTaskLogQueryTest.java | 35 ++-- .../test/history/HistoricJobLogQueryTest.java | 56 ++---- .../test/history/HistoricJobLogTest.java | 50 ++--- .../HistoricProcessInstanceQueryOrTest.java | 4 +- .../HistoricProcessInstanceStateTest.java | 24 +-- .../history/HistoricProcessInstanceTest.java | 74 +++----- .../history/MetricsManagerForCleanupTest.java | 2 +- .../engine/test/history/PartitioningTest.java | 16 +- .../HistoricDecisionInstanceQueryTest.java | 74 ++++---- .../dmn/HistoricDecisionInstanceTest.java | 48 ++--- .../UserOperationLogAnnotationTest.java | 4 +- .../jobexecutor/AcquireJobCmdUnitTest.java | 10 +- .../BatchJobPriorityRangeTest.java | 2 +- .../HistoryCleanupJobPriorityRangeTest.java | 2 +- .../jobexecutor/JobExceptionLoggingTest.java | 34 ++-- ...ecutorAcquireJobsForPriorityRangeTest.java | 8 +- .../ReducedJobExceptionLoggingTest.java | 4 +- .../ProcessDataLoggingContextTest.java | 18 +- .../authentication/LoginAttemptsTest.java | 2 +- .../test/standalone/db/SchemaLogTestCase.java | 22 +-- .../standalone/deploy/DeploymentTest.java | 4 +- .../history/AbstractHistoryLevelTest.java | 8 +- .../HistoricTaskInstanceQueryOrTest.java | 10 +- .../HistoricTaskInstanceQueryTest.java | 2 +- .../identity/DefaultPasswordPolicyTest.java | 36 ++-- .../operaton/bpm/model/bpmn/BpmnDiTest.java | 3 +- .../bpm/model/bpmn/DataObjectsTest.java | 2 +- .../operaton/bpm/model/bpmn/ModelTest.java | 2 +- .../model/bpmn/OperatonExtensionsTest.java | 107 ++--------- .../operaton/bpm/model/bpmn/QueryTest.java | 4 +- .../bpm/model/bpmn/ResourceRolesTest.java | 6 +- .../bpmn/builder/ProcessBuilderTest.java | 168 ++++------------- .../instance/operaton/CompatabilityTest.java | 12 +- .../bpmn/validation/ValidateProcessTest.java | 4 +- .../AbstractModelElementInstanceTest.java | 2 +- .../testmodel/instance/AlternativeNsTest.java | 18 +- .../testmodel/instance/UnknownAnimalTest.java | 2 +- .../child/ChildElementCollectionTest.java | 2 +- .../xml/type/reference/ReferenceTest.java | 2 +- .../xml/validation/ModelValidationTest.java | 23 +-- .../functional/spin/FeelEngineIT.java | 14 +- .../optimize/OptimizeApiPageSizeTest.java | 2 +- .../scenarios7170/pvm/AsyncJoinTest.java | 4 +- .../SetRemovalTimeToProcessInstanceTest.java | 2 +- .../config/OperatonEngineConfigFileTest.java | 18 +- ...OperatonEngineConfigurationConfigTest.java | 19 +- .../OperatonEngineJobExecutorConfigTest.java | 11 +- ...onEngineProgrammaticAndConfigFileTest.java | 18 +- .../test/id/ConfigureDbIdGeneratorTest.java | 21 +-- .../TransactionIntegrationTest.java | 6 +- .../spin/impl/util/RewindableReaderTest.java | 8 +- .../operaton/spin/json/JsonTestConstants.java | 2 +- .../tree/JsonTreeEditListPropertyTest.java | 2 +- .../json/tree/JsonTreeJsonPathScriptTest.java | 12 +- .../spin/json/tree/JsonTreeJsonPathTest.java | 22 +-- .../tree/JsonTreeMapJsonToJavaScriptTest.java | 2 +- .../json/tree/JsonTreeMapJsonToJavaTest.java | 2 +- .../tree/JsonTreeReadPropertyScriptTest.java | 2 +- .../json/tree/JsonTreeReadPropertyTest.java | 14 +- .../format/DomXmlDataFormatWriterTest.java | 26 +-- .../operaton/spin/xml/XmlTestConstants.java | 2 +- .../spin/xml/dom/XmlDomAttributeTest.java | 16 +- .../spin/xml/dom/XmlDomXPathScriptTest.java | 2 +- .../spin/xml/dom/XmlDomXPathTest.java | 2 +- ...icAuthAndInterceptorConfigurationTest.java | 2 +- .../client/ClientConfigurationTest.java | 6 +- .../starter/it/ClientAutoConfigurationIT.java | 2 +- .../spring/client/CustomClientTest.java | 2 +- ...ginesAppPathOperatonIndexRedirectTest.java | 13 +- ...dingProcessEnginesAppPathOperatonTest.java | 13 +- ...ssEnginesAppPathRootIndexRedirectTest.java | 16 +- ...DefaultProcessEngineConfigurationTest.java | 12 +- .../property/JobExecutorPropertiesTest.java | 4 +- .../starter/property/WebappPropertyTest.java | 2 +- .../cockpit/plugin/base/PluginQueryTest.java | 2 +- .../base/ProcessDefinitionResourceTest.java | 10 +- .../base/ProcessInstanceRestServiceTest.java | 8 +- ...ssDefinitionResourceAuthorizationTest.java | 2 +- ...efinitionRestServiceAuthorizationTest.java | 2 +- ...essInstanceRestServiceTenantCheckTest.java | 2 +- ...UserAuthenticationResourceLoggingTest.java | 10 +- .../filter/headersec/XssProtectionTest.java | 14 +- .../AbstractAppPluginRootResourceTest.java | 12 +- 290 files changed, 2071 insertions(+), 2600 deletions(-) diff --git a/clients/java/client/src/it/java/org/operaton/bpm/client/client/ClientIT.java b/clients/java/client/src/it/java/org/operaton/bpm/client/client/ClientIT.java index f3ee6fb2ecf..b6c7ff3a537 100644 --- a/clients/java/client/src/it/java/org/operaton/bpm/client/client/ClientIT.java +++ b/clients/java/client/src/it/java/org/operaton/bpm/client/client/ClientIT.java @@ -666,7 +666,7 @@ public long calculateBackoffTime() { // then EngineException exception = (EngineException) ex.get(); assertThat(exception).isInstanceOf(EngineException.class); - assertThat(exception.getCode()).isEqualTo(0); + assertThat(exception.getCode()).isZero(); assertThat(exception.getType()).isEqualTo("ProcessEngineException"); assertThat(exception.getMessage()).isEqualTo("TASK/CLIENT-03009 Exception while fetching and locking task: Object values cannot be used to query"); assertThat(exception.getHttpStatusCode()).isEqualTo(500); diff --git a/clients/java/client/src/it/java/org/operaton/bpm/client/topic/TopicSubscriptionIT.java b/clients/java/client/src/it/java/org/operaton/bpm/client/topic/TopicSubscriptionIT.java index 7fbb3bc37a6..5cee8c7dd47 100644 --- a/clients/java/client/src/it/java/org/operaton/bpm/client/topic/TopicSubscriptionIT.java +++ b/clients/java/client/src/it/java/org/operaton/bpm/client/topic/TopicSubscriptionIT.java @@ -37,13 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.operaton.bpm.client.util.ProcessModels.BPMN_ERROR_EXTERNAL_TASK_PROCESS; -import static org.operaton.bpm.client.util.ProcessModels.EXTERNAL_TASK_TOPIC_FOO; -import static org.operaton.bpm.client.util.ProcessModels.ONE_EXTERNAL_TASK_WITH_OUTPUT_PARAM_PROCESS; -import static org.operaton.bpm.client.util.ProcessModels.ONE_EXTERNAL_TASK_WITH_VERSION_TAG; -import static org.operaton.bpm.client.util.ProcessModels.PROCESS_DEFINITION_VERSION_TAG; -import static org.operaton.bpm.client.util.ProcessModels.PROCESS_KEY; -import static org.operaton.bpm.client.util.ProcessModels.PROCESS_KEY_2; +import static org.operaton.bpm.client.util.ProcessModels.*; /** * @author Tassilo Weidner @@ -140,7 +134,7 @@ public void shouldFilterByProcessDefinitionId() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(1); + assertThat(handler.getHandledTasks()).hasSize(1); ExternalTask task = handler.getHandledTasks().get(0); assertThat(task.getProcessDefinitionId()).isEqualTo(processDefinitionId2); assertThat(topicSubscription.getProcessDefinitionId()).isEqualTo(processDefinitionId2); @@ -185,7 +179,7 @@ public void shouldFilterByProcessDefinitionIdIn() { clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); List handledTasks = handler.getHandledTasks(); - assertThat(handledTasks.size()).isEqualTo(2); + assertThat(handledTasks).hasSize(2); } @Test @@ -203,7 +197,7 @@ public void shouldFilterByProcessDefinitionKey() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(1); + assertThat(handler.getHandledTasks()).hasSize(1); ExternalTask task = handler.getHandledTasks().get(0); assertThat(task.getProcessDefinitionKey()).isEqualTo(PROCESS_KEY_2); assertThat(topicSubscription.getProcessDefinitionKey()).isEqualTo(PROCESS_KEY_2); @@ -245,7 +239,7 @@ public void shouldFilterByProcessDefinitionKeyIn() { clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); List handledTasks = handler.getHandledTasks(); - assertThat(handledTasks.size()).isEqualTo(2); + assertThat(handledTasks).hasSize(2); } @Test @@ -265,7 +259,7 @@ public void shouldFilterByProcessDefinitionVersionTag() { clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); List handledTasks = handler.getHandledTasks(); - assertThat(handledTasks.size()).isEqualTo(1); + assertThat(handledTasks).hasSize(1); assertThat(handledTasks.get(0).getProcessDefinitionKey()).isEqualTo(PROCESS_DEFINITION_VERSION_TAG); assertThat(handledTasks.get(0).getProcessDefinitionVersionTag()).isEqualTo(PROCESS_DEFINITION_VERSION_TAG); } @@ -286,7 +280,7 @@ public void shouldSetProcessDefinitionVersionTag() { clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); List handledTasks = handler.getHandledTasks(); - assertThat(handledTasks.size()).isEqualTo(2); + assertThat(handledTasks).hasSize(2); assertThat(handledTasks.get(0).getProcessDefinitionVersionTag()).isEqualTo(null); assertThat(handledTasks.get(1).getProcessDefinitionVersionTag()).isEqualTo(PROCESS_DEFINITION_VERSION_TAG); } @@ -305,7 +299,7 @@ public void shouldFilterByNoTenantId() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(1); + assertThat(handler.getHandledTasks()).hasSize(1); } @Test @@ -324,7 +318,7 @@ public void shouldNotApplyAnyFilter() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(2); + assertThat(handler.getHandledTasks()).hasSize(2); } @Test @@ -344,7 +338,7 @@ public void shouldFilterWithoutTenantId() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(1); + assertThat(handler.getHandledTasks()).hasSize(1); ExternalTask task = handler.getHandledTasks().get(0); assertThat(task.getTenantId()).isNull(); assertThat(task.getProcessInstanceId()).isEqualTo(processInstance.getId()); @@ -368,7 +362,7 @@ public void shouldFilterByTenantId() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(1); + assertThat(handler.getHandledTasks()).hasSize(1); ExternalTask task = handler.getHandledTasks().get(0); assertThat(task.getTenantId()).isEqualTo(tenantId); assertThat(task.getProcessInstanceId()).isEqualTo(processInstance.getId()); @@ -391,20 +385,20 @@ public void shouldFilterByBusinessKeyAndVariable() { // then clientRule.waitForFetchAndLockUntil(() -> handler.getHandledTasks().size() == 2); - assertThat(topicSubscription.getVariableNames().size()).isEqualTo(1); + assertThat(topicSubscription.getVariableNames()).hasSize(1); assertThat(topicSubscription.getVariableNames().get(0)).isEqualTo(VARIABLE_NAME); List handledTasks = handler.getHandledTasks(); - assertThat(handledTasks.size()).isEqualTo(2); + assertThat(handledTasks).hasSize(2); ExternalTask task = handledTasks.get(0); assertThat(task.getBusinessKey()).isEqualTo(BUSINESS_KEY); if (task.getVariable(VARIABLE_NAME) != null) { - assertThat(task.getAllVariables().size()).isEqualTo(1); + assertThat(task.getAllVariables()).hasSize(1); assertThat((String) task.getVariable(VARIABLE_NAME)).isEqualTo(VARIABLE_VALUE); } else { - assertThat(task.getAllVariables().size()).isEqualTo(0); + assertThat(task.getAllVariables()).isEmpty(); } } @@ -424,10 +418,10 @@ public void shouldFilterByNotExistingVariable() { clientRule.waitForFetchAndLockUntil(() -> handler.getHandledTasks().size() == 2); ExternalTask taskOne = handler.getHandledTasks().get(0); - assertThat(taskOne.getAllVariables().size()).isEqualTo(0); + assertThat(taskOne.getAllVariables()).isEmpty(); ExternalTask taskTwo = handler.getHandledTasks().get(1); - assertThat(taskTwo.getAllVariables().size()).isEqualTo(0); + assertThat(taskTwo.getAllVariables()).isEmpty(); } @Test @@ -446,10 +440,10 @@ public void shouldFilterByNoVariable() { clientRule.waitForFetchAndLockUntil(() -> handler.getHandledTasks().size() == 2); ExternalTask taskOne = handler.getHandledTasks().get(0); - assertThat(taskOne.getAllVariables().size()).isEqualTo(0); + assertThat(taskOne.getAllVariables()).isEmpty(); ExternalTask taskTwo = handler.getHandledTasks().get(0); - assertThat(taskTwo.getAllVariables().size()).isEqualTo(0); + assertThat(taskTwo.getAllVariables()).isEmpty(); } @Test @@ -562,7 +556,7 @@ public void shouldFilterByOneToOneProcessVariableEquals() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(1); + assertThat(handler.getHandledTasks()).hasSize(1); } @Test @@ -585,7 +579,7 @@ public void shouldFilterByOneToAnyProcessVariableEquals() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(2); + assertThat(handler.getHandledTasks()).hasSize(2); } @Test @@ -609,7 +603,7 @@ public void shouldFilterByManyToAnyProcessVariableEquals() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(2); + assertThat(handler.getHandledTasks()).hasSize(2); } @@ -637,7 +631,7 @@ public void shouldNotFilterByManyToNoneProcessVariableEquals() { // then clientRule.waitForFetchAndLockUntil(() -> handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(0); + assertThat(handler.getHandledTasks()).isEmpty(); } @Test @@ -658,7 +652,7 @@ public void shouldFilterByOneToOneProcessVariablesEqualsIn() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(1); + assertThat(handler.getHandledTasks()).hasSize(1); } @Test @@ -683,7 +677,7 @@ public void shouldFilterByOneToAnyProcessVariablesEqualsIn() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(2); + assertThat(handler.getHandledTasks()).hasSize(2); } @Test @@ -710,7 +704,7 @@ public void shouldFilterByManyToAnyProcessVariablesEqualsIn() { // then clientRule.waitForFetchAndLockUntil(() -> !handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(2); + assertThat(handler.getHandledTasks()).hasSize(2); } @Test @@ -739,7 +733,7 @@ public void shouldNotFilterByManyToNoneProcessVariablesEqualsIn() { // then clientRule.waitForFetchAndLockUntil(() -> handler.getHandledTasks().isEmpty()); - assertThat(handler.getHandledTasks().size()).isEqualTo(0); + assertThat(handler.getHandledTasks()).isEmpty(); } } diff --git a/clients/java/client/src/it/java/org/operaton/bpm/client/variable/FileSerializationIT.java b/clients/java/client/src/it/java/org/operaton/bpm/client/variable/FileSerializationIT.java index 5d00f4b8529..ce38a3d0d53 100644 --- a/clients/java/client/src/it/java/org/operaton/bpm/client/variable/FileSerializationIT.java +++ b/clients/java/client/src/it/java/org/operaton/bpm/client/variable/FileSerializationIT.java @@ -113,7 +113,7 @@ public void shouldGet() { ExternalTask task = handler.getHandledTasks().get(0); // then - assertThat(task.getAllVariables().size()).isEqualTo(1); + assertThat(task.getAllVariables()).hasSize(1); assertThat(IoUtil.inputStreamAsString(task.getVariable(VARIABLE_NAME_FILE))) .isEqualTo(new String(VARIABLE_VALUE_FILE_VALUE)); } @@ -146,7 +146,7 @@ public void shouldGetLocalAndGlobalVariables() { ExternalTask task = handler.getHandledTasks().get(0); // then - assertThat(task.getAllVariables().size()).isEqualTo(2); + assertThat(task.getAllVariables()).hasSize(2); assertThat(IoUtil.inputStreamAsString(task.getVariable(VARIABLE_NAME_FILE))) .isEqualTo(new String(VARIABLE_VALUE_FILE_VALUE)); assertThat(IoUtil.inputStreamAsString(task.getVariable(LOCAL_VARIABLE_NAME_FILE))) @@ -171,7 +171,7 @@ public void shouldGetAll() { ExternalTask task = handler.getHandledTasks().get(0); // then - assertThat(task.getAllVariables().size()).isEqualTo(2); + assertThat(task.getAllVariables()).hasSize(2); assertThat(IoUtil.inputStreamAsString((InputStream) task.getAllVariables().get(VARIABLE_NAME_FILE))) .isEqualTo(new String(VARIABLE_VALUE_FILE_VALUE)); assertThat(IoUtil.inputStreamAsString((InputStream) task.getAllVariables().get(ANOTHER_VARIABLE_NAME_FILE))) @@ -585,7 +585,7 @@ public void shouldFailWhenCompletingWihtDeferredFileValue() { // then List variableInstances = engineRule.getVariablesByProcessInstanceIdAndVariableName(processInstance.getId(), null); - assertThat(variableInstances.size()).isEqualTo(2); + assertThat(variableInstances).hasSize(2); List variableNames = new ArrayList<>(); for (VariableInstanceDto variableInstance : variableInstances) { @@ -626,7 +626,7 @@ public void shouldSet_LoadedFileValue() { // then List variableInstances = engineRule.getVariablesByProcessInstanceIdAndVariableName(processInstance.getId(), null); - assertThat(variableInstances.size()).isEqualTo(3); + assertThat(variableInstances).hasSize(3); List variableNames = new ArrayList<>(); for (VariableInstanceDto variableInstance : variableInstances) { diff --git a/clients/java/client/src/it/java/org/operaton/bpm/client/variable/XmlSerializationIT.java b/clients/java/client/src/it/java/org/operaton/bpm/client/variable/XmlSerializationIT.java index 5f8840fedf0..9b1c097a4ad 100644 --- a/clients/java/client/src/it/java/org/operaton/bpm/client/variable/XmlSerializationIT.java +++ b/clients/java/client/src/it/java/org/operaton/bpm/client/variable/XmlSerializationIT.java @@ -39,12 +39,8 @@ import java.util.Arrays; import java.util.Map; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.fail; -import static org.operaton.bpm.client.util.ProcessModels.EXTERNAL_TASK_TOPIC_BAR; -import static org.operaton.bpm.client.util.ProcessModels.EXTERNAL_TASK_TOPIC_FOO; -import static org.operaton.bpm.client.util.ProcessModels.TWO_EXTERNAL_TASK_PROCESS; +import static org.assertj.core.api.Assertions.*; +import static org.operaton.bpm.client.util.ProcessModels.*; import static org.operaton.bpm.engine.variable.Variables.SerializationDataFormats.XML; import static org.operaton.bpm.engine.variable.type.ValueType.OBJECT; diff --git a/clients/java/client/src/it/java/org/operaton/bpm/client/variable/pa/PaExceptionIT.java b/clients/java/client/src/it/java/org/operaton/bpm/client/variable/pa/PaExceptionIT.java index b6337f0ede3..2564080323e 100644 --- a/clients/java/client/src/it/java/org/operaton/bpm/client/variable/pa/PaExceptionIT.java +++ b/clients/java/client/src/it/java/org/operaton/bpm/client/variable/pa/PaExceptionIT.java @@ -148,7 +148,7 @@ public void shouldThrowNotFoundException() { // then NotFoundException px = (NotFoundException) catchThrowable(() -> service.complete(externalTask)); - assertThat(px.getCode()).isEqualTo(0); + assertThat(px.getCode()).isZero(); assertThat(px.getType()).isEqualTo("RestException"); assertThat(px.getMessage()).isEqualTo("TASK/CLIENT-01008 Exception while completing the external task: External task with id not-existing-id does not exist"); assertThat(px.getHttpStatusCode()).isEqualTo(404); @@ -208,7 +208,7 @@ public void shouldThrowBadRequestException() { // then BadRequestException px = (BadRequestException) catchThrowable(() -> service.complete(externalTask)); assertThat(px).isInstanceOf(BadRequestException.class); - assertThat(px.getCode()).isEqualTo(0); + assertThat(px.getCode()).isZero(); assertThat(px.getType()).isEqualTo("RestException"); assertThat(px.getMessage()).matches("TASK/CLIENT-01007 Exception while completing the external task: " + "External Task ([a-z0-9-]*) cannot be completed by worker 'aWorkerId'. " diff --git a/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialBackoffStrategyTest.java b/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialBackoffStrategyTest.java index f21da705e97..b42edfcd7f9 100644 --- a/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialBackoffStrategyTest.java +++ b/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialBackoffStrategyTest.java @@ -39,7 +39,7 @@ void setup() { void shouldAdvanceBackoffStrategy() { // given long initialWaitingTime = backoffStrategy.calculateBackoffTime(); - assertThat(initialWaitingTime).isEqualTo(0L); + assertThat(initialWaitingTime).isZero(); // when // in consecutive iterations, no external tasks are available @@ -66,14 +66,14 @@ void shouldResetBackoffStrategy() { // then long waitingTime2 = backoffStrategy.calculateBackoffTime(); - assertThat(waitingTime2).isEqualTo(0L); + assertThat(waitingTime2).isZero(); } @Test void shouldCapWaitingTime() { // given long waitingTime = backoffStrategy.calculateBackoffTime(); - assertThat(waitingTime).isEqualTo(0L); + assertThat(waitingTime).isZero(); // when // reach maximum waiting time diff --git a/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialErrorBackoffStrategyTest.java b/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialErrorBackoffStrategyTest.java index 03c0cfff3e6..44469c9dafb 100644 --- a/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialErrorBackoffStrategyTest.java +++ b/clients/java/client/src/test/java/org/operaton/bpm/client/backoff/ExponentialErrorBackoffStrategyTest.java @@ -40,7 +40,7 @@ void setup() { void shouldAdvanceBackoffStrategy() { // given long initialWaitingTime = backoffStrategy.calculateBackoffTime(); - assertThat(initialWaitingTime).isEqualTo(0L); + assertThat(initialWaitingTime).isZero(); // when // in consecutive iterations, an error occurs @@ -71,14 +71,14 @@ void shouldResetBackoffStrategy() { // then long waitingTime2 = backoffStrategy.calculateBackoffTime(); - assertThat(waitingTime2).isEqualTo(0L); + assertThat(waitingTime2).isZero(); } @Test void shouldCapWaitingTime() { // given long waitingTime = backoffStrategy.calculateBackoffTime(); - assertThat(waitingTime).isEqualTo(0L); + assertThat(waitingTime).isZero(); // when // reach maximum waiting time @@ -97,7 +97,7 @@ void shouldCapWaitingTime() { void shouldCapWaitingTime2() { // given long waitingTime = backoffStrategy.calculateBackoffTime(); - assertThat(waitingTime).isEqualTo(0L); + assertThat(waitingTime).isZero(); // when // reach maximum waiting time diff --git a/commons/testing/src/test/java/org/operaton/commons/testing/ProcessEngineLoggingRuleTest.java b/commons/testing/src/test/java/org/operaton/commons/testing/ProcessEngineLoggingRuleTest.java index fd4bb19d90f..614c966a400 100644 --- a/commons/testing/src/test/java/org/operaton/commons/testing/ProcessEngineLoggingRuleTest.java +++ b/commons/testing/src/test/java/org/operaton/commons/testing/ProcessEngineLoggingRuleTest.java @@ -16,16 +16,16 @@ */ package org.operaton.commons.testing; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.spi.ILoggingEvent; +import org.junit.Rule; +import org.junit.Test; +import org.operaton.commons.testing.util.ExampleProcessEngineLogger; import java.util.List; -import org.operaton.commons.testing.util.ExampleProcessEngineLogger; -import org.junit.Rule; -import org.junit.Test; -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.spi.ILoggingEvent; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; @SuppressWarnings("unused") public class ProcessEngineLoggingRuleTest { @@ -136,7 +136,7 @@ public void testTurnOffWatcherWithAnnotation() { assertThat(expectedException.getMessage()).contains(ProcessEngineLoggingRule.NOT_WATCHING_ERROR); testLogLevel(persistenceLog, Level.DEBUG); testLogLevel(processAppLogger, Level.INFO); - assertThat(containerLog.size()).isEqualTo(0); + assertThat(containerLog).isEmpty(); } @Test diff --git a/commons/typed-values/src/test/java/org/operaton/bpm/engine/test/variables/FileValueTypeImplTest.java b/commons/typed-values/src/test/java/org/operaton/bpm/engine/test/variables/FileValueTypeImplTest.java index 2a16d4241db..04f9965f241 100755 --- a/commons/typed-values/src/test/java/org/operaton/bpm/engine/test/variables/FileValueTypeImplTest.java +++ b/commons/typed-values/src/test/java/org/operaton/bpm/engine/test/variables/FileValueTypeImplTest.java @@ -16,9 +16,13 @@ */ package org.operaton.bpm.engine.test.variables; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertThrows; -import static org.junit.jupiter.api.Assertions.fail; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.operaton.bpm.engine.variable.Variables; +import org.operaton.bpm.engine.variable.impl.type.FileValueTypeImpl; +import org.operaton.bpm.engine.variable.value.FileValue; +import org.operaton.bpm.engine.variable.value.TypedValue; +import org.operaton.commons.utils.IoUtil; import java.io.ByteArrayInputStream; import java.io.File; @@ -30,13 +34,10 @@ import java.util.HashMap; import java.util.Map; import java.util.Scanner; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.operaton.bpm.engine.variable.Variables; -import org.operaton.bpm.engine.variable.impl.type.FileValueTypeImpl; -import org.operaton.bpm.engine.variable.value.FileValue; -import org.operaton.bpm.engine.variable.value.TypedValue; -import org.operaton.commons.utils.IoUtil; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.fail; /** * @author Ronny Bräunlich @@ -63,18 +64,18 @@ void shouldNotHaveParent() { @Test void isPrimitiveValue() { - assertThat(type.isPrimitiveValueType()).isEqualTo(true); + assertThat(type.isPrimitiveValueType()).isTrue(); } @Test void isNotAnAbstractType() { - assertThat(type.isAbstract()).isEqualTo(false); + assertThat(type.isAbstract()).isFalse(); } @Test void canNotConvertFromAnyValue() { // we just use null to make sure false is always returned - assertThat(type.canConvertFromTypedValue(null)).isEqualTo(false); + assertThat(type.canConvertFromTypedValue(null)).isFalse(); } @Test diff --git a/commons/utils/src/test/java/org/operaton/commons/utils/IoUtilTest.java b/commons/utils/src/test/java/org/operaton/commons/utils/IoUtilTest.java index 4e181c4016f..2cbbab89754 100644 --- a/commons/utils/src/test/java/org/operaton/commons/utils/IoUtilTest.java +++ b/commons/utils/src/test/java/org/operaton/commons/utils/IoUtilTest.java @@ -16,13 +16,14 @@ */ package org.operaton.commons.utils; +import org.junit.jupiter.api.Test; + import java.io.BufferedReader; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; -import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.fail; @@ -86,7 +87,7 @@ void getFileContentAsStream() { while((line = reader.readLine()) != null) { output.append(line); } - assertThat(output.toString()).isEqualTo("This is a Test!"); + assertThat(output).hasToString("This is a Test!"); } catch(Exception e) { fail("Something went wrong while reading the input stream"); } diff --git a/commons/utils/src/test/java/org/operaton/commons/utils/cache/ConcurrentLruCacheTest.java b/commons/utils/src/test/java/org/operaton/commons/utils/cache/ConcurrentLruCacheTest.java index 5a045b65668..15e378efcb4 100644 --- a/commons/utils/src/test/java/org/operaton/commons/utils/cache/ConcurrentLruCacheTest.java +++ b/commons/utils/src/test/java/org/operaton/commons/utils/cache/ConcurrentLruCacheTest.java @@ -90,7 +90,7 @@ void clearCache() { cache.put("a", "1"); cache.clear(); - assertThat(cache.size()).isEqualTo(0); + assertThat(cache.size()).isZero(); assertThat(cache.get("a")).isNull(); } diff --git a/connect/http-client/src/test/java/org/operaton/connect/httpclient/HttpRequestTest.java b/connect/http-client/src/test/java/org/operaton/connect/httpclient/HttpRequestTest.java index 6e5310f264e..ce46fd07912 100644 --- a/connect/http-client/src/test/java/org/operaton/connect/httpclient/HttpRequestTest.java +++ b/connect/http-client/src/test/java/org/operaton/connect/httpclient/HttpRequestTest.java @@ -16,22 +16,15 @@ */ package org.operaton.connect.httpclient; -import static org.assertj.core.api.Assertions.assertThat; +import org.apache.http.client.methods.*; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.operaton.connect.Connectors; import java.util.HashMap; import java.util.Map; -import org.apache.http.client.methods.HttpDelete; -import org.apache.http.client.methods.HttpGet; -import org.apache.http.client.methods.HttpHead; -import org.apache.http.client.methods.HttpOptions; -import org.apache.http.client.methods.HttpPatch; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.client.methods.HttpPut; -import org.apache.http.client.methods.HttpTrace; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.operaton.connect.Connectors; +import static org.assertj.core.api.Assertions.assertThat; public class HttpRequestTest { diff --git a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyDisabledTest.java b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyDisabledTest.java index 8370459b1d0..fe535fe81c8 100644 --- a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyDisabledTest.java +++ b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyDisabledTest.java @@ -33,6 +33,6 @@ public class DeployChangedOnlyDisabledTest extends AbstractRestTest { @Test public void shouldEnableDeployChangedOnlyOnOperatonRunProperty() { - assertThat(engineConfig.isDeployChangedOnly()).isEqualTo(false); + assertThat(engineConfig.isDeployChangedOnly()).isFalse(); } } \ No newline at end of file diff --git a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyEnabledTest.java b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyEnabledTest.java index 7de14f4fee6..313bdf3ce2f 100644 --- a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyEnabledTest.java +++ b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyEnabledTest.java @@ -33,6 +33,6 @@ public class DeployChangedOnlyEnabledTest extends AbstractRestTest { @Test public void shouldEnableDeployChangedOnlyOnOperatonRunProperty() { - assertThat(engineConfig.isDeployChangedOnly()).isEqualTo(true); + assertThat(engineConfig.isDeployChangedOnly()).isTrue(); } } \ No newline at end of file diff --git a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyUnsetTest.java b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyUnsetTest.java index d11caa969d8..87f6c4b5c67 100644 --- a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyUnsetTest.java +++ b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/deploy/DeployChangedOnlyUnsetTest.java @@ -30,6 +30,6 @@ public class DeployChangedOnlyUnsetTest extends AbstractRestTest { @Test public void shouldEnableDeployChangedOnlyOnOperatonRunProperty() { - assertThat(engineConfig.isDeployChangedOnly()).isEqualTo(true); + assertThat(engineConfig.isDeployChangedOnly()).isTrue(); } } \ No newline at end of file diff --git a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/identity/LdapConfigurationTest.java b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/identity/LdapConfigurationTest.java index fc4a946ef1a..9c64a662141 100644 --- a/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/identity/LdapConfigurationTest.java +++ b/distro/run/core/src/test/java/org/operaton/bpm/run/test/config/identity/LdapConfigurationTest.java @@ -43,7 +43,7 @@ public class LdapConfigurationTest { @Test public void shouldPickUpConfiguration() { - assertThat(props.isEnabled()).isEqualTo(true); + assertThat(props.isEnabled()).isTrue(); assertThat(props.getServerUrl()).isEqualTo(plugin.getServerUrl()); assertThat(props.getManagerDn()).isEqualTo(plugin.getManagerDn()); assertThat(props.getManagerPassword()).isEqualTo(plugin.getManagerPassword()); diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionResultTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionResultTest.java index 9e1b84c484a..88e98bb7231 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionResultTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionResultTest.java @@ -16,22 +16,22 @@ */ package org.operaton.bpm.dmn.engine.api; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - import org.assertj.core.api.Fail; -import org.operaton.bpm.dmn.engine.DmnDecisionResultEntries; +import org.junit.Test; import org.operaton.bpm.dmn.engine.DmnDecisionResult; +import org.operaton.bpm.dmn.engine.DmnDecisionResultEntries; import org.operaton.bpm.dmn.engine.impl.DmnDecisionResultException; import org.operaton.bpm.dmn.engine.test.DecisionResource; import org.operaton.bpm.dmn.engine.test.DmnEngineTest; import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.engine.variable.value.TypedValue; -import org.junit.Test; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; public class DmnDecisionResultTest extends DmnEngineTest { @@ -282,7 +282,7 @@ protected DmnDecisionResult evaluateWithMatchingRules(String... matchingRules) { } protected void assertSingleOutputValue(DmnDecisionResultEntries result) { - assertThat(result.size()).isEqualTo(1); + assertThat(result).hasSize(1); String value = (String) result.get("firstOutput"); assertThat(value).isEqualTo("singleValue"); @@ -298,7 +298,7 @@ protected void assertSingleOutputValue(DmnDecisionResultEntries result) { } protected void assertNoOutputValue(DmnDecisionResultEntries result) { - assertThat(result.size()).isEqualTo(0); + assertThat(result).isEmpty(); String value = (String) result.get("firstOutput"); assertThat(value).isNull(); @@ -314,7 +314,7 @@ protected void assertNoOutputValue(DmnDecisionResultEntries result) { } protected void assertMultipleOutputValues(DmnDecisionResultEntries result) { - assertThat(result.size()).isEqualTo(2); + assertThat(result).hasSize(2); String value = (String) result.get("firstOutput"); assertThat(value).isEqualTo("multipleValues1"); diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionTableResultTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionTableResultTest.java index d8a941a9674..bacc88cf4d7 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionTableResultTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnDecisionTableResultTest.java @@ -16,14 +16,8 @@ */ package org.operaton.bpm.dmn.engine.api; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - import org.assertj.core.api.Fail; +import org.junit.Test; import org.operaton.bpm.dmn.engine.DmnDecisionRuleResult; import org.operaton.bpm.dmn.engine.DmnDecisionTableResult; import org.operaton.bpm.dmn.engine.impl.DmnDecisionResultException; @@ -31,7 +25,13 @@ import org.operaton.bpm.dmn.engine.test.DmnEngineTest; import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.engine.variable.value.TypedValue; -import org.junit.Test; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; public class DmnDecisionTableResultTest extends DmnEngineTest { @@ -281,7 +281,7 @@ protected DmnDecisionTableResult evaluateWithMatchingRules(String... matchingRul } protected void assertSingleOutputValue(DmnDecisionRuleResult decisionRuleResult) { - assertThat(decisionRuleResult.size()).isEqualTo(1); + assertThat(decisionRuleResult).hasSize(1); String value = (String) decisionRuleResult.get("firstOutput"); assertThat(value).isEqualTo("singleValue"); @@ -297,7 +297,7 @@ protected void assertSingleOutputValue(DmnDecisionRuleResult decisionRuleResult) } protected void assertNoOutputValue(DmnDecisionRuleResult decisionRuleResult) { - assertThat(decisionRuleResult.size()).isEqualTo(0); + assertThat(decisionRuleResult).isEmpty(); String value = (String) decisionRuleResult.get("firstOutput"); assertThat(value).isNull(); @@ -313,7 +313,7 @@ protected void assertNoOutputValue(DmnDecisionRuleResult decisionRuleResult) { } protected void assertMultipleOutputValues(DmnDecisionRuleResult decisionRuleResult) { - assertThat(decisionRuleResult.size()).isEqualTo(2); + assertThat(decisionRuleResult).hasSize(2); String value = (String) decisionRuleResult.get("firstOutput"); assertThat(value).isEqualTo("multipleValues1"); diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnEngineMetricCollectorTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnEngineMetricCollectorTest.java index 2354254a260..2b28bdf0c2e 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnEngineMetricCollectorTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/DmnEngineMetricCollectorTest.java @@ -60,13 +60,13 @@ public void clearEngineMetrics() { @Test public void testInitialExecutedDecisionElementsValue() { - assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L); + assertThat(metricCollector.getExecutedDecisionElements()).isZero(); } @Test @DecisionResource(resource = EXAMPLE_DMN) public void testExecutedDecisionElementsOfDecisionTable() { - assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L); + assertThat(metricCollector.getExecutedDecisionElements()).isZero(); dmnEngine.evaluateDecisionTable(decision, variables); assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(16L); @@ -82,7 +82,7 @@ public void testExecutedDecisionElementsOfDecisionTable() { @Test @DecisionResource(resource = DISH_EXAMPLE_DMN, decisionKey = "Dish") public void testExecutedDecisionElementsOfDrg() { - assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L); + assertThat(metricCollector.getExecutedDecisionElements()).isZero(); VariableMap variableMap = createVariables() .putValue("temperature", 20) @@ -115,19 +115,19 @@ public void testExecutedDecisionElementsOfDecisionLiteralExpression() { @Test @DecisionResource(resource = EXAMPLE_DMN) public void testClearExecutedDecisionElementsValue() { - assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L); + assertThat(metricCollector.getExecutedDecisionElements()).isZero(); dmnEngine.evaluateDecisionTable(decision, variables); assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(16L); assertThat(metricCollector.clearExecutedDecisionElements()).isEqualTo(16L); - assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L); + assertThat(metricCollector.getExecutedDecisionElements()).isZero(); } @Test @DecisionResource(resource = DISH_EXAMPLE_DMN, decisionKey = "Dish") public void testDrdDishDecisionExample() { - assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L); + assertThat(metricCollector.getExecutedDecisionElements()).isZero(); dmnEngine.evaluateDecisionTable(decision, createVariables() .putValue("temperature", 20) @@ -136,7 +136,7 @@ public void testDrdDishDecisionExample() { assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(30L); assertThat(metricCollector.clearExecutedDecisionElements()).isEqualTo(30L); - assertThat(metricCollector.getExecutedDecisionElements()).isEqualTo(0L); + assertThat(metricCollector.getExecutedDecisionElements()).isZero(); } @Test diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/ParseDecisionTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/ParseDecisionTest.java index 8ebdddd6e30..b07664ee17f 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/ParseDecisionTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/api/ParseDecisionTest.java @@ -16,13 +16,8 @@ */ package org.operaton.bpm.dmn.engine.api; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; - -import java.io.InputStream; -import java.util.List; - import org.assertj.core.api.Assertions; +import org.junit.Test; import org.operaton.bpm.dmn.engine.DmnDecision; import org.operaton.bpm.dmn.engine.DmnDecisionRequirementsGraph; import org.operaton.bpm.dmn.engine.impl.transform.DmnTransformException; @@ -32,7 +27,12 @@ import org.operaton.bpm.model.dmn.DmnModelInstance; import org.operaton.bpm.model.xml.ModelException; import org.operaton.commons.utils.IoUtil; -import org.junit.Test; + +import java.io.InputStream; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; public class ParseDecisionTest extends DmnEngineTest { @@ -224,8 +224,8 @@ public void shouldFailIfWrongRequiredDecisionReference() { @Test public void shouldNotFailIfMissingRequiredDecisionAttribute() { List decisions = parseDecisionsFromFile(MISSING_REQUIRED_DECISION_ATTRIBUTE_DMN); - assertThat(decisions.size()).isEqualTo(1); - assertThat(decisions.get(0).getRequiredDecisions().size()).isEqualTo(0); + assertThat(decisions).hasSize(1); + assertThat(decisions.get(0).getRequiredDecisions()).isEmpty(); } @Test diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionEvaluationListenerTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionEvaluationListenerTest.java index 5727fd26538..c3224a7bd85 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionEvaluationListenerTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionEvaluationListenerTest.java @@ -16,21 +16,21 @@ */ package org.operaton.bpm.dmn.engine.delegate; -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.InputStream; -import java.util.Collection; -import java.util.List; -import java.util.Map; - +import org.junit.Before; +import org.junit.Test; import org.operaton.bpm.dmn.engine.DmnDecisionTableResult; import org.operaton.bpm.dmn.engine.DmnEngineConfiguration; import org.operaton.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration; import org.operaton.bpm.dmn.engine.test.DecisionResource; import org.operaton.bpm.dmn.engine.test.DmnEngineTest; import org.operaton.commons.utils.IoUtil; -import org.junit.Before; -import org.junit.Test; + +import java.io.InputStream; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; /** * @@ -92,15 +92,15 @@ public void shouldVerifyRootDecisionResult() { assertThat(decisionResult.getDecision().getKey()).isEqualTo("Dish"); List inputs = decisionResult.getInputs(); - assertThat(inputs.size()).isEqualTo(2); + assertThat(inputs).hasSize(2); assertThat(inputs.get(0).getName()).isEqualTo("Season"); assertThat(inputs.get(0).getValue().getValue()).isEqualTo("Summer"); assertThat(inputs.get(1).getName()).isEqualTo("How many guests"); assertThat(inputs.get(1).getValue().getValue()).isEqualTo(15); - assertThat(decisionResult.getMatchingRules().size()).isEqualTo(1); + assertThat(decisionResult.getMatchingRules()).hasSize(1); Map outputEntries = decisionResult.getMatchingRules().get(0).getOutputEntries(); - assertThat(outputEntries.size()).isEqualTo(1); + assertThat(outputEntries).hasSize(1); assertThat(outputEntries.containsKey("desiredDish")).isTrue(); assertThat(outputEntries.get("desiredDish").getValue().getValue()).isEqualTo("Light salad"); assertThat(decisionResult.getExecutedDecisionElements()).isEqualTo(12L); @@ -116,7 +116,7 @@ public void shouldVerifyRootDecisionResultWithNoMatchingOutput() { DmnDecisionTableEvaluationEvent decisionResult = (DmnDecisionTableEvaluationEvent) listener.getEvaluationEvent().getDecisionResult(); assertThat(decisionResult).isNotNull(); assertThat(decisionResult.getDecisionTable().getKey()).isEqualTo("Dish"); - assertThat(decisionResult.getMatchingRules().size()).isEqualTo(0); + assertThat(decisionResult.getMatchingRules()).isEmpty(); assertThat(decisionResult.getExecutedDecisionElements()).isEqualTo(12L); } @@ -128,26 +128,26 @@ public void shouldVerifyRequiredDecisionResults() { assertThat(listener.getEvaluationEvent()).isNotNull(); Collection requiredDecisions = listener.getEvaluationEvent().getRequiredDecisionResults(); - assertThat(requiredDecisions.size()).isEqualTo(2); + assertThat(requiredDecisions).hasSize(2); DmnDecisionTableEvaluationEvent dmnDecisionTableEvaluationEvent = getDmnDecisionTable(requiredDecisions,"Season"); assertThat(dmnDecisionTableEvaluationEvent).isNotNull(); List inputs = dmnDecisionTableEvaluationEvent.getInputs(); - assertThat(inputs.size()).isEqualTo(1); + assertThat(inputs).hasSize(1); assertThat(inputs.get(0).getName()).isEqualTo("Weather in Celsius"); assertThat(inputs.get(0).getValue().getValue()).isEqualTo(35); List matchingRules = dmnDecisionTableEvaluationEvent.getMatchingRules(); - assertThat(matchingRules.size()).isEqualTo(1); + assertThat(matchingRules).hasSize(1); assertThat(matchingRules.get(0).getOutputEntries().get("season").getValue().getValue()).isEqualTo("Summer"); dmnDecisionTableEvaluationEvent = getDmnDecisionTable(requiredDecisions,"GuestCount"); assertThat(dmnDecisionTableEvaluationEvent).isNotNull(); inputs = dmnDecisionTableEvaluationEvent.getInputs(); - assertThat(inputs.size()).isEqualTo(1); + assertThat(inputs).hasSize(1); assertThat(inputs.get(0).getName()).isEqualTo("Type of day"); assertThat(inputs.get(0).getValue().getValue()).isEqualTo("Weekend"); matchingRules = dmnDecisionTableEvaluationEvent.getMatchingRules(); - assertThat(matchingRules.size()).isEqualTo(1); + assertThat(matchingRules).hasSize(1); assertThat(matchingRules.get(0).getOutputEntries().get("guestCount").getValue().getValue()).isEqualTo(15); } diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionTableEvaluationListenerTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionTableEvaluationListenerTest.java index cdf122c3a10..7ab62aa3acb 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionTableEvaluationListenerTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/delegate/DmnDecisionTableEvaluationListenerTest.java @@ -121,7 +121,7 @@ public void testMatchingRules() { evaluateDecisionTable(true, "bar", "test", "hello"); matchingRules = listener.evaluationEvent.getMatchingRules(); - assertThat(matchingRules).hasSize(0); + assertThat(matchingRules).isEmpty(); evaluateDecisionTable(false, "bar", "test", "hello"); matchingRules = listener.evaluationEvent.getMatchingRules(); @@ -140,7 +140,7 @@ public void testMatchingRules() { assertThat(matchedRule.getOutputEntries()).hasSize(1); matchedRule = matchingRules.get(1); assertThat(matchedRule.getId()).isEqualTo("rule3"); - assertThat(matchedRule.getOutputEntries()).hasSize(0); + assertThat(matchedRule.getOutputEntries()).isEmpty(); matchedRule = matchingRules.get(2); assertThat(matchedRule.getId()).isEqualTo("rule4"); assertThat(matchedRule.getOutputEntries()).hasSize(1); diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/el/ExpressionEvaluationTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/el/ExpressionEvaluationTest.java index fe31051c5eb..d93d712f4ea 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/el/ExpressionEvaluationTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/el/ExpressionEvaluationTest.java @@ -36,7 +36,7 @@ public class ExpressionEvaluationTest extends DmnEngineTest { public void testHasInputVariableName() { DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("inVar", 2)); - assertThat((boolean) decisionResult.getSingleEntry()).isEqualTo(true); + assertThat((boolean) decisionResult.getSingleEntry()).isTrue(); } @Test @@ -44,7 +44,7 @@ public void testHasInputVariableName() { public void testOverrideInputVariableName() { DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("inVar", 2)); - assertThat((boolean) decisionResult.getSingleEntry()).isEqualTo(true); + assertThat((boolean) decisionResult.getSingleEntry()).isTrue(); } @Test @@ -52,7 +52,7 @@ public void testOverrideInputVariableName() { public void testHasVariableContext() { DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("inVar", 3)); - assertThat((boolean) decisionResult.getSingleEntry()).isEqualTo(true); + assertThat((boolean) decisionResult.getSingleEntry()).isTrue(); } @Test @@ -60,7 +60,7 @@ public void testHasVariableContext() { public void testHasInputVariableNameInVariableContext() { DmnDecisionResult decisionResult = dmnEngine.evaluateDecision(decision, Variables.createVariables().putValue("inVar", 3)); - assertThat((boolean) decisionResult.getSingleEntry()).isEqualTo(true); + assertThat((boolean) decisionResult.getSingleEntry()).isTrue(); } } diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/evaluate/DmnDecisionEvaluationTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/evaluate/DmnDecisionEvaluationTest.java index 76b0570bd16..74e3650df17 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/evaluate/DmnDecisionEvaluationTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/evaluate/DmnDecisionEvaluationTest.java @@ -16,23 +16,19 @@ */ package org.operaton.bpm.dmn.engine.evaluate; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.dmn.engine.test.asserts.DmnEngineTestAssertions.assertThat; -import static org.operaton.bpm.engine.variable.Variables.createVariables; - -import java.util.List; -import java.util.Map; - -import org.operaton.bpm.dmn.engine.DmnDecisionRequirementsGraph; -import org.operaton.bpm.dmn.engine.DmnDecisionResult; -import org.operaton.bpm.dmn.engine.DmnDecisionTableResult; -import org.operaton.bpm.dmn.engine.DmnEngineConfiguration; -import org.operaton.bpm.dmn.engine.DmnEngineException; +import org.junit.Test; +import org.operaton.bpm.dmn.engine.*; import org.operaton.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration; import org.operaton.bpm.dmn.engine.impl.DmnEvaluationException; import org.operaton.bpm.dmn.engine.test.DmnEngineTest; import org.operaton.commons.utils.IoUtil; -import org.junit.Test; + +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.bpm.dmn.engine.test.asserts.DmnEngineTestAssertions.assertThat; +import static org.operaton.bpm.engine.variable.Variables.createVariables; public class DmnDecisionEvaluationTest extends DmnEngineTest { @@ -157,7 +153,7 @@ public void shouldEvaluateDecisionWithRequiredDecisionAndNoMatchingRuleInParentD .asVariableContext()); List> resultList = results.getResultList(); - assertThat(resultList.size()).isEqualTo(0); + assertThat(resultList).isEmpty(); } diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformListenerTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformListenerTest.java index a77d36fddb3..ed6116ef614 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformListenerTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformListenerTest.java @@ -87,7 +87,7 @@ public void shouldVerifyDmnDecisionRequirementsGraph() { assertThat(dmnDecisionRequirementsGraph.getName()) .isEqualTo(definitions.getName()) .isEqualTo("Dish"); - assertThat(dmnDecisionRequirementsGraph.getDecisions().size()).isEqualTo(3); + assertThat(dmnDecisionRequirementsGraph.getDecisions()).hasSize(3); assertThat(dmnDecisionRequirementsGraph.getDecision("dish-decision")).isNotNull(); assertThat(dmnDecisionRequirementsGraph.getDecision("season")).isNotNull(); assertThat(dmnDecisionRequirementsGraph.getDecision("guestCount")).isNotNull(); @@ -115,7 +115,7 @@ public void shouldVerifyTransformedDmnDecision() { public void shouldVerifyTransformedDmnDecisions() { dmnEngine.parseDecisionRequirementsGraph(IoUtil.fileAsStream(DRG_EXAMPLE_DMN)); List transformedDecisions = listener.getTransformedDecisions(); - assertThat(transformedDecisions.size()).isEqualTo(3); + assertThat(transformedDecisions).hasSize(3); assertThat(getDmnDecision(transformedDecisions, "dish-decision")).isNotNull(); assertThat(getDmnDecision(transformedDecisions, "season")).isNotNull(); diff --git a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformTest.java b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformTest.java index aa7b46f14ee..92203dc4dc5 100644 --- a/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformTest.java +++ b/engine-dmn/engine/src/test/java/org/operaton/bpm/dmn/engine/transform/DmnTransformTest.java @@ -16,24 +16,11 @@ */ package org.operaton.bpm.dmn.engine.transform; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; - -import java.io.InputStream; -import java.util.Collection; -import java.util.List; - import org.assertj.core.api.Assertions; +import org.junit.Test; import org.operaton.bpm.dmn.engine.DmnDecision; import org.operaton.bpm.dmn.engine.DmnDecisionRequirementsGraph; -import org.operaton.bpm.dmn.engine.impl.DmnDecisionImpl; -import org.operaton.bpm.dmn.engine.impl.DmnDecisionLiteralExpressionImpl; -import org.operaton.bpm.dmn.engine.impl.DmnDecisionTableImpl; -import org.operaton.bpm.dmn.engine.impl.DmnDecisionTableInputImpl; -import org.operaton.bpm.dmn.engine.impl.DmnDecisionTableOutputImpl; -import org.operaton.bpm.dmn.engine.impl.DmnDecisionTableRuleImpl; -import org.operaton.bpm.dmn.engine.impl.DmnExpressionImpl; -import org.operaton.bpm.dmn.engine.impl.DmnVariableImpl; +import org.operaton.bpm.dmn.engine.impl.*; import org.operaton.bpm.dmn.engine.impl.hitpolicy.FirstHitPolicyHandler; import org.operaton.bpm.dmn.engine.impl.hitpolicy.UniqueHitPolicyHandler; import org.operaton.bpm.dmn.engine.impl.transform.DmnTransformException; @@ -42,7 +29,13 @@ import org.operaton.bpm.model.dmn.Dmn; import org.operaton.bpm.model.dmn.DmnModelInstance; import org.operaton.commons.utils.IoUtil; -import org.junit.Test; + +import java.io.InputStream; +import java.util.Collection; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown; public class DmnTransformTest extends DmnEngineTest { @@ -233,18 +226,18 @@ public void shouldParseDecisionWithRequiredDecisions() { assertDecision(buyProductDecision, "buyProduct"); Collection buyProductrequiredDecisions = buyProductDecision.getRequiredDecisions(); - assertThat(buyProductrequiredDecisions.size()).isEqualTo(1); + assertThat(buyProductrequiredDecisions).hasSize(1); DmnDecision buyComputerDecision = getDecision(buyProductrequiredDecisions, "buyComputer"); assertThat(buyComputerDecision).isNotNull(); Collection buyComputerRequiredDecision = buyComputerDecision.getRequiredDecisions(); - assertThat(buyComputerRequiredDecision.size()).isEqualTo(1); + assertThat(buyComputerRequiredDecision).hasSize(1); DmnDecision buyElectronicDecision = getDecision(buyComputerRequiredDecision, "buyElectronic"); assertThat(buyElectronicDecision).isNotNull(); - assertThat(buyElectronicDecision.getRequiredDecisions().size()).isEqualTo(0); + assertThat(buyElectronicDecision.getRequiredDecisions()).isEmpty(); } @Test @@ -257,7 +250,7 @@ public void shouldParseDecisionsWithRequiredDecisions() { DmnDecision buyProductDecision = getDecision(decisions, "buyProduct"); assertThat(buyProductDecision).isNotNull(); Collection requiredProductDecisions = buyProductDecision.getRequiredDecisions(); - assertThat(requiredProductDecisions.size()).isEqualTo(1); + assertThat(requiredProductDecisions).hasSize(1); DmnDecision requiredProductDecision = getDecision(requiredProductDecisions, "buyComputer"); assertThat(requiredProductDecision).isNotNull(); @@ -265,7 +258,7 @@ public void shouldParseDecisionsWithRequiredDecisions() { DmnDecision buyComputerDecision = getDecision(decisions, "buyComputer"); assertThat(buyComputerDecision).isNotNull(); Collection buyComputerRequiredDecisions = buyComputerDecision.getRequiredDecisions(); - assertThat(buyComputerRequiredDecisions.size()).isEqualTo(1); + assertThat(buyComputerRequiredDecisions).hasSize(1); DmnDecision buyComputerRequiredDecision = getDecision(buyComputerRequiredDecisions, "buyElectronic"); assertThat(buyComputerRequiredDecision).isNotNull(); @@ -274,7 +267,7 @@ public void shouldParseDecisionsWithRequiredDecisions() { assertThat(buyElectronicDecision).isNotNull(); Collection buyElectronicRequiredDecisions = buyElectronicDecision.getRequiredDecisions(); - assertThat(buyElectronicRequiredDecisions.size()).isEqualTo(0); + assertThat(buyElectronicRequiredDecisions).isEmpty(); } @Test @@ -283,7 +276,7 @@ public void shouldParseDecisionWithMultipleRequiredDecisions() { DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); DmnDecision decision = dmnEngine.parseDecision("car",modelInstance); Collection requiredDecisions = decision.getRequiredDecisions(); - assertThat(requiredDecisions.size()).isEqualTo(2); + assertThat(requiredDecisions).hasSize(2); DmnDecision carPriceDecision = getDecision(requiredDecisions, "carPrice"); assertThat(carPriceDecision).isNotNull(); @@ -346,7 +339,7 @@ public void shouldNotDetectLoopInMultiLevelDecisionWithMultipleRequiredDecision( DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); List decisions = dmnEngine.parseDecisions(modelInstance); - assertThat(decisions.size()).isEqualTo(8); + assertThat(decisions).hasSize(8); } @Test diff --git a/engine-dmn/feel-scala/src/test/java/org/operaton/bpm/dmn/engine/feel/function/CustomFunctionTest.java b/engine-dmn/feel-scala/src/test/java/org/operaton/bpm/dmn/engine/feel/function/CustomFunctionTest.java index d2ee6422557..3d0fe158f44 100644 --- a/engine-dmn/feel-scala/src/test/java/org/operaton/bpm/dmn/engine/feel/function/CustomFunctionTest.java +++ b/engine-dmn/feel-scala/src/test/java/org/operaton/bpm/dmn/engine/feel/function/CustomFunctionTest.java @@ -16,27 +16,24 @@ */ package org.operaton.bpm.dmn.engine.feel.function; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.entry; - -import java.time.LocalDateTime; -import java.time.ZoneId; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import java.util.Map; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.junit.rules.RuleChain; import org.operaton.bpm.dmn.engine.feel.function.helper.FunctionProvider; import org.operaton.bpm.dmn.engine.feel.function.helper.MyPojo; import org.operaton.bpm.dmn.engine.feel.helper.FeelRule; import org.operaton.bpm.dmn.feel.impl.FeelException; import org.operaton.bpm.dmn.feel.impl.scala.function.CustomFunction; import org.operaton.bpm.dmn.feel.impl.scala.function.builder.CustomFunctionBuilder; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.junit.rules.RuleChain; + +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.entry; public class CustomFunctionTest { diff --git a/engine-plugins/connect-plugin/src/test/java/org/operaton/connect/plugin/ConnectProcessEnginePluginTest.java b/engine-plugins/connect-plugin/src/test/java/org/operaton/connect/plugin/ConnectProcessEnginePluginTest.java index 85608712aa8..d80de8e7de2 100644 --- a/engine-plugins/connect-plugin/src/test/java/org/operaton/connect/plugin/ConnectProcessEnginePluginTest.java +++ b/engine-plugins/connect-plugin/src/test/java/org/operaton/connect/plugin/ConnectProcessEnginePluginTest.java @@ -274,7 +274,7 @@ void connectorBpmnErrorThrownInScriptResourceNoAsyncAfterJobIsCreated() { assertThat(task.getName()).isEqualTo("User Task"); // no job is created - assertThat(managementService.createJobQuery().count()).isEqualTo(0l); + assertThat(managementService.createJobQuery().count()).isZero(); } @Deployment diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapEnableSortControlSupportTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapEnableSortControlSupportTest.java index a324ce3ff4d..eb2f9b76287 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapEnableSortControlSupportTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapEnableSortControlSupportTest.java @@ -67,7 +67,7 @@ public void testOrderByUserFirstNameAsc() { .sorted(Comparator.comparing(User::getFirstName)) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getId()).isEqualTo(manualOrderedUsers.get(i).getId()); @@ -84,7 +84,7 @@ public void testOrderByUserFirstNameDesc() { .sorted(Comparator.comparing(User::getFirstName).reversed()) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getId()).isEqualTo(manualOrderedUsers.get(i).getId()); @@ -104,7 +104,7 @@ public void testOrderByUserLastNameAsc() { .sorted(Comparator.comparing(User::getLastName)) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getLastName()).isEqualTo(manualOrderedUsers.get(i).getLastName()); @@ -121,7 +121,7 @@ public void testOrderByUserLastNameDesc() { .sorted(Comparator.comparing(User::getLastName).reversed()) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getLastName()).isEqualTo(manualOrderedUsers.get(i).getLastName()); @@ -140,7 +140,7 @@ public void testOrderByUserEmailAsc() { .sorted(Comparator.comparing(User::getEmail)) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getId()).isEqualTo(manualOrderedUsers.get(i).getId()); @@ -157,7 +157,7 @@ public void testOrderByUserEmailDesc() { .sorted(Comparator.comparing(User::getEmail).reversed()) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getId()).isEqualTo(manualOrderedUsers.get(i).getId()); @@ -176,7 +176,7 @@ public void testOrderByUserIdAsc() { .sorted(Comparator.comparing(User::getId)) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getId()).isEqualTo(manualOrderedUsers.get(i).getId()); @@ -193,7 +193,7 @@ public void testOrderByUserIdDesc() { .sorted(Comparator.comparing(User::getId).reversed()) .collect(Collectors.toList()); - assertThat(orderedUsers.size()).isEqualTo(manualOrderedUsers.size()); + assertThat(orderedUsers).hasSize(manualOrderedUsers.size()); for (int i = 0; i < orderedUsers.size(); i++) { assertThat(orderedUsers.get(i).getId()).isEqualTo(manualOrderedUsers.get(i).getId()); @@ -212,7 +212,7 @@ public void testOrderByGroupIdAsc() { .sorted(Comparator.comparing(Group::getId)) .collect(Collectors.toList()); - assertThat(orderedGroup.size()).isEqualTo(manualOrderedGroups.size()); + assertThat(orderedGroup).hasSize(manualOrderedGroups.size()); for (int i = 0; i < orderedGroup.size(); i++) { assertThat(orderedGroup.get(i).getId()).isEqualTo(manualOrderedGroups.get(i).getId()); @@ -228,7 +228,7 @@ public void testOrderByGroupIdDesc() { .sorted(Comparator.comparing(Group::getId).reversed()) .collect(Collectors.toList()); - assertThat(orderedGroup.size()).isEqualTo(manualOrderedGroups.size()); + assertThat(orderedGroup).hasSize(manualOrderedGroups.size()); for (int i = 0; i < orderedGroup.size(); i++) { assertThat(orderedGroup.get(i).getId()).isEqualTo(manualOrderedGroups.get(i).getId()); @@ -247,7 +247,7 @@ public void testOrderByGroupNameAsc() { .sorted(Comparator.comparing(Group::getName)) .collect(Collectors.toList()); - assertThat(orderedGroup.size()).isEqualTo(manualOrderedGroups.size()); + assertThat(orderedGroup).hasSize(manualOrderedGroups.size()); for (int i = 0; i < orderedGroup.size(); i++) { assertThat(orderedGroup.get(i).getId()).isEqualTo(manualOrderedGroups.get(i).getId()); @@ -263,7 +263,7 @@ public void testOrderByGroupNameDesc() { .sorted(Comparator.comparing(Group::getName).reversed()) .collect(Collectors.toList()); - assertThat(orderedGroup.size()).isEqualTo(manualOrderedGroups.size()); + assertThat(orderedGroup).hasSize(manualOrderedGroups.size()); for (int i = 0; i < orderedGroup.size(); i++) { assertThat(orderedGroup.get(i).getId()).isEqualTo(manualOrderedGroups.get(i).getId()); diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupLargeQueryTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupLargeQueryTest.java index 85ac8e4c259..538741a4faa 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupLargeQueryTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupLargeQueryTest.java @@ -95,8 +95,8 @@ public void testQueryPaging() { assertThat(query.listPage(85, 1)).hasSize(1); // Verifying odd usages - assertThat(query.listPage(-1, -1)).hasSize(0); - assertThat(query.listPage(86, 2)).hasSize(0); // 86 is the last index with a result + assertThat(query.listPage(-1, -1)).isEmpty(); + assertThat(query.listPage(86, 2)).isEmpty(); // 86 is the last index with a result assertThat(query.listPage(0, 87)).hasSize(86); // there are only 86 groups } diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupQueryTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupQueryTest.java index 5dba23b707d..577524d49cd 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupQueryTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapGroupQueryTest.java @@ -72,7 +72,7 @@ public void testCountGroups() { GroupQuery groupQuery = identityService.createGroupQuery(); // then - assertThat(groupQuery.listPage(0, Integer.MAX_VALUE).size()).isEqualTo(6); + assertThat(groupQuery.listPage(0, Integer.MAX_VALUE)).hasSize(6); assertThat(groupQuery.count()).isEqualTo(6); } @@ -84,7 +84,7 @@ public void testQueryNoFilter() { List groupList = identityService.createGroupQuery().list(); // then - assertThat(groupList.size()).isEqualTo(6); + assertThat(groupList).hasSize(6); } @Test @@ -120,7 +120,7 @@ public void testFilterByGroupIdIn() { List groups = identityService.createGroupQuery().groupIdIn("external", "management").list(); // then - assertThat(groups.size()).isEqualTo(2); + assertThat(groups).hasSize(2); assertThat(groups).extracting("id").containsOnly("external", "management"); } @@ -320,12 +320,12 @@ public void testPaginationWithAuthenticatedUser() { groupNames.add(groups.get(0).getId()); groups = identityService.createGroupQuery().listPage(4, 2); - assertThat(groups).hasSize(0); + assertThat(groups).isEmpty(); identityService.setAuthenticatedUserId("daniel"); groups = identityService.createGroupQuery().listPage(0, 2); - assertThat(groups).hasSize(0); + assertThat(groups).isEmpty(); } finally { processEngineConfiguration.setAuthorizationEnabled(false); diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapQueryToleranceTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapQueryToleranceTest.java index 8d9a081284d..525caf230e2 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapQueryToleranceTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapQueryToleranceTest.java @@ -72,8 +72,8 @@ public void testNotReturnGroupsWithNullId() { // then // groups with id null were not returned - assertThat(groups).hasSize(0); - assertThat(count).isEqualTo(0); + assertThat(groups).isEmpty(); + assertThat(count).isZero(); List filteredLog = loggingRule.getFilteredLog("LDAP-00004 LDAP group query returned a group with id null."); assertThat(filteredLog).hasSize(12); // 2 queries * 6 roles (groupOfNames) } @@ -92,8 +92,8 @@ public void testNotReturnUsersWithNullId() { // then // groups with id null were not returned - assertThat(users).hasSize(0); - assertThat(count).isEqualTo(0); + assertThat(users).isEmpty(); + assertThat(count).isZero(); List filteredLog = loggingRule.getFilteredLog("LDAP-00004 LDAP user query returned a user with id null."); assertThat(filteredLog).hasSize(24); // 2 queries * 12 users } diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserLargeQueryTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserLargeQueryTest.java index 91aa0c41ab3..b9ba8f3d71c 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserLargeQueryTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserLargeQueryTest.java @@ -93,8 +93,8 @@ public void testQueryPaging() { assertThat(query.listPage(91, 1)).hasSize(1); // Verifying odd usages - assertThat(query.listPage(-1, -1)).hasSize(0); - assertThat(query.listPage(92, 2)).hasSize(0); // 92 is the last index with a result + assertThat(query.listPage(-1, -1)).isEmpty(); + assertThat(query.listPage(92, 2)).isEmpty(); // 92 is the last index with a result assertThat(query.listPage(0, 93)).hasSize(92); // there are only 92 groups } diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserQueryTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserQueryTest.java index 089f0e81432..407d85c750a 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserQueryTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/LdapUserQueryTest.java @@ -631,7 +631,7 @@ public void testPaginationWithAuthenticatedUser() { assertThat(users.get(0).getId()).isEqualTo("daniel"); users = identityService.createUserQuery().listPage(2, 2); - assertThat(users).hasSize(0); + assertThat(users).isEmpty(); } finally { processEngineConfiguration.setAuthorizationEnabled(false); diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/ProcessDefinitionQueryWithCustomIdentityProviderTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/ProcessDefinitionQueryWithCustomIdentityProviderTest.java index fa44a046870..4a1d3abc2c3 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/ProcessDefinitionQueryWithCustomIdentityProviderTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/ProcessDefinitionQueryWithCustomIdentityProviderTest.java @@ -65,7 +65,7 @@ public void test_shouldFindNoProcessesForCandidateUser() { // when List processDefinitions = repositoryService.createProcessDefinitionQuery().startableByUser("pepe").list(); // then - assertThat(processDefinitions).hasSize(0); + assertThat(processDefinitions).isEmpty(); } @Test diff --git a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/posix/LdapPosixGroupQueryTest.java b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/posix/LdapPosixGroupQueryTest.java index a4141cdebf2..08d398f9fca 100644 --- a/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/posix/LdapPosixGroupQueryTest.java +++ b/engine-plugins/identity-ldap/src/test/java/org/operaton/bpm/identity/impl/ldap/posix/LdapPosixGroupQueryTest.java @@ -80,7 +80,7 @@ public void shouldFindUserFilterByMemberOfGroupWithoutMember() { List result = identityService.createUserQuery().memberOfGroup("posix-group-without-members").list(); // then - assertThat(result).hasSize(0); + assertThat(result).isEmpty(); } @Test diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseExecutionRestServiceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseExecutionRestServiceInteractionTest.java index 458807b188d..b178a8f2c8f 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseExecutionRestServiceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseExecutionRestServiceInteractionTest.java @@ -3031,7 +3031,7 @@ public void testPostSingleLocalFileVariableOnlyFilename() throws Exception { assertThat(captured.getEncoding()).isNull(); assertThat(captured.getFilename()).isEqualTo(filename); assertThat(captured.getMimeType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); - assertThat(captured.getValue().available()).isEqualTo(0); + assertThat(captured.getValue().available()).isZero(); } @Test diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseInstanceRestServiceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseInstanceRestServiceInteractionTest.java index 4aa796d1aad..b296f9047fc 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseInstanceRestServiceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/CaseInstanceRestServiceInteractionTest.java @@ -1208,7 +1208,7 @@ public void testPostSingleFileVariableOnlyFilename() throws Exception { assertThat(captured.getEncoding()).isNull(); assertThat(captured.getFilename()).isEqualTo(filename); assertThat(captured.getMimeType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); - assertThat(captured.getValue().available()).isEqualTo(0); + assertThat(captured.getValue().available()).isZero(); } @Test diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ExecutionRestServiceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ExecutionRestServiceInteractionTest.java index f96e5a0024b..4d4eea7c511 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ExecutionRestServiceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ExecutionRestServiceInteractionTest.java @@ -16,8 +16,8 @@ */ package org.operaton.bpm.engine.rest; -import static io.restassured.RestAssured.given; -import static org.assertj.core.api.Assertions.assertThat; +import static io.restassured.RestAssured.given; +import static org.assertj.core.api.Assertions.assertThat; import static org.operaton.bpm.engine.rest.helper.MockProvider.EXAMPLE_TASK_ID; import static org.operaton.bpm.engine.rest.util.DateTimeUtils.DATE_FORMAT_WITH_TIMEZONE; import static org.hamcrest.CoreMatchers.equalTo; @@ -85,8 +85,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; import io.restassured.http.ContentType; -import io.restassured.response.Response; - +import io.restassured.response.Response; + public class ExecutionRestServiceInteractionTest extends AbstractRestServiceTest { @ClassRule @@ -745,7 +745,7 @@ public void testGetFileVariableDownloadWithTypeAndEncoding() { .body(is(equalTo(new String(byteContent)))) .when().get(SINGLE_EXECUTION_LOCAL_BINARY_VARIABLE_URL); - String contentType = response.contentType().replaceAll(" ", ""); + String contentType = response.contentType().replaceAll(" ", ""); assertThat(contentType).isEqualTo(ContentType.TEXT + ";charset=" + encoding); } @@ -1403,10 +1403,10 @@ public void testPostSingleLocalFileVariableWithEncodingAndMimeType() { ArgumentCaptor captor = ArgumentCaptor.forClass(FileValue.class); verify(runtimeServiceMock).setVariableLocal(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), captor.capture()); - FileValue captured = captor.getValue(); - assertThat(captured.getEncoding()).isEqualTo(encoding); - assertThat(captured.getFilename()).isEqualTo(filename); - assertThat(captured.getMimeType()).isEqualTo(mimetype); + FileValue captured = captor.getValue(); + assertThat(captured.getEncoding()).isEqualTo(encoding); + assertThat(captured.getFilename()).isEqualTo(filename); + assertThat(captured.getMimeType()).isEqualTo(mimetype); assertThat(IoUtil.readInputStream(captured.getValue(), null)).isEqualTo(value); } @@ -1431,10 +1431,10 @@ public void testPostSingleLocalFileVariableWithMimeType() { ArgumentCaptor captor = ArgumentCaptor.forClass(FileValue.class); verify(runtimeServiceMock).setVariableLocal(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), captor.capture()); - FileValue captured = captor.getValue(); - assertThat(captured.getEncoding()).isNull(); - assertThat(captured.getFilename()).isEqualTo(filename); - assertThat(captured.getMimeType()).isEqualTo(mimetype); + FileValue captured = captor.getValue(); + assertThat(captured.getEncoding()).isNull(); + assertThat(captured.getFilename()).isEqualTo(filename); + assertThat(captured.getMimeType()).isEqualTo(mimetype); assertThat(IoUtil.readInputStream(captured.getValue(), null)).isEqualTo(value); } @@ -1477,11 +1477,11 @@ public void testPostSingleLocalFileVariableOnlyFilename() throws Exception { ArgumentCaptor captor = ArgumentCaptor.forClass(FileValue.class); verify(runtimeServiceMock).setVariableLocal(eq(MockProvider.EXAMPLE_EXECUTION_ID), eq(variableKey), captor.capture()); - FileValue captured = captor.getValue(); - assertThat(captured.getEncoding()).isNull(); - assertThat(captured.getFilename()).isEqualTo(filename); - assertThat(captured.getMimeType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); - assertThat(captured.getValue().available()).isEqualTo(0); + FileValue captured = captor.getValue(); + assertThat(captured.getEncoding()).isNull(); + assertThat(captured.getFilename()).isEqualTo(filename); + assertThat(captured.getMimeType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); + assertThat(captured.getValue().available()).isZero(); } @Test diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java index fc30ed4d521..81e98c7dc25 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/ProcessInstanceRestServiceInteractionTest.java @@ -2169,7 +2169,7 @@ public void testPostSingleFileVariableOnlyFilename() throws Exception { assertThat(captured.getEncoding()).isNull(); assertThat(captured.getFilename()).isEqualTo(filename); assertThat(captured.getMimeType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); - assertThat(captured.getValue().available()).isEqualTo(0); + assertThat(captured.getValue().available()).isZero(); } @Test diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskRestServiceQueryTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskRestServiceQueryTest.java index a0516402dc0..011a2c1e8f2 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskRestServiceQueryTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskRestServiceQueryTest.java @@ -16,35 +16,15 @@ */ package org.operaton.bpm.engine.rest; -import static io.restassured.RestAssured.given; -import static io.restassured.path.json.JsonPath.from; -import static junit.framework.TestCase.assertEquals; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.rest.util.DateTimeUtils.withTimezone; -import static org.operaton.bpm.engine.rest.util.QueryParamUtils.arrayAsCommaSeperatedList; -import static org.hamcrest.Matchers.equalTo; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyNoMoreInteractions; -import static org.mockito.Mockito.when; -import static org.mockito.hamcrest.MockitoHamcrest.argThat; - -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response.Status; - +import io.restassured.http.ContentType; +import io.restassured.response.Response; +import org.junit.Assert; +import org.junit.Before; +import org.junit.ClassRule; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.InOrder; +import org.mockito.Mockito; import org.operaton.bpm.ProcessApplicationService; import org.operaton.bpm.application.ProcessApplicationInfo; import org.operaton.bpm.container.RuntimeContainerDelegate; @@ -68,16 +48,21 @@ import org.operaton.bpm.engine.task.Task; import org.operaton.bpm.engine.task.TaskQuery; import org.operaton.bpm.engine.variable.type.ValueType; -import org.junit.Assert; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.InOrder; -import org.mockito.Mockito; -import io.restassured.http.ContentType; -import io.restassured.response.Response; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response.Status; +import java.util.*; + +import static io.restassured.RestAssured.given; +import static io.restassured.path.json.JsonPath.from; +import static junit.framework.TestCase.assertEquals; +import static org.assertj.core.api.Assertions.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.*; +import static org.mockito.hamcrest.MockitoHamcrest.argThat; +import static org.operaton.bpm.engine.rest.util.DateTimeUtils.withTimezone; +import static org.operaton.bpm.engine.rest.util.QueryParamUtils.arrayAsCommaSeperatedList; public class TaskRestServiceQueryTest extends AbstractRestServiceTest { @@ -195,7 +180,7 @@ public void testSimpleTaskQuery() { assertThat(MockProvider.EXAMPLE_TASK_LAST_UPDATED).isEqualTo(returnedLastUpdated); assertThat(MockProvider.EXAMPLE_TASK_DUE_DATE).isEqualTo(returnedDueDate); assertThat(MockProvider.EXAMPLE_FOLLOW_UP_DATE).isEqualTo(returnedFollowUpDate); - assertThat(MockProvider.EXAMPLE_TASK_DELEGATION_STATE.toString()).isEqualTo(returnedDelegationState); + assertThat(MockProvider.EXAMPLE_TASK_DELEGATION_STATE).hasToString(returnedDelegationState); assertThat(MockProvider.EXAMPLE_TASK_DESCRIPTION).isEqualTo(returnedDescription); assertThat(MockProvider.EXAMPLE_TASK_EXECUTION_ID).isEqualTo(returnedExecutionId); assertThat(MockProvider.EXAMPLE_TASK_OWNER).isEqualTo(returnedOwner); diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableLocalRestResourceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableLocalRestResourceInteractionTest.java index 7019dfbaedf..dc836f93b34 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableLocalRestResourceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableLocalRestResourceInteractionTest.java @@ -1126,7 +1126,7 @@ public void testPostSingleLocalFileVariableOnlyFilename() throws Exception { assertThat(captured.getEncoding()).isNull(); assertThat(captured.getFilename()).isEqualTo(filename); assertThat(captured.getMimeType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); - assertThat(captured.getValue().available()).isEqualTo(0); + assertThat(captured.getValue().available()).isZero(); } @Test diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableRestResourceInteractionTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableRestResourceInteractionTest.java index fe3596485ad..d2f8f8102f8 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableRestResourceInteractionTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TaskVariableRestResourceInteractionTest.java @@ -1151,7 +1151,7 @@ public void testPostSingleFileVariableOnlyFilename() throws Exception { assertThat(captured.getEncoding()).isNull(); assertThat(captured.getFilename()).isEqualTo(filename); assertThat(captured.getMimeType()).isEqualTo(MediaType.APPLICATION_OCTET_STREAM); - assertThat(captured.getValue().available()).isEqualTo(0); + assertThat(captured.getValue().available()).isZero(); } @Test diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TenantRestServiceQueryTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TenantRestServiceQueryTest.java index 6f1091ec56a..65a24e45a7b 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TenantRestServiceQueryTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/TenantRestServiceQueryTest.java @@ -108,7 +108,7 @@ public void tenantRetrieval() { String content = response.asString(); List instances = from(content).getList(""); - assertThat(instances.size()).isEqualTo(1); + assertThat(instances).hasSize(1); String returnedId = from(content).getString("[0].id"); String returnedName = from(content).getString("[0].name"); diff --git a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/impl/FetchAndLockHandlerTest.java b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/impl/FetchAndLockHandlerTest.java index 3cc36be24e3..0f9d57c78f4 100644 --- a/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/impl/FetchAndLockHandlerTest.java +++ b/engine-rest/engine-rest/src/test/java/org/operaton/bpm/engine/rest/impl/FetchAndLockHandlerTest.java @@ -16,29 +16,15 @@ */ package org.operaton.bpm.engine.rest.impl; -import static org.mockito.ArgumentMatchers.anyBoolean; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyLong; -import static org.mockito.Mockito.doNothing; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.mockito.hamcrest.MockitoHamcrest.argThat; - -import java.util.ArrayList; - -import static org.assertj.core.api.Assertions.assertThat; -import java.util.Collections; -import java.util.Date; -import java.util.List; -import javax.ws.rs.container.AsyncResponse; -import javax.ws.rs.core.Response.Status; +import org.hamcrest.Matchers; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Mock; +import org.mockito.Spy; +import org.mockito.junit.MockitoJUnitRunner; import org.operaton.bpm.engine.ExternalTaskService; import org.operaton.bpm.engine.IdentityService; import org.operaton.bpm.engine.ProcessEngine; @@ -51,16 +37,20 @@ import org.operaton.bpm.engine.rest.exception.InvalidRequestException; import org.operaton.bpm.engine.rest.exception.RestException; import org.operaton.bpm.engine.rest.helper.MockProvider; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.Spy; -import org.mockito.junit.MockitoJUnitRunner; -import org.hamcrest.Matchers; +import javax.ws.rs.container.AsyncResponse; +import javax.ws.rs.core.Response.Status; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.*; +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyLong; +import static org.mockito.Mockito.*; +import static org.mockito.hamcrest.MockitoHamcrest.argThat; /** * @author Tassilo Weidner @@ -145,7 +135,7 @@ public void shouldResumeAsyncResponseDueToAvailableTasks() { // then verify(asyncResponse).resume(argThat(Matchers.hasSize(1))); - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); verify(handler).suspend(Long.MAX_VALUE); } @@ -163,7 +153,7 @@ public void shouldNotResumeAsyncResponseDueToNoAvailableTasks() { // then verify(asyncResponse, never()).resume(any()); - assertThat(handler.getPendingRequests().size()).isEqualTo(1); + assertThat(handler.getPendingRequests()).hasSize(1); verify(handler).suspend(5000L); } @@ -178,7 +168,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExpired_1() { handler.acquire(); // assume - assertThat(handler.getPendingRequests().size()).isEqualTo(1); + assertThat(handler.getPendingRequests()).hasSize(1); verify(handler).suspend(5000L); List tasks = new ArrayList(); @@ -193,7 +183,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExpired_1() { // then verify(asyncResponse).resume(argThat(Matchers.hasSize(1))); - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); verify(handler).suspend(Long.MAX_VALUE); } @@ -210,7 +200,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExpired_2() { handler.acquire(); // assume - assertThat(handler.getPendingRequests().size()).isEqualTo(1); + assertThat(handler.getPendingRequests()).hasSize(1); verify(handler).suspend(4000L); addSecondsToClock(4); @@ -220,7 +210,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExpired_2() { // then verify(asyncResponse).resume(argThat(Matchers.hasSize(0))); - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); verify(handler).suspend(Long.MAX_VALUE); } @@ -238,7 +228,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExpired_3() { handler.acquire(); // assume - assertThat(handler.getPendingRequests().size()).isEqualTo(2); + assertThat(handler.getPendingRequests()).hasSize(2); verify(handler).suspend(3000L); addSecondsToClock(4); @@ -248,7 +238,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExpired_3() { // then verify(asyncResponse, times(2)).resume(Collections.emptyList()); - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); verify(handler).suspend(Long.MAX_VALUE); } @@ -263,7 +253,7 @@ public void shouldResumeAsyncResponseImmediatelyDueToProcessEngineException() { handler.addPendingRequest(createDto(5000L), asyncResponse, processEngine); // Then - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); verify(handler, never()).suspend(anyLong()); verify(asyncResponse).resume(any(ProcessEngineException.class)); } @@ -279,7 +269,7 @@ public void shouldResumeAsyncResponseAfterBackoffDueToProcessEngineException() { handler.acquire(); // assume - assertThat(handler.getPendingRequests().size()).isEqualTo(1); + assertThat(handler.getPendingRequests()).hasSize(1); verify(handler).suspend(5000L); // when @@ -287,7 +277,7 @@ public void shouldResumeAsyncResponseAfterBackoffDueToProcessEngineException() { handler.acquire(); // then - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); verify(handler).suspend(Long.MAX_VALUE); verify(asyncResponse).resume(any(ProcessEngineException.class)); } @@ -297,7 +287,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExceeded() { // given - no pending requests // assume - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); // when AsyncResponse asyncResponse = mock(AsyncResponse.class); @@ -305,7 +295,7 @@ public void shouldResumeAsyncResponseDueToTimeoutExceeded() { // then verify(handler, never()).suspend(anyLong()); - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); ArgumentCaptor argumentCaptor = ArgumentCaptor.forClass(InvalidRequestException.class); verify(asyncResponse).resume(argumentCaptor.capture()); @@ -354,7 +344,7 @@ public void shouldCancelPreviousPendingRequestWhenWorkerIdsEqual() { // then verify(asyncResponse).cancel(); - assertThat(handler.getPendingRequests().size()).isEqualTo(1); + assertThat(handler.getPendingRequests()).hasSize(1); } @Test @@ -375,7 +365,7 @@ public void shouldNotCancelPreviousPendingRequestWhenWorkerIdsDiffer() { // then verify(asyncResponse, never()).cancel(); - assertThat(handler.getPendingRequests().size()).isEqualTo(2); + assertThat(handler.getPendingRequests()).hasSize(2); } @Test @@ -398,13 +388,13 @@ public void shouldSuspendForeverDueToNoPendingRequests() { // given - no pending requests // assume - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); // when handler.acquire(); // then - assertThat(handler.getPendingRequests().size()).isEqualTo(0); + assertThat(handler.getPendingRequests()).isEmpty(); verify(handler).suspend(Long.MAX_VALUE); } @@ -416,7 +406,7 @@ public void shouldRejectRequestDueToShutdown() { handler.acquire(); // assume - assertThat(handler.getPendingRequests().size()).isEqualTo(1); + assertThat(handler.getPendingRequests()).hasSize(1); // when handler.rejectPendingRequests(); diff --git a/engine/src/test/java/org/operaton/bpm/application/impl/embedded/EmbeddedProcessApplicationTest.java b/engine/src/test/java/org/operaton/bpm/application/impl/embedded/EmbeddedProcessApplicationTest.java index c2c9895e925..7aeb3960540 100644 --- a/engine/src/test/java/org/operaton/bpm/application/impl/embedded/EmbeddedProcessApplicationTest.java +++ b/engine/src/test/java/org/operaton/bpm/application/impl/embedded/EmbeddedProcessApplicationTest.java @@ -145,7 +145,7 @@ public void testDeployAppWithoutDmn() { assertThat(loggingRule .getFilteredLog("ENGINE-07018 Unregistering process application for deployment but could " + "not remove process definitions from deployment cache.")) - .hasSize(0); + .isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/container/impl/deployment/jobexecutor/StartManagedThreadPoolStepTest.java b/engine/src/test/java/org/operaton/bpm/container/impl/deployment/jobexecutor/StartManagedThreadPoolStepTest.java index 95efcf3a49c..61304474c47 100644 --- a/engine/src/test/java/org/operaton/bpm/container/impl/deployment/jobexecutor/StartManagedThreadPoolStepTest.java +++ b/engine/src/test/java/org/operaton/bpm/container/impl/deployment/jobexecutor/StartManagedThreadPoolStepTest.java @@ -16,16 +16,9 @@ */ package org.operaton.bpm.container.impl.deployment.jobexecutor; -import static org.assertj.core.api.Assertions.assertThat; - -import javax.management.ObjectName; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; - +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.operaton.bpm.container.impl.RuntimeContainerDelegateImpl; import org.operaton.bpm.container.impl.deployment.Attachments; import org.operaton.bpm.container.impl.jmx.MBeanServiceContainer; @@ -39,9 +32,15 @@ import org.operaton.bpm.container.impl.spi.DeploymentOperationStep; import org.operaton.bpm.container.impl.spi.PlatformService; import org.operaton.bpm.container.impl.spi.ServiceTypes; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; + +import javax.management.ObjectName; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +import static org.assertj.core.api.Assertions.assertThat; /** * @@ -87,7 +86,7 @@ public void performOperationStepWithDefaultProperties() { assertThat(executor.getQueue().remainingCapacity()).isEqualTo(3); assertThat(executor.getCorePoolSize()).isEqualTo(3); assertThat(executor.getMaximumPoolSize()).isEqualTo(10); - assertThat(executor.getKeepAliveTime(TimeUnit.MILLISECONDS)).isEqualTo(0L); + assertThat(executor.getKeepAliveTime(TimeUnit.MILLISECONDS)).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/container/impl/parser/BpmPlatformXmlParserTest.java b/engine/src/test/java/org/operaton/bpm/container/impl/parser/BpmPlatformXmlParserTest.java index a2137f1c7a0..362c14ca933 100644 --- a/engine/src/test/java/org/operaton/bpm/container/impl/parser/BpmPlatformXmlParserTest.java +++ b/engine/src/test/java/org/operaton/bpm/container/impl/parser/BpmPlatformXmlParserTest.java @@ -89,7 +89,7 @@ public void testParseBpmPlatformXmlOneEngine() { JobExecutorXml jobExecutorXml = bpmPlatformXml.getJobExecutor(); assertEquals(1, jobExecutorXml.getJobAcquisitions().size()); - assertThat(jobExecutorXml.getProperties().size()).isEqualTo(2); + assertThat(jobExecutorXml.getProperties()).hasSize(2); JobAcquisitionXml jobAcquisitionXml = jobExecutorXml.getJobAcquisitions().get(0); assertEquals("default", jobAcquisitionXml.getName()); diff --git a/engine/src/test/java/org/operaton/bpm/engine/impl/cfg/CompositeProcessEnginePluginTest.java b/engine/src/test/java/org/operaton/bpm/engine/impl/cfg/CompositeProcessEnginePluginTest.java index 9229e828006..d9de1911638 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/impl/cfg/CompositeProcessEnginePluginTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/impl/cfg/CompositeProcessEnginePluginTest.java @@ -16,17 +16,15 @@ */ package org.operaton.bpm.engine.impl.cfg; -import static org.assertj.core.api.Assertions.assertThat; -import static org.mockito.Mockito.inOrder; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.util.Arrays; - -import org.operaton.bpm.engine.ProcessEngine; import org.junit.Test; import org.mockito.InOrder; import org.mockito.Mockito; +import org.operaton.bpm.engine.ProcessEngine; + +import java.util.Arrays; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.*; public class CompositeProcessEnginePluginTest { @@ -87,7 +85,7 @@ public void allPluginsOnPostProcessEngineBuild() throws Exception { @Test public void verifyToString() throws Exception { - assertThat(new CompositeProcessEnginePlugin(PLUGIN_A, PLUGIN_B).toString()).isEqualTo("CompositeProcessEnginePlugin[PluginA, PluginB]"); + assertThat(new CompositeProcessEnginePlugin(PLUGIN_A, PLUGIN_B)).hasToString("CompositeProcessEnginePlugin[PluginA, PluginB]"); } private static ProcessEnginePlugin processEnginePlugin(final String name) { diff --git a/engine/src/test/java/org/operaton/bpm/engine/impl/test/TestHelperTest.java b/engine/src/test/java/org/operaton/bpm/engine/impl/test/TestHelperTest.java index bc26e975f91..ed00a27c79f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/impl/test/TestHelperTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/impl/test/TestHelperTest.java @@ -26,42 +26,43 @@ public class TestHelperTest { public void shouldGetPublicMethod() throws NoSuchMethodException { // WHEN we call get method to retrieve a method with public accessor, no exception should be thrown Object methodName = TestHelper.getMethod(SomeTestClass.class, "testSomethingWithPublicAccessor", new Class[0]); - assertThat(methodName.toString()).isEqualTo("public void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithPublicAccessor()"); + assertThat(methodName).hasToString("public void org.operaton.bpm.engine.impl.test" + + ".TestHelperTest$SomeTestClass.testSomethingWithPublicAccessor()"); } @Test public void shouldGetPublicMethodFromSuperClass() throws NoSuchMethodException { // WHEN we call get method to retrieve a method with public accessor, no exception should be thrown Object methodName = TestHelper.getMethod(SomeOtherTestClass.class, "testSomethingWithPublicAccessor", new Class[0]); - assertThat(methodName.toString()).isEqualTo("public void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithPublicAccessor()"); + assertThat(methodName).hasToString("public void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithPublicAccessor()"); } @Test public void shouldGetPackagePrivateMethod() throws NoSuchMethodException { // WHEN we call get method to retrieve a method with package private accessor, no exception should be thrown Object methodName = TestHelper.getMethod(SomeTestClass.class, "testSomethingWithPackagePrivateAccessor", new Class[0]); - assertThat(methodName.toString()).isEqualTo("void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithPackagePrivateAccessor()"); + assertThat(methodName).hasToString("void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithPackagePrivateAccessor()"); } @Test public void shouldGetPackagePrivateMethodFromSuperClass() throws NoSuchMethodException { // WHEN we call get method to retrieve a method with package private accessor, no exception should be thrown Object methodName = TestHelper.getMethod(SomeOtherTestClass.class, "testSomethingWithPackagePrivateAccessor", new Class[0]); - assertThat(methodName.toString()).isEqualTo("void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithPackagePrivateAccessor()"); + assertThat(methodName).hasToString("void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithPackagePrivateAccessor()"); } @Test public void shouldGetProtectedMethod() throws NoSuchMethodException { // WHEN we call get method to retrieve a method with protected accessor, no exception should be thrown Object methodName = TestHelper.getMethod(SomeTestClass.class, "testSomethingWithProtected", new Class[0]); - assertThat(methodName.toString()).isEqualTo("protected void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithProtected()"); + assertThat(methodName).hasToString("protected void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithProtected()"); } @Test public void shouldGetProtectedMethodFromSuperClass() throws NoSuchMethodException { // WHEN we call get method to retrieve a method with protected accessor, no exception should be thrown Object methodName = TestHelper.getMethod(SomeOtherTestClass.class, "testSomethingWithProtected", new Class[0]); - assertThat(methodName.toString()).isEqualTo("protected void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithProtected()"); + assertThat(methodName).hasToString("protected void org.operaton.bpm.engine.impl.test.TestHelperTest$SomeTestClass.testSomethingWithProtected()"); } static class SomeTestClass { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/AuthorizationLoggingTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/AuthorizationLoggingTest.java index 384ed6b9ff2..b3d1f9f1611 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/AuthorizationLoggingTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/AuthorizationLoggingTest.java @@ -74,7 +74,7 @@ public void shouldLogOnDebugLevel() { String message = "ENGINE-03110 Required admin authenticated group or user or any of the following permissions:"; List filteredLog = loggingRule.getFilteredLog(CONTEXT_LOGGER, message); - assertThat(filteredLog.size()).isEqualTo(1); + assertThat(filteredLog).hasSize(1); assertThat(filteredLog.get(0).getLevel()).isEqualTo(Level.DEBUG); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/ManagementAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/ManagementAuthorizationTest.java index f44c954ad28..1d4bade5ef4 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/ManagementAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/ManagementAuthorizationTest.java @@ -16,14 +16,8 @@ */ package org.operaton.bpm.engine.test.api.authorization; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; - -import java.util.Collections; -import java.util.List; -import java.util.Map; - +import org.junit.After; +import org.junit.Test; import org.operaton.bpm.engine.authorization.Groups; import org.operaton.bpm.engine.authorization.Resources; import org.operaton.bpm.engine.authorization.SystemPermissions; @@ -34,8 +28,14 @@ import org.operaton.bpm.engine.management.TableMetaData; import org.operaton.bpm.engine.management.TablePage; import org.operaton.bpm.engine.telemetry.TelemetryData; -import org.junit.After; -import org.junit.Test; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.assertEquals; /** @@ -382,7 +382,7 @@ public void shouldSetPropertyAsOperatonAdmin() { // then disableAuthorization(); - assertThat(managementService.getProperties().get(DUMMY_PROPERTY)).isEqualTo(DUMMY_VALUE); + assertThat(managementService.getProperties()).containsEntry(DUMMY_PROPERTY, DUMMY_VALUE); } @Test @@ -395,7 +395,7 @@ public void shouldSetPropertyWithPermission() { // then disableAuthorization(); - assertThat(managementService.getProperties().get(DUMMY_PROPERTY)).isEqualTo(DUMMY_VALUE); + assertThat(managementService.getProperties()).containsEntry(DUMMY_PROPERTY, DUMMY_VALUE); } @Test @@ -409,7 +409,7 @@ public void shouldSetPropertyWithAdminAndPermission() { // then disableAuthorization(); - assertThat(managementService.getProperties().get(DUMMY_PROPERTY)).isEqualTo(DUMMY_VALUE); + assertThat(managementService.getProperties()).containsEntry(DUMMY_PROPERTY, DUMMY_VALUE); } @Test @@ -889,7 +889,7 @@ public void shouldExecuteSchemaLogCountAsOperatonAdmin() { long schemaLog = managementService.createSchemaLogQuery().count(); // then - assertThat(schemaLog).isGreaterThan(0); + assertThat(schemaLog).isPositive(); } @Test @@ -901,7 +901,7 @@ public void shouldExecuteSchemaLogCountWithPermission() { long schemaLog = managementService.createSchemaLogQuery().count(); // then - assertThat(schemaLog).isGreaterThan(0); + assertThat(schemaLog).isPositive(); } @Test @@ -914,7 +914,7 @@ public void shouldExecuteSchemaLogCountWithAdminAndPermission() { long schemaLog = managementService.createSchemaLogQuery().count(); // then - assertThat(schemaLog).isGreaterThan(0); + assertThat(schemaLog).isPositive(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/SchemaLogQueryAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/SchemaLogQueryAuthorizationTest.java index 4439646e2a2..08c993386f8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/SchemaLogQueryAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/SchemaLogQueryAuthorizationTest.java @@ -16,12 +16,12 @@ */ package org.operaton.bpm.engine.test.api.authorization; -import static org.assertj.core.api.Assertions.assertThat; +import org.junit.Test; +import org.operaton.bpm.engine.authorization.Groups; import java.util.Collections; -import org.operaton.bpm.engine.authorization.Groups; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; /** * @author Miklas Boskamp @@ -43,7 +43,7 @@ public void testCountQueryWithAuthorization() { identityService.setAuthentication(userId, Collections.singletonList(Groups.OPERATON_ADMIN)); // then - assertThat(managementService.createSchemaLogQuery().count()).isGreaterThan(0); + assertThat(managementService.createSchemaLogQuery().count()).isPositive(); } @Test @@ -52,6 +52,6 @@ public void testQueryWithAuthorization() { identityService.setAuthentication(userId, Collections.singletonList(Groups.OPERATON_ADMIN)); // then - assertThat(managementService.createSchemaLogQuery().list().size()).isGreaterThan(0); + assertThat(managementService.createSchemaLogQuery().list().size()).isPositive(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteHistoricProcessInstancesBatchAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteHistoricProcessInstancesBatchAuthorizationTest.java index b52d1e161d7..88043be61fb 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteHistoricProcessInstancesBatchAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteHistoricProcessInstancesBatchAuthorizationTest.java @@ -166,7 +166,7 @@ protected void assertScenario() { HistoricBatch historicBatch = engineRule.getHistoryService().createHistoricBatchQuery().list().get(0); assertEquals("userId", historicBatch.getCreateUserId()); } - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); } } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteProcessInstancesBatchAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteProcessInstancesBatchAuthorizationTest.java index b264d548f4d..81318e0e8ee 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteProcessInstancesBatchAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/batch/DeleteProcessInstancesBatchAuthorizationTest.java @@ -164,7 +164,7 @@ protected void assertScenario() { } if (authRule.scenarioSucceeded()) { - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/DeleteHistoricProcessInstancesAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/DeleteHistoricProcessInstancesAuthorizationTest.java index 1a8f562f596..a84ed137f93 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/DeleteHistoricProcessInstancesAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/DeleteHistoricProcessInstancesAuthorizationTest.java @@ -139,7 +139,7 @@ public void testProcessInstancesList() { // then if (authRule.assertScenario(scenario)) { - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); } } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/HistoricDecisionInstanceAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/HistoricDecisionInstanceAuthorizationTest.java index 82d52ea3a2c..2cca50645c2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/HistoricDecisionInstanceAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/history/HistoricDecisionInstanceAuthorizationTest.java @@ -179,7 +179,7 @@ public void testDeleteHistoricDecisionInstanceWithDeleteHistoryPermissionOnDecis // then disableAuthorization(); - assertThat(historyService.createHistoricDecisionInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricDecisionInstanceQuery().count()).isZero(); enableAuthorization(); } @@ -195,7 +195,7 @@ public void testDeleteHistoricDecisionInstanceWithDeleteHistoryPermissionOnAnyDe // then disableAuthorization(); - assertThat(historyService.createHistoricDecisionInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricDecisionInstanceQuery().count()).isZero(); enableAuthorization(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/optimize/OptimizeServiceAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/optimize/OptimizeServiceAuthorizationTest.java index 6326ba2c43c..96748da27bb 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/optimize/OptimizeServiceAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/optimize/OptimizeServiceAuthorizationTest.java @@ -17,34 +17,15 @@ package org.operaton.bpm.engine.test.api.authorization.optimize; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.authorization.Authorization.ANY; -import static org.operaton.bpm.engine.authorization.Permissions.ALL; -import static org.operaton.bpm.engine.authorization.Permissions.READ; -import static org.operaton.bpm.engine.authorization.Permissions.READ_HISTORY; -import static org.operaton.bpm.engine.authorization.Resources.AUTHORIZATION; -import static org.operaton.bpm.engine.authorization.Resources.DECISION_DEFINITION; -import static org.operaton.bpm.engine.authorization.Resources.PROCESS_DEFINITION; -import static org.operaton.bpm.engine.authorization.Resources.TENANT; -import static org.operaton.bpm.engine.authorization.Resources.USER; -import static org.junit.Assert.fail; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Date; -import java.util.List; - +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; import org.operaton.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration; -import org.operaton.bpm.engine.AuthorizationException; -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.DecisionService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RepositoryService; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.impl.OptimizeService; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.operaton.bpm.engine.repository.DecisionDefinition; @@ -62,13 +43,14 @@ import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; + +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; +import static org.operaton.bpm.engine.authorization.Authorization.ANY; +import static org.operaton.bpm.engine.authorization.Permissions.*; +import static org.operaton.bpm.engine.authorization.Resources.*; @RunWith(Parameterized.class) @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @@ -299,7 +281,7 @@ public void canGetDataWithAllAuthorizations() { List instance = methodToTest.apply(optimizeService); // then - assertThat(instance.size()).isGreaterThan(0); + assertThat(instance).isNotEmpty(); } private void generateTestData() { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/task/HandleTaskAuthorizationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/task/HandleTaskAuthorizationTest.java index abd0d7dcdb5..4ae246038a8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/task/HandleTaskAuthorizationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/authorization/task/HandleTaskAuthorizationTest.java @@ -143,8 +143,8 @@ public void testHandleTaskBpmnError() { // then if (authRule.assertScenario(scenario)) { assertNull(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult()); - assertThat(loggingRule.getFilteredLog(BPMN_BEHAVIOR_LOGGER, "Execution is ended (none end event semantics)").size()).isEqualTo(1); - assertThat(loggingRule.getFilteredLog(BPMN_BEHAVIOR_LOGGER, "no catching boundary event was defined").size()).isEqualTo(1); + assertThat(loggingRule.getFilteredLog(BPMN_BEHAVIOR_LOGGER, "Execution is ended (none end event semantics)")).hasSize(1); + assertThat(loggingRule.getFilteredLog(BPMN_BEHAVIOR_LOGGER, "no catching boundary event was defined")).hasSize(1); } } @@ -177,7 +177,7 @@ public void testHandleTaskEscalation() { // then if (authRule.assertScenario(scenario)) { List tasks = taskService.createTaskQuery().list(); - assertThat(tasks.size()).isEqualTo(1); + assertThat(tasks).hasSize(1); assertThat(tasks.get(0).getTaskDefinitionKey()).isEqualTo("after-catch"); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/cfg/DeploymentCacheCfgTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/cfg/DeploymentCacheCfgTest.java index 6993189e653..b2d24a92d44 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/cfg/DeploymentCacheCfgTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/cfg/DeploymentCacheCfgTest.java @@ -301,12 +301,9 @@ public void shouldNotAddIdentityLinksAfterRecache() { ProcessInstance processInstance3 = runtimeService.startProcessInstanceByKey("Process3"); // then - assertThat(repositoryService.getIdentityLinksForProcessDefinition(processInstance1.getProcessDefinitionId()).size()) - .isEqualTo(1); - assertThat(repositoryService.getIdentityLinksForProcessDefinition(processInstance2.getProcessDefinitionId()).size()) - .isEqualTo(1); - assertThat(repositoryService.getIdentityLinksForProcessDefinition(processInstance3.getProcessDefinitionId()).size()) - .isEqualTo(1); + assertThat(repositoryService.getIdentityLinksForProcessDefinition(processInstance1.getProcessDefinitionId())).hasSize(1); + assertThat(repositoryService.getIdentityLinksForProcessDefinition(processInstance2.getProcessDefinitionId())).hasSize(1); + assertThat(repositoryService.getIdentityLinksForProcessDefinition(processInstance3.getProcessDefinitionId())).hasSize(1); } protected List createSequentialCallActivityProcess() { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskQueryByCreateTimeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskQueryByCreateTimeTest.java index 6c940fdcb37..b05c4780eb9 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskQueryByCreateTimeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskQueryByCreateTimeTest.java @@ -107,7 +107,7 @@ public void shouldProduceEventWithCreateTimeValue() { var result = historyService.createHistoricExternalTaskLogQuery().list(); // then - assertThat(result.size()).isEqualTo(1); + assertThat(result).hasSize(1); var historyEventTimestamp = result.get(0).getTimestamp(); @@ -128,7 +128,7 @@ public void shouldReturnTasksInDescOrder() { .list(); // then - assertThat(result.size()).isEqualTo(2); + assertThat(result).hasSize(2); var extTask1 = result.get(0); var extTask2 = result.get(1); @@ -151,7 +151,7 @@ public void shouldReturnTasksInAscOrder() { .list(); // then - assertThat(result.size()).isEqualTo(2); + assertThat(result).hasSize(2); var extTask1 = result.get(0); var extTask2 = result.get(1); @@ -180,7 +180,7 @@ public void shouldReturnTasksInCreateTimeAscOrderOnPriorityEquality() { .list(); // then - assertThat(result.size()).isEqualTo(4); + assertThat(result).hasSize(4); assertThat(result.get(0).getActivityId()).isEqualTo("task1"); assertThat(result.get(1).getActivityId()).isEqualTo("task2"); @@ -206,7 +206,7 @@ public void shouldReturnTasksInCreateTimeDescOrderOnPriorityEquality() { .list(); // then - assertThat(result.size()).isEqualTo(4); + assertThat(result).hasSize(4); assertThat(result.get(0).getActivityId()).isEqualTo("task1"); // due to priority DESC assertThat(result.get(1).getActivityId()).isEqualTo("task2"); @@ -235,7 +235,7 @@ public void shouldReturnTasksInPriorityAscOnCreateTimeEquality() { .list(); // then - assertThat(result.size()).isEqualTo(4); + assertThat(result).hasSize(4); assertThat(result.get(0).getActivityId()).isEqualTo("task2"); // due to CreateTime Equality, priority ASC assertThat(result.get(1).getActivityId()).isEqualTo("task1"); @@ -265,7 +265,7 @@ public void shouldReturnTasksInPriorityDescOnCreateTimeEquality() { .list(); // then - assertThat(result.size()).isEqualTo(4); + assertThat(result).hasSize(4); assertThat(result.get(0).getActivityId()).isEqualTo("task1"); // due to CreateTime equality, priority DESC assertThat(result.get(1).getActivityId()).isEqualTo("task2"); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskServiceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskServiceTest.java index 53dcdad810c..e4e0bc533e2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskServiceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/externaltask/ExternalTaskServiceTest.java @@ -216,13 +216,13 @@ public void shouldFetchWithCreateTimeDESCAndPriority() { .execute(); // then - assertThat(result.size()).isEqualTo(5); + assertThat(result).hasSize(5); assertThat(result.get(0).getPriority()).isEqualTo(7); assertThat(result.get(1).getPriority()).isEqualTo(7); - assertThat(result.get(2).getPriority()).isEqualTo(0); - assertThat(result.get(3).getPriority()).isEqualTo(0); - assertThat(result.get(4).getPriority()).isEqualTo(0); + assertThat(result.get(2).getPriority()).isZero(); + assertThat(result.get(3).getPriority()).isZero(); + assertThat(result.get(4).getPriority()).isZero(); // given the same priority, DESC date is applied @@ -259,14 +259,14 @@ public void shouldFetchWithCreateTimeASCAndPriority() { .execute(); // then - assertThat(result.size()).isEqualTo(5); + assertThat(result).hasSize(5); assertThat(result.get(0).getPriority()).isEqualTo(7); assertThat(result.get(1).getPriority()).isEqualTo(7); - assertThat(result.get(2).getPriority()).isEqualTo(0); - assertThat(result.get(3).getPriority()).isEqualTo(0); - assertThat(result.get(4).getPriority()).isEqualTo(0); + assertThat(result.get(2).getPriority()).isZero(); + assertThat(result.get(3).getPriority()).isZero(); + assertThat(result.get(4).getPriority()).isZero(); // given the same priority, ASC date is applied @@ -303,7 +303,7 @@ public void shouldFetchWithCreateTimeASCWithoutPriority() { .execute(); // then - assertThat(result.size()).isEqualTo(5); + assertThat(result).hasSize(5); assertThat(result).extracting("createTime", Date.class).isSorted(); } @@ -333,7 +333,7 @@ public void shouldFetchWithCreateTimeDESCWithoutPriority() { .execute(); // then - assertThat(result.size()).isEqualTo(5); + assertThat(result).hasSize(5); assertThat(result).extracting("createTime", Date.class).isSortedAccordingTo(reverseOrder()); } @@ -363,7 +363,7 @@ public void shouldIgnoreCreateOrderingWhenCreateTimeIsNotConfigured() { .execute(); // then - assertThat(result.size()).isEqualTo(5); + assertThat(result).hasSize(5); // create time ordering will be ignored, only priority will be used assertThat(result).extracting("priority", Long.class).isSortedAccordingTo(reverseOrder()); } @@ -387,7 +387,7 @@ public void shouldIgnoreCreateTimeConfigWhenOrderIsNull() { .execute(); // then - assertThat(result.size()).isEqualTo(5); + assertThat(result).hasSize(5); // create time ordering will be ignored, only priority will be used assertThat(result).extracting("priority", Long.class).isSortedAccordingTo(reverseOrder()); } @@ -1750,7 +1750,7 @@ public void shouldNotKeepVariablesAfterEvaluateNestedErrorEventDefinitionsOnComp assertThat(tasks).hasSize(1); assertThat(tasks.get(0).getName()).isEqualTo("userTask"); List list = runtimeService.createVariableInstanceQuery().variableName("foo").list(); - assertThat(list).hasSize(0); + assertThat(list).isEmpty(); } @Test @@ -1975,7 +1975,7 @@ public void shouldNotKeepVariablesAfterEvaluateNestedErrorEventDefinitionsOnFail assertThat(tasks).hasSize(1); assertThat(tasks.get(0).getName()).isEqualTo("userTask"); List list = runtimeService.createVariableInstanceQuery().variableName("foo").list(); - assertThat(list).hasSize(0); + assertThat(list).isEmpty(); } @Test @@ -2207,7 +2207,7 @@ public void shouldIgnoreEmptyExpressionInNestedErrorEventDefinitionOnComplete() // then // no error is thrown List tasks = taskService.createTaskQuery().list(); - assertThat(tasks).hasSize(0); + assertThat(tasks).isEmpty(); } @Test @@ -2229,7 +2229,7 @@ public void shouldIgnoreNullExpressionInNestedErrorEventDefinitionOnComplete() { // then // no error is thrown List tasks = taskService.createTaskQuery().list(); - assertThat(tasks).hasSize(0); + assertThat(tasks).isEmpty(); } @Test @@ -4379,7 +4379,7 @@ public void testFetchAndLockByProcessDefinitionVersionTag() { //then assertThat(totalExternalTasks).isEqualTo(2); - assertThat(fetchedExternalTasks.size()).isEqualTo(1); + assertThat(fetchedExternalTasks).hasSize(1); assertThat(fetchedExternalTasks.get(0).getProcessDefinitionKey()).isEqualTo("testFetchAndLockByProcessDefinitionVersionTag"); assertThat(fetchedExternalTasks.get(0).getProcessDefinitionVersionTag()).isEqualTo("version X.Y"); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterPropertiesTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterPropertiesTest.java index 7b28e74447b..e9d6f20915c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterPropertiesTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/filter/FilterPropertiesTest.java @@ -16,26 +16,20 @@ */ package org.operaton.bpm.engine.test.api.filter; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.operaton.bpm.engine.FilterService; import org.operaton.bpm.engine.filter.Filter; import org.operaton.bpm.engine.impl.persistence.entity.FilterEntity; import org.operaton.bpm.engine.test.ProcessEngineRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; + +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.*; /** * @author Sebastian Menski @@ -74,16 +68,16 @@ public void testPropertiesFromNull() { public void testPropertiesInternalFromNull() { // given Filter noPropsFilter = filterService. - newTaskFilter("no props filter") - .setOwner("demo") - .setProperties(null); + newTaskFilter("no props filter") + .setOwner("demo") + .setProperties(null); filterService.saveFilter(noPropsFilter); // when FilterEntity noPropsFilterEntity = (FilterEntity) filterService - .createTaskFilterQuery() - .filterOwner("demo") - .singleResult(); + .createTaskFilterQuery() + .filterOwner("demo") + .singleResult(); // then assertThat(noPropsFilterEntity.getPropertiesInternal()).isEqualTo("{}"); @@ -137,9 +131,8 @@ public void testMapContainingListProperty() { Object string = list.get(0); // then - assertThat(deserialisedProperties.size()).isEqualTo(1); - assertThat(string).isInstanceOf(String.class); - assertThat(string.toString()).isEqualTo("bar"); + assertThat(deserialisedProperties).hasSize(1); + assertThat(string).isInstanceOf(String.class).hasToString("bar"); } @Test @@ -159,8 +152,8 @@ public void testMapContainingMapProperty() { Object string = map.get("bar"); // then - assertThat(deserialisedProperties.size()).isEqualTo(1); - assertThat(string.toString()).isEqualTo("foo"); + assertThat(deserialisedProperties).hasSize(1); + assertThat(string).hasToString("foo"); } @Test @@ -181,8 +174,8 @@ public void testMapContainingMapContainingListProperty() { Object string = list.get(0); // then - assertThat(deserialisedProperties.size()).isEqualTo(1); - assertThat(string.toString()).isEqualTo("foo"); + assertThat(deserialisedProperties).hasSize(1); + assertThat(string).hasToString("foo"); } @Test @@ -211,13 +204,13 @@ public void testMapContainingListContainingMapProperty_DeserializePrimitives() { Map map = (Map) list.get(0); // then - assertThat(deserialisedProperties.size()).isEqualTo(1); - assertThat(map.get("string")).isEqualTo("aStringValue"); - assertThat(map.get("int")).isEqualTo(47); - assertThat(map.get("intOutOfRange")).isEqualTo(Integer.MAX_VALUE + 1L); - assertThat(map.get("long")).isEqualTo(Long.MAX_VALUE); - assertThat(map.get("double")).isEqualTo(3.14159265359D); - assertThat(map.get("boolean")).isEqualTo(true); + assertThat(deserialisedProperties).hasSize(1); + assertThat(map).containsEntry("string", "aStringValue") + .containsEntry("int", 47) + .containsEntry("intOutOfRange", Integer.MAX_VALUE + 1L) + .containsEntry("long", Long.MAX_VALUE) + .containsEntry("double", 3.14159265359D) + .containsEntry("boolean", true); assertThat(map.get("null")).isNull(); } @@ -246,7 +239,7 @@ public void testMapContainingMapContainingListProperty_DeserializePrimitives() { List list = (List) ((Map) deserialisedProperties.get("foo")).get("bar"); // then - assertThat(deserialisedProperties.size()).isEqualTo(1); + assertThat(deserialisedProperties).hasSize(1); assertThat(list.get(0)).isEqualTo("aStringValue"); assertThat(list.get(1)).isEqualTo(47); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/form/FormServiceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/form/FormServiceTest.java index 58f07d03968..2c164c5ef94 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/form/FormServiceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/form/FormServiceTest.java @@ -1675,7 +1675,7 @@ public void shouldSubmitStartFormUsingFormKeyAndOperatonFormDefinition() { // then assertThat(repositoryService.createDeploymentQuery().list()).hasSize(1); assertThat(findAllOperatonFormDefinitionEntities(processEngineConfiguration)).hasSize(1); - assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(0); + assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).isEmpty(); assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(1); } @@ -1694,9 +1694,9 @@ public void shouldSubmitTaskFormUsingFormKeyAndOperatonFormDefinition() { // then assertThat(repositoryService.createDeploymentQuery().list()).hasSize(1); assertThat(findAllOperatonFormDefinitionEntities(processEngineConfiguration)).hasSize(1); - assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(0); + assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).isEmpty(); assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(1); - assertThat(taskService.createTaskQuery().list()).hasSize(0); + assertThat(taskService.createTaskQuery().list()).isEmpty(); } @Deployment(resources = { @@ -1716,7 +1716,7 @@ public void shouldSubmitStartFormUsingFormRefAndOperatonFormDefinition() { assertThat(repositoryService.createDeploymentQuery().list()).hasSize(1); assertThat(engineRule.getProcessEngineConfiguration().getCommandExecutorTxRequired() .execute(new FindOperatonFormDefinitionsCmd())).hasSize(1); - assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(0); + assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).isEmpty(); assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(1); } @@ -1736,8 +1736,8 @@ public void shouldSubmitTaskFormUsingFormRefAndOperatonFormDefinition() { assertThat(repositoryService.createDeploymentQuery().list()).hasSize(1); assertThat(engineRule.getProcessEngineConfiguration().getCommandExecutorTxRequired() .execute(new FindOperatonFormDefinitionsCmd())).hasSize(1); - assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(0); + assertThat(runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).isEmpty(); assertThat(historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).list()).hasSize(1); - assertThat(taskService.createTaskQuery().list()).hasSize(0); + assertThat(taskService.createTaskQuery().list()).isEmpty(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/form/RetrieveOperatonFormRefTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/form/RetrieveOperatonFormRefTest.java index 2f5a80effbd..6a1ce75b7a4 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/form/RetrieveOperatonFormRefTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/form/RetrieveOperatonFormRefTest.java @@ -200,7 +200,7 @@ public void shouldFailToRetrieveTaskFormBindingLatestUnexistingKey() throws IOEx // then assertThat(deployments).hasSize(1); - assertThat(definitions).hasSize(0); + assertThat(definitions).isEmpty(); assertTaskFormData(taskFormData, "myTaskForm", "latest", null); @@ -224,7 +224,7 @@ public void shouldFailToRetrieveTaskFormBindingDeploymentUnexistingKey() throws // then assertThat(deployments).hasSize(1); - assertThat(definitions).hasSize(0); + assertThat(definitions).isEmpty(); assertTaskFormData(taskFormData, "myTaskForm", "deployment", null); @@ -409,7 +409,7 @@ public void shouldFailToRetrieveStartFormBindingLatestUnexistingKey() throws IOE // then assertThat(deployments).hasSize(1); - assertThat(definitions).hasSize(0); + assertThat(definitions).isEmpty(); assertThatThrownBy(() -> { formService.getDeployedStartForm(processDefinition.getId()); @@ -430,7 +430,7 @@ public void shouldFailToRetrieveStartFormBindingDeploymentUnexistingKey() throws // then assertThat(deployments).hasSize(1); - assertThat(definitions).hasSize(0); + assertThat(definitions).isEmpty(); assertThatThrownBy(() -> { formService.getDeployedStartForm(processDefinition.getId()); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoricDecisionInstanceStatisticsQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoricDecisionInstanceStatisticsQueryTest.java index 78df503b553..474146e2edd 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoricDecisionInstanceStatisticsQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoricDecisionInstanceStatisticsQueryTest.java @@ -16,9 +16,10 @@ */ package org.operaton.bpm.engine.test.api.history; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.DecisionService; import org.operaton.bpm.engine.HistoryService; import org.operaton.bpm.engine.ProcessEngineConfiguration; @@ -31,10 +32,9 @@ import org.operaton.bpm.engine.test.util.ProcessEngineTestRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.engine.variable.Variables; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; /** @@ -143,8 +143,8 @@ public void testStatisticForRootDecisionWithFakeInstanceConstraintEvaluation() t .decisionInstanceId(NON_EXISTING); //then - assertThat(query.count()).isEqualTo(0L); - assertThat(query.list()).hasSize(0); + assertThat(query.count()).isZero(); + assertThat(query.list()).isEmpty(); } @@ -231,11 +231,11 @@ public void testStatisticConstrainedToOneDRD() throws Exception { public void testStatisticDoesNotExistForFakeId() throws Exception { assertThat( historyService.createHistoricDecisionInstanceStatisticsQuery( - NON_EXISTING).count()).isEqualTo(0L); + NON_EXISTING).count()).isZero(); assertThat( historyService.createHistoricDecisionInstanceStatisticsQuery( - NON_EXISTING).list().size()).isEqualTo(0); + NON_EXISTING).list()).isEmpty(); } @@ -263,7 +263,7 @@ public void testStatisticForNotEvaluatedDRD() throws Exception { decisionRequirementsDefinition.getId()); //then - assertThat(statisticsQuery.count()).isEqualTo(0L); - assertThat(statisticsQuery.list()).hasSize(0); + assertThat(statisticsQuery.count()).isZero(); + assertThat(statisticsQuery.list()).isEmpty(); } } \ No newline at end of file diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryCleanupTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryCleanupTest.java index 44cea054d02..f1d5b7072c9 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryCleanupTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryCleanupTest.java @@ -1401,7 +1401,7 @@ public void shouldDisableRetriesOnCleanupJob() { Job cleanupJob = historyService.cleanUpHistoryAsync(true); //then - assertThat(cleanupJob.getRetries()).isEqualTo(0); + assertThat(cleanupJob.getRetries()).isZero(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryServiceAsyncOperationsTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryServiceAsyncOperationsTest.java index aeaabb9eb72..54b9a9f5b7a 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryServiceAsyncOperationsTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/HistoryServiceAsyncOperationsTest.java @@ -16,16 +16,6 @@ */ package org.operaton.bpm.engine.test.api.history; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; import org.assertj.core.api.Assertions; import org.hamcrest.CoreMatchers; import org.junit.Assert; @@ -49,6 +39,13 @@ import org.operaton.bpm.engine.test.util.ProcessEngineTestRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; +import java.util.*; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.assertEquals; + /** * @author Askar Akhmerov */ @@ -97,7 +94,7 @@ public void testDeleteHistoryProcessInstancesAsyncWithList() throws Exception { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions.size()).isEqualTo(0); + assertThat(exceptions).isEmpty(); assertNoHistoryForTasks(); assertHistoricBatchExists(testRule); assertAllHistoricProcessInstancesAreDeleted(); @@ -129,20 +126,20 @@ public void testDeleteHistoryProcessInstancesAsyncWithListForDeletedDeployment() // then batch jobs with different deployment ids exist JobQuery batchJobQuery = managementService.createJobQuery().jobDefinitionId(batch.getBatchJobDefinitionId()); List batchJobs = batchJobQuery.list(); - assertThat(batchJobs.size()).isEqualTo(2); + assertThat(batchJobs).hasSize(2); batchJobs.stream().forEach(job -> assertThat(job.getDeploymentId()) .satisfiesAnyOf( arg -> assertThat(arg).isEqualTo(firstDeploymentId), arg -> assertThat(arg).isNull() )); assertThat(batchJobs.get(0).getDeploymentId()).isNotEqualTo(batchJobs.get(1).getDeploymentId()); - assertThat(historicProcessInstances.size()).isEqualTo(4); + assertThat(historicProcessInstances).hasSize(4); assertThat(getHistoricProcessInstanceCountByDeploymentId(firstDeploymentId)).isEqualTo(2L); // when the batch jobs for the first deployment are executed getJobIdsByDeployment(batchJobs, firstDeploymentId).forEach(managementService::executeJob); // then the historic process instances related to the first deployment should be deleted - assertThat(getHistoricProcessInstanceCountByDeploymentId(firstDeploymentId)).isEqualTo(0L); + assertThat(getHistoricProcessInstanceCountByDeploymentId(firstDeploymentId)).isZero(); // and historic process instances related to the second deployment should not be deleted assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(2L); @@ -169,18 +166,18 @@ public void testDeleteHistoryProcessInstancesAsyncWithListInDifferentDeployments executeSeedJobs(batch, 2); // then batch jobs with different deployment ids exist List batchJobs = managementService.createJobQuery().jobDefinitionId(batch.getBatchJobDefinitionId()).list(); - assertThat(batchJobs.size()).isEqualTo(2); + assertThat(batchJobs).hasSize(2); assertThat(batchJobs.get(0).getDeploymentId()).isIn(firstDeploymentId, secondDeploymentId); assertThat(batchJobs.get(1).getDeploymentId()).isIn(firstDeploymentId, secondDeploymentId); assertThat(batchJobs.get(0).getDeploymentId()).isNotEqualTo(batchJobs.get(1).getDeploymentId()); - assertThat(historicProcessInstances.size()).isEqualTo(4); + assertThat(historicProcessInstances).hasSize(4); assertThat(getHistoricProcessInstanceCountByDeploymentId(firstDeploymentId)).isEqualTo(2L); assertThat(getHistoricProcessInstanceCountByDeploymentId(secondDeploymentId)).isEqualTo(2L); // when the batch jobs for the first deployment are executed getJobIdsByDeployment(batchJobs, firstDeploymentId).forEach(managementService::executeJob); // then the historic process instances related to the first deployment should be deleted - assertThat(getHistoricProcessInstanceCountByDeploymentId(firstDeploymentId)).isEqualTo(0L); + assertThat(getHistoricProcessInstanceCountByDeploymentId(firstDeploymentId)).isZero(); // and historic process instances related to the second deployment should not be deleted assertThat(getHistoricProcessInstanceCountByDeploymentId(secondDeploymentId)).isEqualTo(2L); @@ -212,7 +209,7 @@ public void testDeleteHistoryProcessInstancesAsyncWithFake() throws Exception { List exceptions = executeBatchJobs(batch); //then - assertThat(exceptions.size()).isEqualTo(0); + assertThat(exceptions).isEmpty(); assertHistoricBatchExists(testRule); } @@ -229,7 +226,7 @@ public void testDeleteHistoryProcessInstancesAsyncWithQueryAndList() throws Exce List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions.size()).isEqualTo(0); + assertThat(exceptions).isEmpty(); assertNoHistoryForTasks(); assertHistoricBatchExists(testRule); assertAllHistoricProcessInstancesAreDeleted(); @@ -247,7 +244,7 @@ public void testDeleteHistoryProcessInstancesAsyncWithQuery() throws Exception { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions.size()).isEqualTo(0); + assertThat(exceptions).isEmpty(); assertNoHistoryForTasks(); assertHistoricBatchExists(testRule); assertAllHistoricProcessInstancesAreDeleted(); @@ -289,7 +286,7 @@ public void testDeleteHistoryProcessInstancesAsyncWithoutDeleteReason() throws E List exceptions = executeBatchJobs(batch); //then - assertThat(exceptions.size()).isEqualTo(0); + assertThat(exceptions).isEmpty(); assertNoHistoryForTasks(); assertHistoricBatchExists(testRule); assertAllHistoricProcessInstancesAreDeleted(); @@ -347,7 +344,7 @@ protected void assertNoHistoryForTasks() { } protected void assertAllHistoricProcessInstancesAreDeleted() { - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/HistoricRootProcessInstanceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/HistoricRootProcessInstanceTest.java index 70d52b8f8c7..4a7536f0769 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/HistoricRootProcessInstanceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/HistoricRootProcessInstanceTest.java @@ -108,7 +108,7 @@ public void shouldResolveHistoricDecisionInstance() { List historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list(); // assume - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); // then assertThat(historicDecisionInstances.get(0).getRootProcessInstanceId()).isEqualTo(processInstance.getProcessInstanceId()); @@ -357,7 +357,7 @@ public void shouldResolveHistoricDetailByVariableInstanceUpdate() { .list(); // assume - assertThat(historicDetails.size()).isEqualTo(2); + assertThat(historicDetails).hasSize(2); // then assertThat(historicDetails.get(0).getRootProcessInstanceId()).isEqualTo(processInstance.getProcessInstanceId()); @@ -411,7 +411,7 @@ public void shouldResolveIncident() { List historicIncidents = historyService.createHistoricIncidentQuery().list(); // assume - assertThat(historicIncidents.size()).isEqualTo(2); + assertThat(historicIncidents).hasSize(2); // then assertThat(historicIncidents.get(0).getRootProcessInstanceId()).isEqualTo(processInstance.getProcessInstanceId()); @@ -497,7 +497,7 @@ public void shouldResolveJobLog() { List jobLog = historyService.createHistoricJobLogQuery().list(); // assume - assertThat(jobLog.size()).isEqualTo(2); + assertThat(jobLog).hasSize(2); // then assertThat(jobLog.get(0).getRootProcessInstanceId()).isEqualTo(processInstance.getProcessInstanceId()); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/RemovalTimeStrategyStartTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/RemovalTimeStrategyStartTest.java index c0d64d08ab7..87c2e41a46f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/RemovalTimeStrategyStartTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/RemovalTimeStrategyStartTest.java @@ -142,7 +142,7 @@ public void shouldResolveHistoricDecisionInstance() { List historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list(); // assume - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); Date removalTime = addDays(START_DATE, 5); @@ -172,7 +172,7 @@ public void shouldResolveStandaloneHistoricDecisionInstance() { List historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list(); // assume - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); Date removalTime = addDays(START_DATE, 5); @@ -855,7 +855,7 @@ public void shouldResolveHistoricDetailByVariableInstanceUpdate() { .list(); // assume - assertThat(historicDetails.size()).isEqualTo(2); + assertThat(historicDetails).hasSize(2); Date removalTime = addDays(START_DATE, 5); @@ -917,7 +917,7 @@ public void shouldResolveIncident() { List historicIncidents = historyService.createHistoricIncidentQuery().list(); // assume - assertThat(historicIncidents.size()).isEqualTo(2); + assertThat(historicIncidents).hasSize(2); Date removalTime = addDays(START_DATE, 5); @@ -1016,7 +1016,7 @@ public void shouldResolveJobLog() { List jobLog = historyService.createHistoricJobLogQuery().list(); // assume - assertThat(jobLog.size()).isEqualTo(2); + assertThat(jobLog).hasSize(2); Date removalTime = addDays(START_DATE, 5); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeTest.java index d3a8d921f10..6be7df62004 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeTest.java @@ -2621,7 +2621,7 @@ public void shouldSeeCleanableButNotFinishedProcessInstanceInReport() { CleanableHistoricProcessInstanceReportResult report = historyService.createCleanableHistoricProcessInstanceReport().singleResult(); // then - assertThat(report.getFinishedProcessInstanceCount()).isEqualTo(0); + assertThat(report.getFinishedProcessInstanceCount()).isZero(); assertThat(report.getCleanableProcessInstanceCount()).isEqualTo(1); assertThat(report.getHistoryTimeToLive()).isNull(); } @@ -2700,7 +2700,7 @@ public void shouldSeeCleanableButNotFinishedBatchInReport() { CleanableHistoricBatchReportResult report = historyService.createCleanableHistoricBatchReport().singleResult(); // then - assertThat(report.getFinishedBatchesCount()).isEqualTo(0); + assertThat(report.getFinishedBatchesCount()).isZero(); assertThat(report.getCleanableBatchesCount()).isEqualTo(1); assertThat(report.getHistoryTimeToLive()).isNull(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeUserOperationLogTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeUserOperationLogTest.java index b4e0bbad0de..262428a5478 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeUserOperationLogTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/batch/BatchSetRemovalTimeUserOperationLogTest.java @@ -833,7 +833,7 @@ public void shouldWriteUserOperationLogForBatches_AsyncTrue() { // helper //////////////////////////////////////////////////////////////////////////////////////////////////////////// protected void assertProperties(List userOperationLogEntries, String... expectedProperties) { - assertThat(userOperationLogEntries.size()).isEqualTo(expectedProperties.length); + assertThat(userOperationLogEntries).hasSize(expectedProperties.length); assertThat(userOperationLogEntries) .extracting("property", String.class) diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/cleanup/HistoryCleanupRemovalTimeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/cleanup/HistoryCleanupRemovalTimeTest.java index f4f5549b4e6..633136fed48 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/cleanup/HistoryCleanupRemovalTimeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/history/removaltime/cleanup/HistoryCleanupRemovalTimeTest.java @@ -16,35 +16,9 @@ */ package org.operaton.bpm.engine.test.api.history.removaltime.cleanup; -import static org.apache.commons.lang3.time.DateUtils.addDays; -import static org.apache.commons.lang3.time.DateUtils.addMinutes; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.ProcessEngineConfiguration.HISTORY_CLEANUP_STRATEGY_REMOVAL_TIME_BASED; -import static org.operaton.bpm.engine.ProcessEngineConfiguration.HISTORY_FULL; -import static org.operaton.bpm.engine.ProcessEngineConfiguration.HISTORY_REMOVAL_TIME_STRATEGY_END; -import static org.operaton.bpm.engine.ProcessEngineConfiguration.HISTORY_REMOVAL_TIME_STRATEGY_START; -import static org.operaton.bpm.engine.impl.jobexecutor.historycleanup.HistoryCleanupHandler.MAX_BATCH_SIZE; - -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.DecisionService; -import org.operaton.bpm.engine.ExternalTaskService; -import org.operaton.bpm.engine.FormService; -import org.operaton.bpm.engine.HistoryService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.RepositoryService; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.*; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.authorization.AuthorizationQuery; import org.operaton.bpm.engine.authorization.Resources; @@ -52,31 +26,7 @@ import org.operaton.bpm.engine.batch.history.HistoricBatch; import org.operaton.bpm.engine.batch.history.HistoricBatchQuery; import org.operaton.bpm.engine.externaltask.LockedExternalTask; -import org.operaton.bpm.engine.history.CleanableHistoricBatchReportResult; -import org.operaton.bpm.engine.history.CleanableHistoricDecisionInstanceReportResult; -import org.operaton.bpm.engine.history.CleanableHistoricProcessInstanceReportResult; -import org.operaton.bpm.engine.history.HistoricActivityInstance; -import org.operaton.bpm.engine.history.HistoricActivityInstanceQuery; -import org.operaton.bpm.engine.history.HistoricDecisionInstance; -import org.operaton.bpm.engine.history.HistoricDecisionInstanceQuery; -import org.operaton.bpm.engine.history.HistoricDetail; -import org.operaton.bpm.engine.history.HistoricDetailQuery; -import org.operaton.bpm.engine.history.HistoricExternalTaskLog; -import org.operaton.bpm.engine.history.HistoricExternalTaskLogQuery; -import org.operaton.bpm.engine.history.HistoricIdentityLinkLog; -import org.operaton.bpm.engine.history.HistoricIdentityLinkLogQuery; -import org.operaton.bpm.engine.history.HistoricIncident; -import org.operaton.bpm.engine.history.HistoricIncidentQuery; -import org.operaton.bpm.engine.history.HistoricJobLog; -import org.operaton.bpm.engine.history.HistoricJobLogQuery; -import org.operaton.bpm.engine.history.HistoricProcessInstance; -import org.operaton.bpm.engine.history.HistoricProcessInstanceQuery; -import org.operaton.bpm.engine.history.HistoricTaskInstance; -import org.operaton.bpm.engine.history.HistoricTaskInstanceQuery; -import org.operaton.bpm.engine.history.HistoricVariableInstance; -import org.operaton.bpm.engine.history.HistoricVariableInstanceQuery; -import org.operaton.bpm.engine.history.UserOperationLogEntry; -import org.operaton.bpm.engine.history.UserOperationLogQuery; +import org.operaton.bpm.engine.history.*; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.operaton.bpm.engine.impl.history.DefaultHistoryRemovalTimeProvider; import org.operaton.bpm.engine.impl.interceptor.Command; @@ -101,12 +51,16 @@ import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.*; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import static org.apache.commons.lang3.time.DateUtils.addDays; +import static org.apache.commons.lang3.time.DateUtils.addMinutes; +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.bpm.engine.ProcessEngineConfiguration.*; +import static org.operaton.bpm.engine.impl.jobexecutor.historycleanup.HistoryCleanupHandler.MAX_BATCH_SIZE; /** * @author Tassilo Weidner @@ -283,7 +237,7 @@ public void shouldCleanupDecisionInstance() { List historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list(); // assume - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); ClockUtil.setCurrentTime(addDays(END_DATE, 5)); @@ -293,7 +247,7 @@ public void shouldCleanupDecisionInstance() { historicDecisionInstances = historyService.createHistoricDecisionInstanceQuery().list(); // then - assertThat(historicDecisionInstances.size()).isEqualTo(0); + assertThat(historicDecisionInstances).isEmpty(); } @Test @@ -321,7 +275,7 @@ public void shouldCleanupStandaloneDecisionInstance() { .list(); // assume - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); ClockUtil.setCurrentTime(addDays(END_DATE, 6)); @@ -334,7 +288,7 @@ public void shouldCleanupStandaloneDecisionInstance() { .list(); // then - assertThat(historicDecisionInstances.size()).isEqualTo(0); + assertThat(historicDecisionInstances).isEmpty(); } @Test @@ -393,7 +347,7 @@ public void shouldCleanupDecisionInputInstance() { .list(); // assume - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); ClockUtil.setCurrentTime(addDays(END_DATE, 5)); @@ -405,7 +359,7 @@ public void shouldCleanupDecisionInputInstance() { .list(); // then - assertThat(historicDecisionInstances.size()).isEqualTo(0); + assertThat(historicDecisionInstances).isEmpty(); } @Test @@ -432,7 +386,7 @@ public void shouldCleanupDecisionOutputInstance() { .list(); // assume - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); Date removalTime = addDays(END_DATE, 5); ClockUtil.setCurrentTime(removalTime); @@ -445,7 +399,7 @@ public void shouldCleanupDecisionOutputInstance() { .list(); // then - assertThat(historicDecisionInstances.size()).isEqualTo(0); + assertThat(historicDecisionInstances).isEmpty(); } @Test @@ -468,7 +422,7 @@ public void shouldCleanupProcessInstance() { .list(); // assume - assertThat(historicProcessInstances.size()).isEqualTo(1); + assertThat(historicProcessInstances).hasSize(1); Date removalTime = addDays(END_DATE, 5); ClockUtil.setCurrentTime(removalTime); @@ -481,7 +435,7 @@ public void shouldCleanupProcessInstance() { .list(); // then - assertThat(historicProcessInstances.size()).isEqualTo(0); + assertThat(historicProcessInstances).isEmpty(); } @Test @@ -504,7 +458,7 @@ public void shouldNotCleanupProcessInstanceWithoutTTL() { .list(); // assume - assertThat(historicProcessInstances.size()).isEqualTo(1); + assertThat(historicProcessInstances).hasSize(1); Date removalTime = addDays(END_DATE, 5); ClockUtil.setCurrentTime(removalTime); @@ -517,7 +471,7 @@ public void shouldNotCleanupProcessInstanceWithoutTTL() { .list(); // then - assertThat(historicProcessInstances.size()).isEqualTo(1); + assertThat(historicProcessInstances).hasSize(1); } @Test @@ -541,7 +495,7 @@ public void shouldCleanupProcessInstanceWithoutTTLWithConfigDefault() { .list(); // assume - assertThat(historicProcessInstances.size()).isEqualTo(1); + assertThat(historicProcessInstances).hasSize(1); Date removalTime = addDays(END_DATE, 5); ClockUtil.setCurrentTime(removalTime); @@ -554,7 +508,7 @@ public void shouldCleanupProcessInstanceWithoutTTLWithConfigDefault() { .list(); // then - assertThat(historicProcessInstances.size()).isEqualTo(0); + assertThat(historicProcessInstances).isEmpty(); } @Test @@ -603,7 +557,7 @@ public void shouldCleanupActivityInstance() { List historicActivityInstances = historyService.createHistoricActivityInstanceQuery().list(); // assume - assertThat(historicActivityInstances.size()).isEqualTo(6); + assertThat(historicActivityInstances).hasSize(6); ClockUtil.setCurrentTime(addDays(END_DATE, 5)); @@ -613,7 +567,7 @@ public void shouldCleanupActivityInstance() { historicActivityInstances = historyService.createHistoricActivityInstanceQuery().list(); // then - assertThat(historicActivityInstances.size()).isEqualTo(0); + assertThat(historicActivityInstances).isEmpty(); } @Test @@ -634,7 +588,7 @@ public void shouldCleanupTaskInstance() { List historicTaskInstances = historyService.createHistoricTaskInstanceQuery().list(); // assume - assertThat(historicTaskInstances.size()).isEqualTo(1); + assertThat(historicTaskInstances).hasSize(1); ClockUtil.setCurrentTime(addDays(END_DATE, 5)); @@ -644,7 +598,7 @@ public void shouldCleanupTaskInstance() { historicTaskInstances = historyService.createHistoricTaskInstanceQuery().list(); // then - assertThat(historicTaskInstances.size()).isEqualTo(0); + assertThat(historicTaskInstances).isEmpty(); } @Test @@ -673,7 +627,7 @@ public void shouldCleanupTaskInstanceAuthorization() { .list(); // assume - assertThat(authorizations.size()).isEqualTo(1); + assertThat(authorizations).hasSize(1); ClockUtil.setCurrentTime(addDays(END_DATE, 5)); @@ -685,7 +639,7 @@ public void shouldCleanupTaskInstanceAuthorization() { .list(); // then - assertThat(authorizations.size()).isEqualTo(0); + assertThat(authorizations).isEmpty(); // clear clearAuthorization(); @@ -711,7 +665,7 @@ public void shouldCleanupVariableInstance() { List historicVariableInstances = historyService.createHistoricVariableInstanceQuery().list(); // assume - assertThat(historicVariableInstances.size()).isEqualTo(1); + assertThat(historicVariableInstances).hasSize(1); ClockUtil.setCurrentTime(addDays(END_DATE, 5)); @@ -721,7 +675,7 @@ public void shouldCleanupVariableInstance() { historicVariableInstances = historyService.createHistoricVariableInstanceQuery().list(); // then - assertThat(historicVariableInstances.size()).isEqualTo(0); + assertThat(historicVariableInstances).isEmpty(); } @Test @@ -742,7 +696,7 @@ public void shouldCleanupDetail() { .list(); // assume - assertThat(historicDetails.size()).isEqualTo(2); + assertThat(historicDetails).hasSize(2); ClockUtil.setCurrentTime(END_DATE); @@ -760,7 +714,7 @@ public void shouldCleanupDetail() { .list(); // then - assertThat(historicDetails.size()).isEqualTo(0); + assertThat(historicDetails).isEmpty(); } @Test @@ -783,7 +737,7 @@ public void shouldCleanupIncident() { List historicIncidents = historyService.createHistoricIncidentQuery().list(); // assume - assertThat(historicIncidents.size()).isEqualTo(2); + assertThat(historicIncidents).hasSize(2); ClockUtil.setCurrentTime(END_DATE); @@ -799,7 +753,7 @@ public void shouldCleanupIncident() { historicIncidents = historyService.createHistoricIncidentQuery().list(); // then - assertThat(historicIncidents.size()).isEqualTo(0); + assertThat(historicIncidents).isEmpty(); } @Test @@ -827,7 +781,7 @@ public void shouldCleanupExternalTaskLog() { List externalTaskLogs = historyService.createHistoricExternalTaskLogQuery().list(); // assume - assertThat(externalTaskLogs.size()).isEqualTo(1); + assertThat(externalTaskLogs).hasSize(1); ClockUtil.setCurrentTime(END_DATE); @@ -841,7 +795,7 @@ public void shouldCleanupExternalTaskLog() { externalTaskLogs = historyService.createHistoricExternalTaskLogQuery().list(); // then - assertThat(externalTaskLogs.size()).isEqualTo(0); + assertThat(externalTaskLogs).isEmpty(); } @Test @@ -869,7 +823,7 @@ public void shouldCleanupJobLog() { .list(); // assume - assertThat(jobLogs.size()).isEqualTo(2); + assertThat(jobLogs).hasSize(2); String taskId = taskService.createTaskQuery().singleResult().getId(); @@ -885,7 +839,7 @@ public void shouldCleanupJobLog() { .list(); // then - assertThat(jobLogs.size()).isEqualTo(0); + assertThat(jobLogs).isEmpty(); } @Test @@ -948,7 +902,7 @@ public void shouldCleanupUserOperationLog() { List userOperationLogs = historyService.createUserOperationLogQuery().list(); // assume - assertThat(userOperationLogs.size()).isEqualTo(1); + assertThat(userOperationLogs).hasSize(1); managementService.executeJob(jobId); @@ -966,7 +920,7 @@ public void shouldCleanupUserOperationLog() { userOperationLogs = historyService.createUserOperationLogQuery().list(); // then - assertThat(userOperationLogs.size()).isEqualTo(0); + assertThat(userOperationLogs).isEmpty(); } @Test @@ -985,7 +939,7 @@ public void shouldCleanupIdentityLink() { List historicIdentityLinkLogs = historyService.createHistoricIdentityLinkLogQuery().list(); // assume - assertThat(historicIdentityLinkLogs.size()).isEqualTo(1); + assertThat(historicIdentityLinkLogs).hasSize(1); ClockUtil.setCurrentTime(END_DATE); @@ -999,7 +953,7 @@ public void shouldCleanupIdentityLink() { historicIdentityLinkLogs = historyService.createHistoricIdentityLinkLogQuery().list(); // then - assertThat(historicIdentityLinkLogs.size()).isEqualTo(0); + assertThat(historicIdentityLinkLogs).isEmpty(); } @Test @@ -1021,7 +975,7 @@ public void shouldCleanupComment() { List comments = taskService.getProcessInstanceComments(processInstanceId); // assume - assertThat(comments.size()).isEqualTo(1); + assertThat(comments).hasSize(1); String taskId = taskService.createTaskQuery().singleResult().getId(); @@ -1037,7 +991,7 @@ public void shouldCleanupComment() { comments = taskService.getProcessInstanceComments(processInstanceId); // then - assertThat(comments.size()).isEqualTo(0); + assertThat(comments).isEmpty(); } @Test @@ -1059,7 +1013,7 @@ public void shouldCleanupAttachment() { List attachments = taskService.getProcessInstanceAttachments(processInstanceId); // assume - assertThat(attachments.size()).isEqualTo(1); + assertThat(attachments).hasSize(1); String taskId = taskService.createTaskQuery().singleResult().getId(); @@ -1075,7 +1029,7 @@ public void shouldCleanupAttachment() { attachments = taskService.getProcessInstanceAttachments(processInstanceId); // then - assertThat(attachments.size()).isEqualTo(0); + assertThat(attachments).isEmpty(); } @Test @@ -1153,14 +1107,14 @@ public void shouldCleanupBatch() { // assume List historicBatches = historyService.createHistoricBatchQuery().list(); - assertThat(historicBatches.size()).isEqualTo(1); + assertThat(historicBatches).hasSize(1); // assume List historicJobLogs = historyService.createHistoricJobLogQuery() .jobDefinitionConfiguration(batchId) .list(); - assertThat(historicJobLogs.size()).isEqualTo(6); + assertThat(historicJobLogs).hasSize(6); ClockUtil.setCurrentTime(addDays(END_DATE, 5)); @@ -1173,8 +1127,8 @@ public void shouldCleanupBatch() { .list(); // then - assertThat(historicBatches.size()).isEqualTo(0); - assertThat(historicJobLogs.size()).isEqualTo(0); + assertThat(historicBatches).isEmpty(); + assertThat(historicJobLogs).isEmpty(); } @Test @@ -1208,7 +1162,7 @@ public void shouldReportMetricsForBatchCleanup() { List historicBatches = historyService.createHistoricBatchQuery().list(); // assume - assertThat(historicBatches.size()).isEqualTo(1); + assertThat(historicBatches).hasSize(1); // when runHistoryCleanup(); @@ -1247,7 +1201,7 @@ public void shouldCleanupTaskMetrics() { runHistoryCleanup(); // then - assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isEqualTo(0L); + assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isZero(); } @Test @@ -1981,7 +1935,7 @@ public void shouldSeeCleanableButNoFinishedProcessInstancesInReport() { // then assertThat(report.getCleanableProcessInstanceCount()).isEqualTo(5L); - assertThat(report.getFinishedProcessInstanceCount()).isEqualTo(0L); + assertThat(report.getFinishedProcessInstanceCount()).isZero(); } @Test @@ -2009,7 +1963,7 @@ public void shouldSeeFinishedButNoCleanableProcessInstancesInReport() { // then assertThat(report.getFinishedProcessInstanceCount()).isEqualTo(5L); - assertThat(report.getCleanableProcessInstanceCount()).isEqualTo(0L); + assertThat(report.getCleanableProcessInstanceCount()).isZero(); } @Test @@ -2102,7 +2056,7 @@ public void shouldNotSeeCleanableDecisionInstancesInReport() { .singleResult(); // then - assertThat(report.getCleanableDecisionInstanceCount()).isEqualTo(0L); + assertThat(report.getCleanableDecisionInstanceCount()).isZero(); assertThat(report.getFinishedDecisionInstanceCount()).isEqualTo(5L); } @@ -2131,7 +2085,7 @@ public void shouldSeeCleanableBatchesInReport() { // then assertThat(report.getCleanableBatchesCount()).isEqualTo(1L); - assertThat(report.getFinishedBatchesCount()).isEqualTo(0L); + assertThat(report.getFinishedBatchesCount()).isZero(); // cleanup managementService.deleteBatch(batch.getId(), true); @@ -2161,8 +2115,8 @@ public void shouldNotSeeCleanableBatchesInReport() { CleanableHistoricBatchReportResult report = historyService.createCleanableHistoricBatchReport().singleResult(); // then - assertThat(report.getCleanableBatchesCount()).isEqualTo(0L); - assertThat(report.getFinishedBatchesCount()).isEqualTo(0L); + assertThat(report.getCleanableBatchesCount()).isZero(); + assertThat(report.getFinishedBatchesCount()).isZero(); // cleanup managementService.deleteBatch(batch.getId(), true); @@ -2173,7 +2127,7 @@ public void shouldNotSeeCleanableBatchesInReport() { protected void assumeWhenThenParallelizedCleanup(List jobs, Supplier supplier, long initialInstanceCount) { // assume - assertThat(jobs.size()).isEqualTo(3); + assertThat(jobs).hasSize(3); assertThat(supplier.get()).isEqualTo(initialInstanceCount); long expectedInstanceCount = initialInstanceCount-(initialInstanceCount/3); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/CustomPasswordPolicyTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/CustomPasswordPolicyTest.java index 30a565ea53c..48ebb8de883 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/CustomPasswordPolicyTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/CustomPasswordPolicyTest.java @@ -87,6 +87,6 @@ public void testCustomPasswordPolicyWithNonCompliantPassword() { .hasMessageContaining("Password does not match policy"); // and - assertThat(identityService.createUserQuery().userId(user.getId()).count()).isEqualTo(0L); + assertThat(identityService.createUserQuery().userId(user.getId()).count()).isZero(); } } \ No newline at end of file diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceAuthorizationsTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceAuthorizationsTest.java index fdcf351dfda..a0069c56461 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceAuthorizationsTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceAuthorizationsTest.java @@ -196,8 +196,8 @@ public void testTenantAuthorizationAfterDeleteUser() { processEngineConfiguration.setAuthorizationEnabled(false); // then - assertThat(query.count()).isEqualTo(0L); - assertThat(authorizationService.createAuthorizationQuery().resourceType(TENANT).userIdIn(jonny1Id).count()).isEqualTo(0L); + assertThat(query.count()).isZero(); + assertThat(authorizationService.createAuthorizationQuery().resourceType(TENANT).userIdIn(jonny1Id).count()).isZero(); } @Test @@ -432,8 +432,8 @@ public void testTenantAuthorizationAfterDeleteGroup() { processEngineConfiguration.setAuthorizationEnabled(false); // then - assertThat(query.count()).isEqualTo(0L); - assertThat(authorizationService.createAuthorizationQuery().resourceType(TENANT).groupIdIn("group1").count()).isEqualTo(0L); + assertThat(query.count()).isZero(); + assertThat(authorizationService.createAuthorizationQuery().resourceType(TENANT).groupIdIn("group1").count()).isZero(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTenantTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTenantTest.java index 8df9a4ccca6..bcaaf1efed5 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTenantTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTenantTest.java @@ -217,7 +217,7 @@ public void deleteTenant() { assertThat(query.count()).isEqualTo(1L); identityService.deleteTenant(TENANT_ONE); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -332,7 +332,7 @@ public void deleteTenantUserMembership() { assertThat(query.count()).isEqualTo(1L); identityService.deleteTenantUserMembership(TENANT_ONE, USER_ONE); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -355,7 +355,7 @@ public void deleteTenantGroupMembership() { assertThat(query.count()).isEqualTo(1L); identityService.deleteTenantGroupMembership(TENANT_ONE, GROUP_ONE); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -372,7 +372,7 @@ public void deleteTenantMembershipsWileDeleteUser() { assertThat(query.count()).isEqualTo(1L); identityService.deleteUser(USER_ONE); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -389,7 +389,7 @@ public void deleteTenantMembershipsWhileDeleteGroup() { assertThat(query.count()).isEqualTo(1L); identityService.deleteGroup(GROUP_ONE); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -412,8 +412,8 @@ public void deleteTenantMembershipsOfTenant() { assertThat(groupQuery.count()).isEqualTo(1L); identityService.deleteTenant(TENANT_ONE); - assertThat(userQuery.count()).isEqualTo(0L); - assertThat(groupQuery.count()).isEqualTo(0L); + assertThat(userQuery.count()).isZero(); + assertThat(groupQuery.count()).isZero(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTest.java index 01a4bddcc98..8d7e16b374c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/IdentityServiceTest.java @@ -717,7 +717,7 @@ public void testUsuccessfulAttemptsResultInBlockedUser() throws ParseException { } // then - assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The user with id 'johndoe' is permanently locked.").size()).isEqualTo(1); + assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The user with id 'johndoe' is permanently locked.")).hasSize(1); } @Test @@ -749,7 +749,7 @@ public void testSuccessfulLoginAfterFailureWithoutDelay() { assertFalse(identityService.checkPassword("johndoe", "xxx")); // assume - assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The user with id 'johndoe' is locked.").size()).isEqualTo(1); + assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The user with id 'johndoe' is locked.")).hasSize(1); // when ClockUtil.setCurrentTime(DateUtils.addSeconds(now, 30)); @@ -778,7 +778,7 @@ public void testUnsuccessfulLoginAfterFailureWithoutDelay() { assertFalse(identityService.checkPassword("johndoe", "invalid pwd")); // then - assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The lock will expire at " + expectedLockExpitation).size()).isEqualTo(1); + assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The lock will expire at " + expectedLockExpitation)).hasSize(1); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordHashingTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordHashingTest.java index be06fbce75c..d7fcaefd300 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordHashingTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordHashingTest.java @@ -103,7 +103,7 @@ public void saltHashingOnHashedPasswordWithoutSaltThrowsNoError() { identityService.saveUser(user); // then - assertThat(identityService.checkPassword(USER_NAME, PASSWORD)).isEqualTo(true); + assertThat(identityService.checkPassword(USER_NAME, PASSWORD)).isTrue(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordPolicyConfigurationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordPolicyConfigurationTest.java index 7507312c979..51bf4b0327d 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordPolicyConfigurationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/PasswordPolicyConfigurationTest.java @@ -16,18 +16,18 @@ */ package org.operaton.bpm.engine.test.api.identity; -import static org.assertj.core.api.Assertions.assertThat; - -import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; -import org.operaton.bpm.engine.impl.identity.DefaultPasswordPolicyImpl; -import org.operaton.bpm.engine.test.ProcessEngineRule; -import org.operaton.bpm.engine.test.util.ProcessEngineTestRule; -import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; +import org.operaton.bpm.engine.impl.identity.DefaultPasswordPolicyImpl; +import org.operaton.bpm.engine.test.ProcessEngineRule; +import org.operaton.bpm.engine.test.util.ProcessEngineTestRule; +import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; + +import static org.assertj.core.api.Assertions.assertThat; public class PasswordPolicyConfigurationTest { @@ -59,7 +59,7 @@ public void testInitialConfiguration() { // then assertThat(processEngineConfiguration.getPasswordPolicy()).isNull(); - assertThat(processEngineConfiguration.isEnablePasswordPolicy()).isEqualTo(false); + assertThat(processEngineConfiguration.isEnablePasswordPolicy()).isFalse(); } @Test @@ -72,7 +72,7 @@ public void testAutoConfigurationDefaultPasswordPolicy() { processEngineConfiguration.initPasswordPolicy(); // then - assertThat(processEngineConfiguration.isEnablePasswordPolicy()).isEqualTo(true); + assertThat(processEngineConfiguration.isEnablePasswordPolicy()).isTrue(); assertThat(processEngineConfiguration.getPasswordPolicy()).isInstanceOf(DefaultPasswordPolicyImpl.class); } @@ -86,7 +86,7 @@ public void testFullPasswordPolicyConfiguration() { processEngineConfiguration.initPasswordPolicy(); // then - assertThat(processEngineConfiguration.isEnablePasswordPolicy()).isEqualTo(true); + assertThat(processEngineConfiguration.isEnablePasswordPolicy()).isTrue(); assertThat(processEngineConfiguration.getPasswordPolicy()).isInstanceOf(DefaultPasswordPolicyImpl.class); } } \ No newline at end of file diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/TenantQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/TenantQueryTest.java index 144ca4e520d..b62530a7bef 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/TenantQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/identity/TenantQueryTest.java @@ -80,14 +80,14 @@ public void queryById() { public void queryByNonExistingId() { TenantQuery query = identityService.createTenantQuery().tenantId("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test public void queryByIdIn() { TenantQuery query = identityService.createTenantQuery(); - assertThat(query.tenantIdIn("non", "existing").count()).isEqualTo(0L); + assertThat(query.tenantIdIn("non", "existing").count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); } @@ -95,7 +95,7 @@ public void queryByIdIn() { public void queryByName() { TenantQuery query = identityService.createTenantQuery(); - assertThat(query.tenantName("nonExisting").count()).isEqualTo(0L); + assertThat(query.tenantName("nonExisting").count()).isZero(); assertThat(query.tenantName("Tenant_1").count()).isEqualTo(1L); assertThat(query.tenantName("Tenant_2").count()).isEqualTo(1L); } @@ -104,7 +104,7 @@ public void queryByName() { public void queryByNameLike() { TenantQuery query = identityService.createTenantQuery(); - assertThat(query.tenantNameLike("%nonExisting%").count()).isEqualTo(0L); + assertThat(query.tenantNameLike("%nonExisting%").count()).isZero(); assertThat(query.tenantNameLike("%Tenant\\_1%").count()).isEqualTo(1L); assertThat(query.tenantNameLike("%Tenant%").count()).isEqualTo(2L); } @@ -113,7 +113,7 @@ public void queryByNameLike() { public void queryByUser() { TenantQuery query = identityService.createTenantQuery(); - assertThat(query.userMember("nonExisting").count()).isEqualTo(0L); + assertThat(query.userMember("nonExisting").count()).isZero(); assertThat(query.userMember(USER).count()).isEqualTo(1L); assertThat(query.userMember(USER).tenantId(TENANT_ONE).count()).isEqualTo(1L); } @@ -122,7 +122,7 @@ public void queryByUser() { public void queryByGroup() { TenantQuery query = identityService.createTenantQuery(); - assertThat(query.groupMember("nonExisting").count()).isEqualTo(0L); + assertThat(query.groupMember("nonExisting").count()).isZero(); assertThat(query.groupMember(GROUP).count()).isEqualTo(1L); assertThat(query.groupMember(GROUP).tenantId(TENANT_TWO).count()).isEqualTo(1L); } @@ -139,7 +139,7 @@ public void queryByUserIncludingGroups() { public void queryOrderById() { // ascending List tenants = identityService.createTenantQuery().orderByTenantId().asc().list(); - assertThat(tenants.size()).isEqualTo(2); + assertThat(tenants).hasSize(2); assertThat(tenants.get(0).getId()).isEqualTo(TENANT_ONE); assertThat(tenants.get(1).getId()).isEqualTo(TENANT_TWO); @@ -155,7 +155,7 @@ public void queryOrderById() { public void queryOrderByName() { // ascending List tenants = identityService.createTenantQuery().orderByTenantName().asc().list(); - assertThat(tenants.size()).isEqualTo(2); + assertThat(tenants).hasSize(2); assertThat(tenants.get(0).getName()).isEqualTo("Tenant_1"); assertThat(tenants.get(1).getName()).isEqualTo("Tenant_2"); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/BatchStatisticsQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/BatchStatisticsQueryTest.java index f07976f0cb1..bab27acbb5c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/BatchStatisticsQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/BatchStatisticsQueryTest.java @@ -693,8 +693,8 @@ public void shouldQueryByStartedAfter() { assertThat(batchStatistics).hasSize(1); assertThat(query1.count()).isEqualTo(1); - assertThat(query2.count()).isEqualTo(0); - assertThat(query2.list()).hasSize(0); + assertThat(query2.count()).isZero(); + assertThat(query2.list()).isEmpty(); } @Test @@ -711,8 +711,8 @@ public void shouldQueryByStartedBefore() { BatchStatisticsQuery query2 = managementService.createBatchStatisticsQuery().startedBefore(oneMinLater); // then - assertThat(query1.count()).isEqualTo(0); - assertThat(query1.list()).hasSize(0); + assertThat(query1.count()).isZero(); + assertThat(query1.list()).isEmpty(); final List batchStatistics = query2.list(); assertThat(batchStatistics.get(0).getId()).isEqualTo(batch.getId()); @@ -747,8 +747,8 @@ public void shouldQueryByCreatedBy() { assertThat(query2.list()).hasSize(1); assertThat(query2.count()).isEqualTo(1); - assertThat(query3.list()).hasSize(0); - assertThat(query3.count()).isEqualTo(0); + assertThat(query3.list()).isEmpty(); + assertThat(query3.count()).isZero(); } protected void deleteMigrationJobs(Batch batch) { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceAsyncOperationsTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceAsyncOperationsTest.java index 436429d913e..19749b4c8c1 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceAsyncOperationsTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceAsyncOperationsTest.java @@ -203,7 +203,7 @@ public void testSetJobsRetryAsyncWithNonExistingProcessID() throws Exception { List exceptions = executeBatchJobs(batch); //then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); assertRetries(getAllJobIds(), RETRIES); assertHistoricBatchExists(testRule); } @@ -220,7 +220,7 @@ public void testSetJobsRetryAsyncWithJobQueryAndList() throws Exception { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); assertRetries(getAllJobIds(), RETRIES); assertHistoricBatchExists(testRule); } @@ -237,7 +237,7 @@ public void testSetJobsRetryAsyncWithProcessQueryAndList() throws Exception { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); assertRetries(getAllJobIds(), RETRIES); assertHistoricBatchExists(testRule); } @@ -253,7 +253,7 @@ public void testSetJobsRetryAsyncWithJobQuery() throws Exception { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); assertRetries(ids, RETRIES); assertHistoricBatchExists(testRule); } @@ -269,7 +269,7 @@ public void testSetJobsRetryAsyncWithProcessQuery() throws Exception { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); assertRetries(ids, RETRIES); assertHistoricBatchExists(testRule); } @@ -288,7 +288,7 @@ public void testSetJobsRetryAsyncWithHistoryProcessQuery() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); assertRetries(ids, RETRIES); assertHistoricBatchExists(testRule); } @@ -311,7 +311,7 @@ public void testSetJobsRetryAsyncWithRuntimeAndHistoryProcessQuery() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); assertRetries(ids, RETRIES); assertHistoricBatchExists(testRule); } @@ -402,7 +402,7 @@ public void shouldSetJobDueDateOnJobRetryAsyncByJobQuery() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); for (String id : ids) { Job job = managementService.createJobQuery().jobId(id).singleResult(); assertThat(job.getRetries()).isEqualTo(RETRIES); @@ -423,7 +423,7 @@ public void shouldSetJobDueDateOnJobRetryAsyncByProcessInstanceIds() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); for (String id : processInstanceIds) { Job job = managementService.createJobQuery().processInstanceId(id).singleResult(); assertThat(job.getRetries()).isEqualTo(RETRIES); @@ -442,7 +442,7 @@ public void shouldSetJobDueDateOnJobRetryAsyncByProcessInstanceQuery() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); for (String id : ids) { Job jobResult = managementService.createJobQuery().jobId(id).singleResult(); assertThat(jobResult.getRetries()).isEqualTo(RETRIES); @@ -466,7 +466,7 @@ public void shouldSetJobDueDateOnJobRetryAsyncByHistoricProcessInstanceQuery() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); for (String id : ids) { Job jobResult = managementService.createJobQuery().jobId(id).singleResult(); assertThat(jobResult.getRetries()).isEqualTo(RETRIES); @@ -495,7 +495,7 @@ public void shouldSetDueDateNull() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); for (String id : ids) { Job jobResult = managementService.createJobQuery().jobId(id).singleResult(); assertThat(jobResult.getRetries()).isEqualTo(RETRIES); @@ -513,7 +513,7 @@ public void shouldSetJobDueDateOnJobRetryAsyncByJobIds() { List exceptions = executeBatchJobs(batch); // then - assertThat(exceptions).hasSize(0); + assertThat(exceptions).isEmpty(); for (String id : ids) { Job jobResult = managementService.createJobQuery().jobId(id).singleResult(); assertThat(jobResult.getRetries()).isEqualTo(RETRIES); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceTest.java index 72b090a435c..3a05230257c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ManagementServiceTest.java @@ -904,7 +904,7 @@ public void testSetJobPriorityToExtremeValues() { public void testGetTableMetaData() { TableMetaData tableMetaData = managementService.getTableMetaData("ACT_RU_TASK"); - assertThat(tableMetaData.getColumnNames().size()).isEqualTo(tableMetaData.getColumnTypes().size()); + assertThat(tableMetaData.getColumnNames()).hasSize(tableMetaData.getColumnTypes().size()); assertThat(tableMetaData.getColumnNames()).contains("ID_", "REV_","NAME_", "PARENT_TASK_ID_", "PRIORITY_", "CREATE_TIME_", "LAST_UPDATED_", "OWNER_", "ASSIGNEE_", "DELEGATION_", "EXECUTION_ID_", "PROC_DEF_ID_", "PROC_INST_ID_", "CASE_EXECUTION_ID_","CASE_INST_ID_", "CASE_DEF_ID_", "TASK_DEF_KEY_", diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ProcessDefinitionStatisticsQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ProcessDefinitionStatisticsQueryTest.java index 5e5fcfffe69..3af4e1fd48c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ProcessDefinitionStatisticsQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/ProcessDefinitionStatisticsQueryTest.java @@ -690,8 +690,8 @@ public void testProcessDefinitionStatisticsProperties() { assertThat(processDefinitionStatistics.getResourceName()).isEqualTo(resourceName); assertThat(processDefinitionStatistics.getDiagramResourceName()).isNull(); assertThat(processDefinitionStatistics.getVersion()).isEqualTo(1); - assertThat(processDefinitionStatistics.getInstances()).isEqualTo(0); - assertThat(processDefinitionStatistics.getFailedJobs()).isEqualTo(0); + assertThat(processDefinitionStatistics.getInstances()).isZero(); + assertThat(processDefinitionStatistics.getFailedJobs()).isZero(); assertThat(processDefinitionStatistics.getIncidentStatistics()).isEmpty(); assertThat(processDefinitionStatistics.isStartableInTasklist()).isTrue(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/PropertyUserOperationLogTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/PropertyUserOperationLogTest.java index e0f75e88317..a257398738b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/PropertyUserOperationLogTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/PropertyUserOperationLogTest.java @@ -67,7 +67,7 @@ public void tearDown() { @Test public void testCreateProperty() { // given - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when identityService.setAuthenticatedUserId(USER_ID); @@ -89,7 +89,7 @@ public void testCreateProperty() { public void testUpdateProperty() { // given managementService.setProperty(PROPERTY_NAME, "testValue"); - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when identityService.setAuthenticatedUserId(USER_ID); @@ -111,7 +111,7 @@ public void testUpdateProperty() { public void testDeleteProperty() { // given managementService.setProperty(PROPERTY_NAME, "testValue"); - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when identityService.setAuthenticatedUserId(USER_ID); @@ -132,7 +132,7 @@ public void testDeleteProperty() { @Test public void testDeletePropertyNonExisting() { // given - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when identityService.setAuthenticatedUserId(USER_ID); @@ -140,6 +140,6 @@ public void testDeletePropertyNonExisting() { identityService.clearAuthentication(); // then - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/metrics/TaskMetricsTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/metrics/TaskMetricsTest.java index bb0c8b6aca1..aecd356398e 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/metrics/TaskMetricsTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/metrics/TaskMetricsTest.java @@ -90,7 +90,7 @@ public void shouldDeleteTaskMetrics() { // when managementService.deleteTaskMetrics(null); // then - assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isEqualTo(0L); + assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isZero(); } @Test @@ -103,7 +103,7 @@ public void shouldDeleteTaskMetricsWithTimestamp() { // when managementService.deleteTaskMetrics(getOneMinuteFromNow()); // then - assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isEqualTo(0L); + assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isZero(); } @Test @@ -299,7 +299,7 @@ public void shouldNotCreateTaskMetricForTransientStandaloneTask() { // when newTask.setAssignee("kermit"); // then - assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isEqualTo(0L); + assertThat(managementService.getUniqueTaskWorkerCount(null, null)).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryConfigurationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryConfigurationTest.java index 8359095cf80..690103cc2f2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryConfigurationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryConfigurationTest.java @@ -16,8 +16,11 @@ */ package org.operaton.bpm.engine.test.api.mgmt.telemetry; -import static org.assertj.core.api.Assertions.assertThat; - +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.IdentityService; import org.operaton.bpm.engine.ManagementService; import org.operaton.bpm.engine.ProcessEngine; @@ -33,11 +36,8 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.commons.testing.ProcessEngineLoggingRule; import org.operaton.commons.testing.WatchLogger; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import static org.assertj.core.api.Assertions.assertThat; public class TelemetryConfigurationTest { @@ -94,7 +94,7 @@ public void shouldNotLogDefaultTelemetryValue() { // given // then - assertThat(loggingRule.getFilteredLog(" telemetry ").size()).isZero(); + assertThat(loggingRule.getFilteredLog(" telemetry ")).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryDynamicDataTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryDynamicDataTest.java index 7c95e697c41..1b2e5306115 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryDynamicDataTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/mgmt/telemetry/TelemetryDynamicDataTest.java @@ -16,15 +16,12 @@ */ package org.operaton.bpm.engine.test.api.mgmt.telemetry; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Map; - -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngine; -import org.operaton.bpm.engine.ProcessEngines; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.operaton.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration; import org.operaton.bpm.engine.impl.diagnostics.CommandCounter; @@ -36,11 +33,10 @@ import org.operaton.bpm.engine.test.Deployment; import org.operaton.bpm.engine.test.ProcessEngineRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; public class TelemetryDynamicDataTest { @@ -127,7 +123,7 @@ public void shouldCountAfterCleaning() { taskService.complete(task.getId()); // then - assertThat(entries.size()).isEqualTo(4); + assertThat(entries).hasSize(4); String [] expectedExecutedCommands = {"StartProcessInstanceCmd", "SetExecutionVariablesCmd", "TaskQueryImpl", diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionEvaluationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionEvaluationTest.java index 3c205f567bb..96310cf2d8f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionEvaluationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionEvaluationTest.java @@ -311,7 +311,7 @@ protected VariableMap createVariables() { protected void assertThatDecisionHasResult(DmnDecisionResult decisionResult, Object expectedValue) { assertThat(decisionResult).isNotNull(); - assertThat(decisionResult.size()).isEqualTo(1); + assertThat(decisionResult).hasSize(1); String value = decisionResult.getSingleResult().getFirstEntry(); assertThat(value).isEqualTo(expectedValue); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionTableEvaluationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionTableEvaluationTest.java index 410aa9d965a..b4d3582e20f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionTableEvaluationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyDecisionTableEvaluationTest.java @@ -311,7 +311,7 @@ protected VariableMap createVariables() { protected void assertThatDecisionHasResult(DmnDecisionTableResult decisionResult, Object expectedValue) { assertThat(decisionResult).isNotNull(); - assertThat(decisionResult.size()).isEqualTo(1); + assertThat(decisionResult).hasSize(1); String value = decisionResult.getSingleResult().getFirstEntry(); assertThat(value).isEqualTo(expectedValue); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyExecutionPropagationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyExecutionPropagationTest.java index c777cb2649d..0d7e8da6fc8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyExecutionPropagationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyExecutionPropagationTest.java @@ -99,7 +99,7 @@ public void testPropagateTenantIdToConcurrentExecution() { startProcessInstance(PROCESS_DEFINITION_KEY); List executions = runtimeService.createExecutionQuery().list(); - assertThat(executions.size()).isEqualTo(3); + assertThat(executions).hasSize(3); assertThat(executions.get(0).getTenantId()).isEqualTo(TENANT_ID); // inherit the tenant id from process instance assertThat(executions.get(1).getTenantId()).isEqualTo(TENANT_ID); @@ -123,7 +123,7 @@ public void testPropagateTenantIdToEmbeddedSubprocess() { startProcessInstance(PROCESS_DEFINITION_KEY); List executions = runtimeService.createExecutionQuery().list(); - assertThat(executions.size()).isEqualTo(2); + assertThat(executions).hasSize(2); assertThat(executions.get(0).getTenantId()).isEqualTo(TENANT_ID); // inherit the tenant id from parent execution (e.g. process instance) assertThat(executions.get(1).getTenantId()).isEqualTo(TENANT_ID); @@ -425,7 +425,7 @@ public void testPropagateTenantIdToExternalTask() { assertThat(externalTask.getTenantId()).isEqualTo(TENANT_ID); List externalTasks = externalTaskService.fetchAndLock(1, "test").topic("test", 1000).execute(); - assertThat(externalTasks.size()).isEqualTo(1); + assertThat(externalTasks).hasSize(1); assertThat(externalTasks.get(0).getTenantId()).isEqualTo(TENANT_ID); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyFilterServiceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyFilterServiceTest.java index 999487b2e9e..c936e5d1795 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyFilterServiceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyFilterServiceTest.java @@ -155,7 +155,7 @@ public void testFilterTasksByTenantIdNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); - assertThat(filterService.count(filterId)).isEqualTo(0L); + assertThat(filterService.count(filterId)).isZero(); } @Test @@ -176,7 +176,7 @@ public void testFilterTasksByExtendingQueryWithTenantIdNoAuthenticatedTenants() identityService.setAuthentication("user", null, null); TaskQuery extendingQuery = taskService.createTaskQuery().tenantIdIn(TENANT_ONE); - assertThat(filterService.count(filterId, extendingQuery)).isEqualTo(0L); + assertThat(filterService.count(filterId, extendingQuery)).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyMessageCorrelationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyMessageCorrelationTest.java index 6568be6dcd8..2d9918282a8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyMessageCorrelationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyMessageCorrelationTest.java @@ -112,7 +112,7 @@ public void correlateMessageToStartEventWithTenantId() { ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -170,7 +170,7 @@ public void correlateMessageToIntermediateCatchEventWithTenantId() { TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -185,7 +185,7 @@ public void correlateMessageToStartAndIntermediateCatchEventWithoutTenantId() { .correlateAll(); List tasks = engineRule.getTaskService().createTaskQuery().list(); - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); assertThat(tasks.get(0).getTenantId()).isNull(); assertThat(tasks.get(1).getTenantId()).isNull(); } @@ -204,7 +204,7 @@ public void correlateMessageToStartAndIntermediateCatchEventWithTenantId() { TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -223,7 +223,7 @@ public void correlateMessageToMultipleIntermediateCatchEventsWithoutTenantId() { .correlateAll(); List tasks = engineRule.getTaskService().createTaskQuery().list(); - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); assertThat(tasks.get(0).getTenantId()).isNull(); assertThat(tasks.get(1).getTenantId()).isNull(); } @@ -245,7 +245,7 @@ public void correlateMessageToMultipleIntermediateCatchEventsWithTenantId() { TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -273,7 +273,7 @@ public void correlateStartMessageWithTenantId() { ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyRepositoryServiceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyRepositoryServiceTest.java index 80086f93114..bcc04b42908 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyRepositoryServiceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyRepositoryServiceTest.java @@ -119,7 +119,7 @@ public void processDefinitionVersionWithTenantId() { .asc() .list(); - assertThat(processDefinitions.size()).isEqualTo(3); + assertThat(processDefinitions).hasSize(3); // process definition was deployed twice for tenant one assertThat(processDefinitions.get(0).getVersion()).isEqualTo(1); assertThat(processDefinitions.get(1).getVersion()).isEqualTo(2); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancySignalReceiveTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancySignalReceiveTest.java index eb84309d2e2..8169b75d598 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancySignalReceiveTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancySignalReceiveTest.java @@ -196,7 +196,7 @@ public void sendSignalToStartAndIntermediateCatchEventForNonTenant() { runtimeService.createSignalEvent("signal").withoutTenantId().send(); List tasks = taskService.createTaskQuery().list(); - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); assertThat(tasks.get(0).getTenantId()).isNull(); assertThat(tasks.get(1).getTenantId()).isNull(); } @@ -281,7 +281,7 @@ public void throwIntermediateSignalForTenant() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(2L); } @@ -296,7 +296,7 @@ public void throwIntermediateSignalForNonTenant() { runtimeService.startProcessInstanceByKey("signalThrow"); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(2L); - assertThat(taskService.createTaskQuery().tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().tenantIdIn(TENANT_ONE).count()).isZero(); } @Test @@ -313,7 +313,7 @@ public void throwEndSignalForTenant() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(2L); } @@ -328,6 +328,6 @@ public void throwEndSignalForNonTenant() { runtimeService.startProcessInstanceByKey("signalThrow"); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(2L); - assertThat(taskService.createTaskQuery().tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().tenantIdIn(TENANT_ONE).count()).isZero(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyTimerStartEventTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyTimerStartEventTest.java index a7cac62f2de..b3e5fb06a4c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyTimerStartEventTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyTimerStartEventTest.java @@ -113,13 +113,13 @@ public void deleteJobsWhileUndeployment() { repositoryService.deleteDeployment(deploymentForTenantOne.getId(), true); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(1L); repositoryService.deleteDeployment(deploymentForTenantTwo.getId(), true); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -187,7 +187,7 @@ public void timerStartEventWithTimerCycle() { ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.withoutTenantId().count()).isEqualTo(0L); + assertThat(query.withoutTenantId().count()).isZero(); } protected void executeFailingJobs(List jobs) { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyUserOperationLogTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyUserOperationLogTest.java index 90fc49c561f..6c64d26a8b3 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyUserOperationLogTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/MultiTenancyUserOperationLogTest.java @@ -151,7 +151,7 @@ public void shouldLogUserOperationsWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -174,7 +174,7 @@ public void shouldLogIncidentOperationsWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -199,7 +199,7 @@ public void shouldLogIdentityLinkOperationsWithTenant() { List list = historyService.createUserOperationLogQuery().list(); // then - assertThat(list.size()).isEqualTo(4); + assertThat(list).hasSize(4); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getEntityType()).isEqualTo(EntityTypes.IDENTITY_LINK); assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); @@ -223,7 +223,7 @@ public void shouldLogAttachmentOperationsWithTenant() { List list = historyService.createUserOperationLogQuery().list(); // then - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getEntityType()).isEqualTo(EntityTypes.ATTACHMENT); assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); @@ -257,7 +257,7 @@ public void shouldLogTaskOperationsWithTenant() { List list = historyService.createUserOperationLogQuery().list(); // then - assertThat(list.size()).isEqualTo(5); + assertThat(list).hasSize(5); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getEntityType()).isEqualTo(EntityTypes.TASK); assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); @@ -290,7 +290,7 @@ public void shouldLogStandaloneTaskOperationsWithTenant() { .entityType(EntityTypes.TASK).list(); // then - assertThat(list.size()).isEqualTo(8); + assertThat(list).hasSize(8); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -355,7 +355,7 @@ public void shouldLogProcessInstanceOperationsWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(4); + assertThat(list).hasSize(4); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -376,7 +376,7 @@ public void shouldLogProcessDefinitionOperationsWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -416,7 +416,7 @@ public void shouldLogDeployOperationWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -437,7 +437,7 @@ public void shouldLogBatchOperationWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -478,7 +478,7 @@ public void shouldLogDecisionDefinitionOperationWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(3); // 3 properties + assertThat(list).hasSize(3); // 3 properties for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -504,7 +504,7 @@ public void shouldLogDecisionInstanceOperationWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); // 2 properties + assertThat(list).hasSize(2); // 2 properties for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -534,7 +534,7 @@ public void shouldLogDecisionInstancesOperationWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(5); // 5 properties + assertThat(list).hasSize(5); // 5 properties for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(null); } @@ -555,7 +555,7 @@ public void shouldLogCaseDefinitionOperationWithTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); // 2 properties + assertThat(list).hasSize(2); // 2 properties for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(TENANT_ONE); } @@ -653,7 +653,7 @@ public void shouldLogFilterOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(3); + assertThat(list).hasSize(3); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(null); } @@ -676,7 +676,7 @@ public void shouldLogUserOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(3); + assertThat(list).hasSize(3); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(null); } @@ -699,7 +699,7 @@ public void shouldLogGroupOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(3); + assertThat(list).hasSize(3); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(null); } @@ -723,7 +723,7 @@ public void shouldLogTenantOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(3); + assertThat(list).hasSize(3); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo("test"); } @@ -745,7 +745,7 @@ public void shouldLogGroupMemebershipOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(4); // 2 properties per log + assertThat(list).hasSize(4); // 2 properties per log for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(null); } @@ -771,7 +771,7 @@ public void shouldLogTenantMemebershipOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(4); // 2 properties per log + assertThat(list).hasSize(4); // 2 properties per log for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo("testTenant"); } @@ -806,7 +806,7 @@ public void shouldLogAuthorizationOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(12); // 6 properties per log + assertThat(list).hasSize(12); // 6 properties per log for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(null); } @@ -826,7 +826,7 @@ public void shouldLogPropertyOperationsWithoutTenant() { .list(); // then - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); for (UserOperationLogEntry userOperationLogEntry : list) { assertThat(userOperationLogEntry.getTenantId()).isEqualTo(null); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/TenantIdProviderTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/TenantIdProviderTest.java index f8fd5ac865a..0f555e32c80 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/TenantIdProviderTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/TenantIdProviderTest.java @@ -16,16 +16,11 @@ */ package org.operaton.bpm.engine.test.api.multitenancy; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.variable.Variables.stringValue; -import static org.junit.Assert.assertNotNull; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import org.junit.After; +import org.junit.ClassRule; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.delegate.DelegateCaseExecution; import org.operaton.bpm.engine.delegate.DelegateExecution; @@ -39,11 +34,7 @@ import org.operaton.bpm.engine.repository.CaseDefinition; import org.operaton.bpm.engine.repository.DecisionDefinition; import org.operaton.bpm.engine.repository.ProcessDefinition; -import org.operaton.bpm.engine.runtime.CaseExecution; -import org.operaton.bpm.engine.runtime.CaseInstance; -import org.operaton.bpm.engine.runtime.Execution; -import org.operaton.bpm.engine.runtime.Incident; -import org.operaton.bpm.engine.runtime.ProcessInstance; +import org.operaton.bpm.engine.runtime.*; import org.operaton.bpm.engine.test.ProcessEngineRule; import org.operaton.bpm.engine.test.RequiredHistoryLevel; import org.operaton.bpm.engine.test.util.ProcessEngineBootstrapRule; @@ -53,11 +44,12 @@ import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.ClassRule; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertNotNull; +import static org.operaton.bpm.engine.variable.Variables.stringValue; /** * @author Daniel Meyer @@ -119,7 +111,7 @@ public void providerCalledForProcessDefinitionWithoutTenantId() { engineRule.getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY); // then the tenant id provider is invoked - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); } @Test @@ -135,7 +127,7 @@ public void providerNotCalledForProcessDefinitionWithTenantId() { engineRule.getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY); // then the tenant id provider is not invoked - assertThat(tenantIdProvider.parameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.parameters).isEmpty(); } @@ -162,7 +154,7 @@ public void providerCalledForStartedProcessInstanceByStartFormWithoutTenantId() assertNotNull(procInstance); // then the tenant id provider is invoked - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); } @@ -188,7 +180,7 @@ public void providerNotCalledForStartedProcessInstanceByStartFormWithTenantId() assertNotNull(procInstance); // then the tenant id provider is not invoked - assertThat(tenantIdProvider.parameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.parameters).isEmpty(); } @Test @@ -208,7 +200,7 @@ public void providerCalledForStartedProcessInstanceByModificationWithoutTenantId //then provider is called assertNotNull(engineRule.getRuntimeService().getActivityInstance(processInstanceId)); - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); } @Test @@ -228,7 +220,7 @@ public void providerNotCalledForStartedProcessInstanceByModificationWithTenantId //then provider should not be called assertNotNull(engineRule.getRuntimeService().getActivityInstance(processInstanceId)); - assertThat(tenantIdProvider.parameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.parameters).isEmpty(); } @Test @@ -243,7 +235,7 @@ public void providerCalledWithVariables() { engineRule.getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY, Variables.createVariables().putValue("varName", true)); // then the tenant id provider is passed in the variable - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); assertThat((Boolean) tenantIdProvider.parameters.get(0).getVariables().get("varName")).isTrue(); } @@ -315,7 +307,7 @@ public void providerCalledForProcessDefinitionWithoutTenantId_SubProcessInstance engineRule.getRuntimeService().startProcessInstanceByKey("superProcess"); // then the tenant id provider is invoked twice - assertThat(tenantIdProvider.parameters.size()).isEqualTo(2); + assertThat(tenantIdProvider.parameters).hasSize(2); } @Test @@ -332,7 +324,7 @@ public void providerNotCalledForProcessDefinitionWithTenantId_SubProcessInstance engineRule.getRuntimeService().startProcessInstanceByKey("superProcess"); // then the tenant id provider is not invoked - assertThat(tenantIdProvider.parameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.parameters).isEmpty(); } @Test @@ -348,7 +340,7 @@ public void providerCalledWithVariables_SubProcessInstance() { engineRule.getRuntimeService().startProcessInstanceByKey("superProcess", Variables.createVariables().putValue("varName", true)); // then the tenant id provider is passed in the variable - assertThat(tenantIdProvider.parameters.get(1).getVariables().size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters.get(1).getVariables()).hasSize(1); assertThat((Boolean) tenantIdProvider.parameters.get(1).getVariables().get("varName")).isTrue(); } @@ -467,7 +459,7 @@ public void providerCalledForProcessDefinitionWithoutTenantId_ProcessTask() { // then the tenant id provider is invoked once for the process instance - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); } @Test @@ -485,7 +477,7 @@ public void providerNotCalledForProcessDefinitionWithTenantId_ProcessTask() { CaseExecution caseExecution = engineRule.getCaseService().createCaseExecutionQuery().activityId("PI_ProcessTask_1").singleResult(); // then the tenant id provider is not invoked - assertThat(tenantIdProvider.parameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.parameters).isEmpty(); } @Test @@ -503,10 +495,10 @@ public void providerCalledWithVariables_ProcessTask() { CaseExecution caseExecution = engineRule.getCaseService().createCaseExecutionQuery().activityId("PI_ProcessTask_1").singleResult(); // then the tenant id provider is passed in the variable - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); VariableMap variables = tenantIdProvider.parameters.get(0).getVariables(); - assertThat(variables.size()).isEqualTo(1); + assertThat(variables).hasSize(1); assertThat((Boolean) variables.get("varName")).isTrue(); } @@ -525,7 +517,7 @@ public void providerCalledWithProcessDefinition_ProcessTask() { CaseExecution caseExecution = engineRule.getCaseService().createCaseExecutionQuery().activityId("PI_ProcessTask_1").singleResult(); // then the tenant id provider is passed in the process definition - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); assertThat(tenantIdProvider.parameters.get(0).getProcessDefinition()).isNotNull(); } @@ -544,7 +536,7 @@ public void providerCalledWithSuperCaseExecution() { CaseExecution caseExecution = engineRule.getCaseService().createCaseExecutionQuery().activityId("PI_ProcessTask_1").singleResult(); // then the tenant id provider is handed in the super case execution - assertThat(tenantIdProvider.parameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.parameters).hasSize(1); assertThat(tenantIdProvider.parameters.get(0).getSuperCaseExecution()).isNotNull(); } @@ -563,7 +555,7 @@ public void providerCalledForDecisionDefinitionWithoutTenantId() { engineRule.getDecisionService().evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).evaluate(); // then the tenant id provider is invoked - assertThat(tenantIdProvider.dmnParameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.dmnParameters).hasSize(1); } @Test @@ -579,7 +571,7 @@ public void providerNotCalledForDecisionDefinitionWithTenantId() { engineRule.getDecisionService().evaluateDecisionTableByKey(DECISION_DEFINITION_KEY).variables(createVariables()).evaluate(); // then the tenant id provider is not invoked - assertThat(tenantIdProvider.dmnParameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.dmnParameters).isEmpty(); } @Test @@ -654,7 +646,7 @@ public void providerCalledForHistoricDecisionDefinitionWithoutTenantId_BusinessR engineRule.getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY, createVariables()); // then the tenant id provider is invoked - assertThat(tenantIdProvider.dmnParameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.dmnParameters).hasSize(1); } @Test @@ -677,7 +669,7 @@ public void providerNotCalledForHistoricDecisionDefinitionWithTenantId_BusinessR engineRule.getRuntimeService().startProcessInstanceByKey(PROCESS_DEFINITION_KEY, createVariables()); // then the tenant id providers are not invoked - assertThat(tenantIdProvider.dmnParameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.dmnParameters).isEmpty(); } @Test @@ -701,7 +693,7 @@ public void providerCalledWithExecution_BusinessRuleTasks() { Execution execution = engineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(PROCESS_DEFINITION_KEY).singleResult(); // then the tenant id provider is invoked - assertThat(tenantIdProvider.dmnParameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.dmnParameters).hasSize(1); ExecutionEntity passedExecution = (ExecutionEntity) tenantIdProvider.dmnParameters.get(0).getExecution(); assertThat(passedExecution).isNotNull(); assertThat(passedExecution.getParent().getId()).isEqualTo(execution.getId()); @@ -776,7 +768,7 @@ public void providerCalledForCaseDefinitionWithoutTenantId() { engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create(); // then the tenant id provider is invoked - assertThat(tenantIdProvider.caseParameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.caseParameters).hasSize(1); } @Test @@ -792,7 +784,7 @@ public void providerNotCalledForCaseInstanceWithTenantId() { engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create(); // then the tenant id provider is not invoked - assertThat(tenantIdProvider.caseParameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.caseParameters).isEmpty(); } @Test @@ -807,7 +799,7 @@ public void providerCalledForCaseInstanceWithVariables() { engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariables(Variables.createVariables().putValue("varName", true)).create(); // then the tenant id provider is passed in the variable - assertThat(tenantIdProvider.caseParameters.size()).isEqualTo(1); + assertThat(tenantIdProvider.caseParameters).hasSize(1); assertThat((Boolean) tenantIdProvider.caseParameters.get(0).getVariables().get("varName")).isTrue(); } @@ -878,7 +870,7 @@ public void providerCalledForCaseDefinitionWithoutTenantId_SubCaseInstance() { engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create(); // then the tenant id provider is invoked twice - assertThat(tenantIdProvider.caseParameters.size()).isEqualTo(2); + assertThat(tenantIdProvider.caseParameters).hasSize(2); } @Test @@ -894,7 +886,7 @@ public void providerNotCalledForCaseDefinitionWithTenantId_SubCaseInstance() { engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create(); // then the tenant id provider is not invoked - assertThat(tenantIdProvider.caseParameters.size()).isEqualTo(0); + assertThat(tenantIdProvider.caseParameters).isEmpty(); } @Test @@ -909,7 +901,7 @@ public void providerCalledWithVariables_SubCaseInstance() { engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).setVariables(Variables.createVariables().putValue("varName", true)).create(); // then the tenant id provider is passed in the variable - assertThat(tenantIdProvider.caseParameters.get(1).getVariables().size()).isEqualTo(1); + assertThat(tenantIdProvider.caseParameters.get(1).getVariables()).hasSize(1); assertThat((Boolean) tenantIdProvider.caseParameters.get(1).getVariables().get("varName")).isTrue(); } @@ -1018,7 +1010,7 @@ public void providerCalledForCaseInstanceWithSuperCaseExecution() { engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create(); // then the tenant id provider is handed in the super case execution - assertThat(tenantIdProvider.caseParameters.size()).isEqualTo(2); + assertThat(tenantIdProvider.caseParameters).hasSize(2); assertThat(tenantIdProvider.caseParameters.get(1).getSuperCaseExecution()).isNotNull(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseDefinitionQueryTest.java index 4f1c1067ef2..6cbd3a0c3c3 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseDefinitionQueryTest.java @@ -246,7 +246,7 @@ public void testQueryByNonExistingTenantId() { .createCaseDefinitionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -306,7 +306,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeCaseDefinitionsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseExecutionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseExecutionQueryTest.java index f0791e14d31..037a5e64b3f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseExecutionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseExecutionQueryTest.java @@ -95,7 +95,7 @@ public void testQueryByNonExistingTenantId() { .createCaseExecutionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -157,7 +157,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(4L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseInstanceQueryTest.java index 50f7ee49a26..aaf5922741d 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/MultiTenancyCaseInstanceQueryTest.java @@ -95,7 +95,7 @@ public void testQueryByNonExistingTenantId() { .createCaseInstanceQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -153,7 +153,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseActivityInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseActivityInstanceQueryTest.java index d8b03b855cd..8c0c6ee6b38 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseActivityInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseActivityInstanceQueryTest.java @@ -134,7 +134,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -161,7 +161,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicCaseActivityInstances.size()).isEqualTo(3); + assertThat(historicCaseActivityInstances).hasSize(3); verifySorting(historicCaseActivityInstances, historicCaseActivityInstanceByTenantId()); } @@ -174,7 +174,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicCaseActivityInstances.size()).isEqualTo(3); + assertThat(historicCaseActivityInstances).hasSize(3); verifySorting(historicCaseActivityInstances, inverted(historicCaseActivityInstanceByTenantId())); } @@ -202,7 +202,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); // null-tenant instances are still included assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); assertThat(query.withoutTenantId().count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseInstanceQueryTest.java index 794e264aa29..551818b5a5e 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/cmmn/query/history/MultiTenancyHistoricCaseInstanceQueryTest.java @@ -123,7 +123,7 @@ public void shouldQueryByNonExistingTenantId() { .createHistoricCaseInstanceQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -146,7 +146,7 @@ public void shouldQuerySortingAsc() { .asc() .list(); - assertThat(historicCaseInstances.size()).isEqualTo(2); + assertThat(historicCaseInstances).hasSize(2); assertThat(historicCaseInstances.get(0).getTenantId()).isEqualTo(TENANT_ONE); assertThat(historicCaseInstances.get(1).getTenantId()).isEqualTo(TENANT_TWO); } @@ -160,7 +160,7 @@ public void shouldQuerySortingDesc() { .desc() .list(); - assertThat(historicCaseInstances.size()).isEqualTo(2); + assertThat(historicCaseInstances).hasSize(2); assertThat(historicCaseInstances.get(0).getTenantId()).isEqualTo(TENANT_TWO); assertThat(historicCaseInstances.get(1).getTenantId()).isEqualTo(TENANT_ONE); } @@ -181,7 +181,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionDefinitionQueryTest.java index fe360ae6133..f8250dbc5ce 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionDefinitionQueryTest.java @@ -249,7 +249,7 @@ public void testQueryByNonExistingTenantId() { .createDecisionDefinitionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -309,7 +309,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeDecisionDefinitionsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionRequirementsDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionRequirementsDefinitionQueryTest.java index 614575b611b..e010377b4cc 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionRequirementsDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDecisionRequirementsDefinitionQueryTest.java @@ -267,7 +267,7 @@ public void queryByNonExistingTenantId() { .createDecisionRequirementsDefinitionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -325,7 +325,7 @@ public void queryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeDecisionRequirementsDefinitionsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDeploymentQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDeploymentQueryTest.java index c6bff4eb3ba..7a688e21d84 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDeploymentQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyDeploymentQueryTest.java @@ -116,7 +116,7 @@ public void testQueryByNonExistingTenantId() { .createDeploymentQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -174,7 +174,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeDeploymentsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyEventSubscriptionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyEventSubscriptionQueryTest.java index cff3171a29d..220edcb6328 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyEventSubscriptionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyEventSubscriptionQueryTest.java @@ -124,7 +124,7 @@ public void testQueryByNonExistingTenantId() { createEventSubscriptionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -182,7 +182,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeEventSubscriptionsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExecutionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExecutionQueryTest.java index c76e56e4854..281e3e0189d 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExecutionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExecutionQueryTest.java @@ -100,7 +100,7 @@ public void testQueryByNonExistingTenantId() { .createExecutionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -158,7 +158,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExternalTaskQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExternalTaskQueryTest.java index 4e725c7676f..944cb0995e7 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExternalTaskQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyExternalTaskQueryTest.java @@ -91,7 +91,7 @@ public void testQueryByNonExistingTenantId() { .createExternalTaskQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -134,7 +134,7 @@ public void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); ExternalTaskQuery query = externalTaskService.createExternalTaskQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -145,7 +145,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyIncidentQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyIncidentQueryTest.java index 313da4c6b04..47020f6378b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyIncidentQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyIncidentQueryTest.java @@ -91,7 +91,7 @@ public void testQueryByNonExistingTenantId() { .createIncidentQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -134,7 +134,7 @@ public void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); IncidentQuery query = runtimeService.createIncidentQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -145,7 +145,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobDefinitionQueryTest.java index e81de3838d1..fb3dd065b07 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobDefinitionQueryTest.java @@ -124,7 +124,7 @@ public void testQueryByNonExistingTenantId() { .createJobDefinitionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -182,7 +182,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeJobDefinitionsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobQueryTest.java index 9f4589c9ad6..71840582078 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyJobQueryTest.java @@ -125,7 +125,7 @@ public void testQueryByNonExistingTenantId() { .createJobQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -183,7 +183,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeJobsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessDefinitionQueryTest.java index d952007fccf..96a3f825644 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessDefinitionQueryTest.java @@ -249,7 +249,7 @@ public void testQueryByNonExistingTenantId() { .createProcessDefinitionQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -318,7 +318,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).includeProcessDefinitionsWithoutTenantId().count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessInstanceQueryTest.java index 95c8f195358..9b9baa4d95f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyProcessInstanceQueryTest.java @@ -101,7 +101,7 @@ public void testQueryByNonExistingTenantId() { .createProcessInstanceQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -159,7 +159,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyStatisticsQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyStatisticsQueryTest.java index e5898e2b434..634a0752e06 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyStatisticsQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyStatisticsQueryTest.java @@ -215,7 +215,7 @@ public void testQueryNoAuthenticatedTenantForActivityStatistics() { ActivityStatisticsQuery query = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId()); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyTaskQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyTaskQueryTest.java index a5f2b11cabf..e398fbea153 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyTaskQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyTaskQueryTest.java @@ -103,7 +103,7 @@ public void testQueryWithAndWithoutTenantId() { .endOr(); // then - assertThat(query.list().size()).isEqualTo(3); + assertThat(query.list()).hasSize(3); } @Test @@ -111,7 +111,7 @@ public void testQueryByNonExistingTenantId() { TaskQuery query = taskService.createTaskQuery() .tenantIdIn(TENANT_NON_EXISTING); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -136,7 +136,7 @@ public void testQuerySortingAsc() { .asc() .list(); - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); assertThat(tasks.get(0).getTenantId()).isEqualTo(TENANT_ONE); assertThat(tasks.get(1).getTenantId()).isEqualTo(TENANT_TWO); } @@ -171,7 +171,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyUserOperationLogQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyUserOperationLogQueryTest.java index 956d14a7049..27f106b1849 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyUserOperationLogQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyUserOperationLogQueryTest.java @@ -125,7 +125,7 @@ public void shouldReturnResultsWhenMultipleTenants() { // then assertThat(historyService.createUserOperationLogQuery().entityType(EntityTypes.TASK).count()).isEqualTo(2); - assertThat(list.size()).isEqualTo(2); + assertThat(list).hasSize(2); assertThat(list.get(0).getTenantId()).isIn(null, TENANT_TWO); assertThat(list.get(1).getTenantId()).isIn(null, TENANT_TWO); } @@ -185,7 +185,7 @@ public void shouldReturnResultsWithoutTenantId() { // then assertThat(historyService.createUserOperationLogQuery().entityType(EntityTypes.TASK).withoutTenantId().count()).isOne(); - assertThat(list.size()).isEqualTo(1); + assertThat(list).hasSize(1); assertThat(list.get(0).getTenantId()).isEqualTo(null); } @@ -222,7 +222,7 @@ public void shouldReturnResultsTenantIdIn() { // then assertThat(historyService.createUserOperationLogQuery().entityType(EntityTypes.TASK).tenantIdIn(TENANT_TWO).count()).isOne(); - assertThat(list.size()).isEqualTo(1); + assertThat(list).hasSize(1); assertThat(list.get(0).getTenantId()).isEqualTo(TENANT_TWO); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyVariableInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyVariableInstanceQueryTest.java index a22fb048593..afcc4d7d8b9 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyVariableInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/MultiTenancyVariableInstanceQueryTest.java @@ -91,7 +91,7 @@ public void testQueryByNonExistingTenantId() { createVariableInstanceQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -134,7 +134,7 @@ public void testQueryNoAuthenticatedTenants() { identityService.setAuthentication("user", null, null); VariableInstanceQuery query = runtimeService.createVariableInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -145,7 +145,7 @@ public void testQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricActivityInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricActivityInstanceQueryTest.java index d7cc032ff05..d3fd22cfaf8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricActivityInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricActivityInstanceQueryTest.java @@ -138,7 +138,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -164,7 +164,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicActivityInstances.size()).isEqualTo(6); + assertThat(historicActivityInstances).hasSize(6); verifySorting(historicActivityInstances, historicActivityInstanceByTenantId()); } @@ -177,7 +177,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicActivityInstances.size()).isEqualTo(6); + assertThat(historicActivityInstances).hasSize(6); verifySorting(historicActivityInstances, inverted(historicActivityInstanceByTenantId())); } @@ -205,7 +205,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(4L); // null-tenant instances are still included assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); assertThat(query.withoutTenantId().count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceQueryTest.java index 56b4a31af1a..6151e2467d9 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceQueryTest.java @@ -123,7 +123,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -146,7 +146,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); verifySorting(historicDecisionInstances, historicDecisionInstanceByTenantId()); } @@ -159,7 +159,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicDecisionInstances.size()).isEqualTo(3); + assertThat(historicDecisionInstances).hasSize(3); verifySorting(historicDecisionInstances, inverted(historicDecisionInstanceByTenantId())); } @@ -187,7 +187,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); // null-tenant instances are also visible assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); assertThat(query.withoutTenantId().count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceStatisticsQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceStatisticsQueryTest.java index 62e5070a2ef..390e0ff04d6 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceStatisticsQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDecisionInstanceStatisticsQueryTest.java @@ -88,7 +88,7 @@ public void testQueryNoAuthenticatedTenants() { HistoricDecisionInstanceStatisticsQuery query = historyService. createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId()); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailFormPropertyQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailFormPropertyQueryTest.java index 1acf213f037..8d0e2ba4303 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailFormPropertyQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailFormPropertyQueryTest.java @@ -164,7 +164,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -192,7 +192,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicDetails.size()).isEqualTo(3); + assertThat(historicDetails).hasSize(3); verifySorting(historicDetails, historicDetailByTenantId()); } @@ -206,7 +206,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicDetails.size()).isEqualTo(3); + assertThat(historicDetails).hasSize(3); verifySorting(historicDetails, inverted(historicDetailByTenantId())); } @@ -234,7 +234,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(4L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); assertThat(query.withoutTenantId().count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailVariableUpdateQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailVariableUpdateQueryTest.java index 77cf2522461..f24064ca4d2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailVariableUpdateQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricDetailVariableUpdateQueryTest.java @@ -162,7 +162,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -190,7 +190,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicDetails.size()).isEqualTo(6); + assertThat(historicDetails).hasSize(6); verifySorting(historicDetails, historicDetailByTenantId()); } @@ -204,7 +204,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicDetails.size()).isEqualTo(6); + assertThat(historicDetails).hasSize(6); verifySorting(historicDetails, inverted(historicDetailByTenantId())); } @@ -232,7 +232,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(4L); // null-tenant instances are still included assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); assertThat(query.withoutTenantId().count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricExternalTaskLogTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricExternalTaskLogTest.java index 4c61168b033..3a75f14fc4f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricExternalTaskLogTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricExternalTaskLogTest.java @@ -158,7 +158,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -188,7 +188,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(HistoricExternalTaskLogs.size()).isEqualTo(5); + assertThat(HistoricExternalTaskLogs).hasSize(5); assertThat(HistoricExternalTaskLogs.get(0).getTenantId()).isEqualTo(TENANT_ONE); assertThat(HistoricExternalTaskLogs.get(1).getTenantId()).isEqualTo(TENANT_ONE); assertThat(HistoricExternalTaskLogs.get(2).getTenantId()).isEqualTo(TENANT_TWO); @@ -208,7 +208,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(HistoricExternalTaskLogs.size()).isEqualTo(5); + assertThat(HistoricExternalTaskLogs).hasSize(5); assertThat(HistoricExternalTaskLogs.get(0).getTenantId()).isEqualTo(TENANT_TWO); assertThat(HistoricExternalTaskLogs.get(1).getTenantId()).isEqualTo(TENANT_TWO); assertThat(HistoricExternalTaskLogs.get(2).getTenantId()).isEqualTo(TENANT_TWO); @@ -226,7 +226,7 @@ public void shouldQueryNoAuthenticatedTenants() { HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery(); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -240,7 +240,7 @@ public void shouldQueryAuthenticatedTenant() { // then assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); } @@ -293,9 +293,9 @@ public void shouldGetErrorDetailsNoAuthenticatedTenants() { } catch (ProcessEngineException e) { // then String errorMessage = e.getMessage(); - assertThat(errorMessage.contains("Cannot get the historic external task log ")).isEqualTo(true); - assertThat(errorMessage.contains(failedHistoricExternalTaskLogId)).isEqualTo(true); - assertThat(errorMessage.contains("because it belongs to no authenticated tenant.")).isEqualTo(true); + assertThat(errorMessage).contains("Cannot get the historic external task log "); + assertThat(errorMessage).contains(failedHistoricExternalTaskLogId); + assertThat(errorMessage).contains("because it belongs to no authenticated tenant."); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIdentityLinkLogQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIdentityLinkLogQueryTest.java index 7bf39a2bbc1..2ab5612ff24 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIdentityLinkLogQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIdentityLinkLogQueryTest.java @@ -135,7 +135,7 @@ public void shouldAddHistoricIdentityLinkForMultipleTenants() { .createHistoricIdentityLinkLogQuery(); // then - assertThat(query.list().size()).isEqualTo(2); + assertThat(query.list()).hasSize(2); assertThat(query.tenantIdIn(TENANT_1).count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_2).count()).isEqualTo(1L); } @@ -203,12 +203,12 @@ public void shouldAddIdentityLinksForProcessDefinitionWithTenantId() throws Exce // then // Identity link test List identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition1.getId()); - assertThat(identityLinks.size()).isEqualTo(2); + assertThat(identityLinks).hasSize(2); assertThat(identityLinks.get(0).getTenantId()).isEqualTo(TENANT_1); assertThat(identityLinks.get(1).getTenantId()).isEqualTo(TENANT_1); identityLinks = repositoryService.getIdentityLinksForProcessDefinition(processDefinition2.getId()); - assertThat(identityLinks.size()).isEqualTo(2); + assertThat(identityLinks).hasSize(2); assertThat(identityLinks.get(0).getTenantId()).isEqualTo(TENANT_2); assertThat(identityLinks.get(1).getTenantId()).isEqualTo(TENANT_2); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIncidentQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIncidentQueryTest.java index 5d08ee01fe8..04096fef5b5 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIncidentQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricIncidentQueryTest.java @@ -141,7 +141,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -167,7 +167,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicIncidents.size()).isEqualTo(3); + assertThat(historicIncidents).hasSize(3); verifySorting(historicIncidents, historicIncidentByTenantId()); } @@ -180,7 +180,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicIncidents.size()).isEqualTo(3); + assertThat(historicIncidents).hasSize(3); verifySorting(historicIncidents, inverted(historicIncidentByTenantId())); } @@ -208,7 +208,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); // null-tenant incidents are still included assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); assertThat(query.withoutTenantId().count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricJobLogQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricJobLogQueryTest.java index 9a432de33bb..bbd00824539 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricJobLogQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricJobLogQueryTest.java @@ -142,7 +142,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -168,7 +168,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicJobLogs.size()).isEqualTo(6); + assertThat(historicJobLogs).hasSize(6); verifySorting(historicJobLogs, historicJobLogByTenantId()); } @@ -181,7 +181,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicJobLogs.size()).isEqualTo(6); + assertThat(historicJobLogs).hasSize(6); verifySorting(historicJobLogs, inverted(historicJobLogByTenantId())); } @@ -209,7 +209,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(4L); // null-tenant entries are still included assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); assertThat(query.withoutTenantId().count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricProcessInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricProcessInstanceQueryTest.java index 276bfdad021..9f6144195af 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricProcessInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricProcessInstanceQueryTest.java @@ -117,7 +117,7 @@ public void shouldQueryByNonExistingTenantId() { .createHistoricProcessInstanceQuery() .tenantIdIn("nonExisting"); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -148,7 +148,7 @@ public void shouldQuerySortingAsc() { .asc() .list(); - assertThat(historicProcessInstances.size()).isEqualTo(2); + assertThat(historicProcessInstances).hasSize(2); assertThat(historicProcessInstances.get(0).getTenantId()).isEqualTo(TENANT_ONE); assertThat(historicProcessInstances.get(1).getTenantId()).isEqualTo(TENANT_TWO); } @@ -161,7 +161,7 @@ public void shouldQuerySortingDesc() { .desc() .list(); - assertThat(historicProcessInstances.size()).isEqualTo(2); + assertThat(historicProcessInstances).hasSize(2); assertThat(historicProcessInstances.get(0).getTenantId()).isEqualTo(TENANT_TWO); assertThat(historicProcessInstances.get(1).getTenantId()).isEqualTo(TENANT_ONE); } @@ -182,7 +182,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricTaskInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricTaskInstanceQueryTest.java index fefd8db491f..f16983ef41e 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricTaskInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricTaskInstanceQueryTest.java @@ -148,7 +148,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -174,7 +174,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicTaskInstances.size()).isEqualTo(3); + assertThat(historicTaskInstances).hasSize(3); verifySorting(historicTaskInstances, historicTaskInstanceByTenantId()); } @@ -187,7 +187,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicTaskInstances.size()).isEqualTo(3); + assertThat(historicTaskInstances).hasSize(3); verifySorting(historicTaskInstances, inverted(historicTaskInstanceByTenantId())); } @@ -215,7 +215,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); // null-tenant instances are included assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); assertThat(query.withoutTenantId().count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricVariableInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricVariableInstanceQueryTest.java index 20ff7c7ed71..392ac1df27a 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricVariableInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancyHistoricVariableInstanceQueryTest.java @@ -148,7 +148,7 @@ public void shouldQueryByNonExistingTenantId() { .tenantIdIn("nonExisting"); // then - assertThat(query.count()).isEqualTo(0); + assertThat(query.count()).isZero(); } @Test @@ -174,7 +174,7 @@ public void shouldQuerySortingAsc() { .list(); // then - assertThat(historicVariableInstances.size()).isEqualTo(3); // null-tenant instances are still included + assertThat(historicVariableInstances).hasSize(3); // null-tenant instances are still included verifySorting(historicVariableInstances, historicVariableInstanceByTenantId()); } @@ -187,7 +187,7 @@ public void shouldQuerySortingDesc() { .list(); // then - assertThat(historicVariableInstances.size()).isEqualTo(3); // null-tenant instances are still included + assertThat(historicVariableInstances).hasSize(3); // null-tenant instances are still included verifySorting(historicVariableInstances, inverted(historicVariableInstanceByTenantId())); } @@ -215,7 +215,7 @@ public void shouldQueryAuthenticatedTenant() { assertThat(query.count()).isEqualTo(2L); // null-tenant instances are still included assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); assertThat(query.withoutTenantId().count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(query.tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancySharedDecisionInstanceStatisticsQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancySharedDecisionInstanceStatisticsQueryTest.java index 4b6ff5ea692..75e83a86186 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancySharedDecisionInstanceStatisticsQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/query/history/MultiTenancySharedDecisionInstanceStatisticsQueryTest.java @@ -100,7 +100,7 @@ public void testQueryNoAuthenticatedTenants() { HistoricDecisionInstanceStatisticsQuery query = historyService. createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId()); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobDefinitionSuspensionStateTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobDefinitionSuspensionStateTest.java index fb2f182c2b7..6832d64f8e9 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobDefinitionSuspensionStateTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobDefinitionSuspensionStateTest.java @@ -82,7 +82,7 @@ public void suspendAndActivateJobDefinitionsForAllTenants() { // given activated job definitions JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getManagementService() @@ -90,7 +90,7 @@ public void suspendAndActivateJobDefinitionsForAllTenants() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -100,7 +100,7 @@ public void suspendAndActivateJobDefinitionsForAllTenants() { .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -108,7 +108,7 @@ public void suspendJobDefinitionForTenant() { // given activated job definitions JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -126,7 +126,7 @@ public void suspendJobDefinitionForNonTenant() { // given activated job definitions JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -149,7 +149,7 @@ public void activateJobDefinitionForTenant() { JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -172,7 +172,7 @@ public void jobProcessDefinitionForNonTenant() { JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -190,7 +190,7 @@ public void suspendAndActivateJobDefinitionsIncludingJobsForAllTenants() { // given activated job definitions JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getManagementService() @@ -199,7 +199,7 @@ public void suspendAndActivateJobDefinitionsIncludingJobsForAllTenants() { .includeJobs(true) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -210,7 +210,7 @@ public void suspendAndActivateJobDefinitionsIncludingJobsForAllTenants() { .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -218,7 +218,7 @@ public void suspendJobDefinitionIncludingJobsForTenant() { // given activated job definitions JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -237,7 +237,7 @@ public void suspendJobDefinitionIncludingJobsForNonTenant() { // given activated job definitions JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -262,7 +262,7 @@ public void activateJobDefinitionIncludingJobsForTenant() { JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -287,7 +287,7 @@ public void activateJobDefinitionIncludingJobsForNonTenant() { JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getManagementService() .updateJobDefinitionSuspensionState() @@ -313,7 +313,7 @@ public void delayedSuspendJobDefinitionsForAllTenants() { JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // when execute the job to suspend the job definitions Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -322,7 +322,7 @@ public void delayedSuspendJobDefinitionsForAllTenants() { engineRule.getManagementService().executeJob(job.getId()); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); } @@ -339,7 +339,7 @@ public void delayedSuspendJobDefinitionsForTenant() { JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // when execute the job to suspend the job definitions Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -368,7 +368,7 @@ public void delayedSuspendJobDefinitionsForNonTenant() { JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // when execute the job to suspend the job definitions Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -399,7 +399,7 @@ public void delayedActivateJobDefinitionsForAllTenants() { .activate(); JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // when execute the job to activate the job definitions @@ -409,7 +409,7 @@ public void delayedActivateJobDefinitionsForAllTenants() { engineRule.getManagementService().executeJob(job.getId()); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); assertThat(query.active().count()).isEqualTo(3L); } @@ -429,7 +429,7 @@ public void delayedActivateJobDefinitionsForTenant() { .activate(); JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // when execute the job to activate the job definitions @@ -462,7 +462,7 @@ public void delayedActivateJobDefinitionsForNonTenant() { .activate(); JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // when execute the job to activate the job definitions @@ -484,7 +484,7 @@ public void suspendJobDefinitionNoAuthenticatedTenants() { // given activated job definitions JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, null); @@ -505,7 +505,7 @@ public void suspendJobDefinitionWithAuthenticatedTenant() { // given activated job definitions JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE)); @@ -528,7 +528,7 @@ public void suspendJobDefinitionDisabledTenantCheck() { // given activated job definitions JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false); engineRule.getIdentityService().setAuthentication("user", null, null); @@ -538,7 +538,7 @@ public void suspendJobDefinitionDisabledTenantCheck() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); assertThat(query.suspended().tenantIdIn(TENANT_ONE, TENANT_TWO).includeJobDefinitionsWithoutTenantId().count()).isEqualTo(3L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobSuspensionStateTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobSuspensionStateTest.java index d183f2983a5..dfe9153854c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobSuspensionStateTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyJobSuspensionStateTest.java @@ -68,7 +68,7 @@ public void suspendAndActivateJobsForAllTenants() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getManagementService() @@ -76,7 +76,7 @@ public void suspendAndActivateJobsForAllTenants() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -86,7 +86,7 @@ public void suspendAndActivateJobsForAllTenants() { .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -94,7 +94,7 @@ public void suspendJobForTenant() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getManagementService() .updateJobSuspensionState() @@ -112,7 +112,7 @@ public void suspendJobsForNonTenant() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getManagementService() .updateJobSuspensionState() @@ -135,7 +135,7 @@ public void activateJobsForTenant() { JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getManagementService() .updateJobSuspensionState() @@ -158,7 +158,7 @@ public void activateJobsForNonTenant() { JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getManagementService() .updateJobSuspensionState() @@ -176,7 +176,7 @@ public void suspendJobNoAuthenticatedTenants() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, null); @@ -197,7 +197,7 @@ public void suspendJobWithAuthenticatedTenant() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE)); @@ -220,7 +220,7 @@ public void suspendJobDisabledTenantCheck() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false); engineRule.getIdentityService().setAuthentication("user", null, null); @@ -230,7 +230,7 @@ public void suspendJobDisabledTenantCheck() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); assertThat(query.suspended().tenantIdIn(TENANT_ONE, TENANT_TWO).includeJobsWithoutTenantId().count()).isEqualTo(3L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTenantIdProviderTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTenantIdProviderTest.java index bfcf95e34d4..6acafc989c8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTenantIdProviderTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTenantIdProviderTest.java @@ -74,7 +74,7 @@ public void suspendProcessDefinitionByIdIncludeInstancesFromAllTenants() { ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery().processDefinitionId(processDefinition.getId()); assertThat(query.active().count()).isEqualTo(1L); assertThat(query.active().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // suspend all instances of process definition engineRule.getRepositoryService() @@ -83,7 +83,7 @@ public void suspendProcessDefinitionByIdIncludeInstancesFromAllTenants() { .includeProcessInstances(true) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(1L); assertThat(query.suspended().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); } @@ -107,7 +107,7 @@ public void activateProcessDefinitionByIdIncludeInstancesFromAllTenants() { ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery().processDefinitionId(processDefinition.getId()); assertThat(query.suspended().count()).isEqualTo(1L); assertThat(query.suspended().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); // activate all instance of process definition engineRule.getRepositoryService() @@ -116,7 +116,7 @@ public void activateProcessDefinitionByIdIncludeInstancesFromAllTenants() { .includeProcessInstances(true) .activate(); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); assertThat(query.active().count()).isEqualTo(1L); assertThat(query.active().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTest.java index c3120f891c5..807e0032815 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessDefinitionSuspensionStateTest.java @@ -86,7 +86,7 @@ public void suspendAndActivateProcessDefinitionsForAllTenants() { // given activated process definitions ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getRepositoryService() @@ -94,7 +94,7 @@ public void suspendAndActivateProcessDefinitionsForAllTenants() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -104,7 +104,7 @@ public void suspendAndActivateProcessDefinitionsForAllTenants() { .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -112,7 +112,7 @@ public void suspendProcessDefinitionForTenant() { // given activated process definitions ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -130,7 +130,7 @@ public void suspendProcessDefinitionForNonTenant() { // given activated process definitions ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -153,7 +153,7 @@ public void activateProcessDefinitionForTenant() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -176,7 +176,7 @@ public void activateProcessDefinitionForNonTenant() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -194,7 +194,7 @@ public void suspendAndActivateProcessDefinitionsIncludeInstancesForAllTenants() // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getRepositoryService() @@ -203,7 +203,7 @@ public void suspendAndActivateProcessDefinitionsIncludeInstancesForAllTenants() .includeProcessInstances(true) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -214,7 +214,7 @@ public void suspendAndActivateProcessDefinitionsIncludeInstancesForAllTenants() .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -222,7 +222,7 @@ public void suspendProcessDefinitionIncludeInstancesForTenant() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -241,7 +241,7 @@ public void suspendProcessDefinitionIncludeInstancesForNonTenant() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -266,7 +266,7 @@ public void activateProcessDefinitionIncludeInstancesForTenant() { ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -291,7 +291,7 @@ public void activateProcessDefinitionIncludeInstancesForNonTenant() { ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -317,7 +317,7 @@ public void delayedSuspendProcessDefinitionsForAllTenants() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // when execute the job to suspend the process definitions Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -327,7 +327,7 @@ public void delayedSuspendProcessDefinitionsForAllTenants() { engineRule.getManagementService().executeJob(job.getId()); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); } @@ -344,7 +344,7 @@ public void delayedSuspendProcessDefinitionsForTenant() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // when execute the job to suspend the process definition Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -373,7 +373,7 @@ public void delayedSuspendProcessDefinitionsForNonTenant() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // when execute the job to suspend the process definition Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -405,7 +405,7 @@ public void delayedActivateProcessDefinitionsForAllTenants() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); // when execute the job to activate the process definitions Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -415,7 +415,7 @@ public void delayedActivateProcessDefinitionsForAllTenants() { engineRule.getManagementService().executeJob(job.getId()); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); assertThat(query.active().count()).isEqualTo(3L); } @@ -436,7 +436,7 @@ public void delayedActivateProcessDefinitionsForTenant() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); // when execute the job to activate the process definition Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -469,7 +469,7 @@ public void delayedActivateProcessDefinitionsForNonTenant() { ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.suspended().count()).isEqualTo(3L); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); // when execute the job to activate the process definition Job job = engineRule.getManagementService().createJobQuery().timers().singleResult(); @@ -490,14 +490,14 @@ public void suspendProcessDefinitionIncludingJobDefinitionsForAllTenants() { // given activated jobs JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); } @@ -506,7 +506,7 @@ public void suspendProcessDefinitionIncludingJobDefinitionsForTenant() { // given activated jobs JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -524,7 +524,7 @@ public void suspendProcessDefinitionIncludingJobDefinitionsForNonTenant() { // given activated jobs JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRepositoryService() .updateProcessDefinitionSuspensionState() @@ -546,7 +546,7 @@ public void activateProcessDefinitionIncludingJobDefinitionsForAllTenants() { .suspend(); JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRepositoryService() @@ -554,7 +554,7 @@ public void activateProcessDefinitionIncludingJobDefinitionsForAllTenants() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .activate(); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); assertThat(query.active().count()).isEqualTo(3L); } @@ -567,7 +567,7 @@ public void activateProcessDefinitionIncludingJobDefinitionsForTenant() { .suspend(); JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRepositoryService() @@ -590,7 +590,7 @@ public void activateProcessDefinitionIncludingJobDefinitionsForNonTenant() { .suspend(); JobDefinitionQuery query = engineRule.getManagementService().createJobDefinitionQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRepositoryService() @@ -609,7 +609,7 @@ public void suspendProcessDefinitionNoAuthenticatedTenants() { // given activated process definitions ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, null); @@ -647,7 +647,7 @@ public void suspendProcessDefinitionWithAuthenticatedTenant() { // given activated process definitions ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE)); @@ -670,7 +670,7 @@ public void suspendProcessDefinitionDisabledTenantCheck() { // given activated process definitions ProcessDefinitionQuery query = engineRule.getRepositoryService().createProcessDefinitionQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); ProcessEngineConfigurationImpl processEngineConfiguration = engineRule.getProcessEngineConfiguration(); processEngineConfiguration.setTenantCheckEnabled(false); @@ -681,7 +681,7 @@ public void suspendProcessDefinitionDisabledTenantCheck() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); assertThat(query.suspended().tenantIdIn(TENANT_ONE, TENANT_TWO).includeProcessDefinitionsWithoutTenantId().count()).isEqualTo(3L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessInstanceSuspensionStateTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessInstanceSuspensionStateTest.java index 92238b1f018..9d4be0b72ee 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessInstanceSuspensionStateTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/suspensionstate/MultiTenancyProcessInstanceSuspensionStateTest.java @@ -80,7 +80,7 @@ public void suspendAndActivateProcessInstancesForAllTenants() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getRuntimeService() @@ -88,7 +88,7 @@ public void suspendAndActivateProcessInstancesForAllTenants() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -98,7 +98,7 @@ public void suspendAndActivateProcessInstancesForAllTenants() { .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -106,7 +106,7 @@ public void suspendProcessInstanceForTenant() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -124,7 +124,7 @@ public void suspendProcessInstanceForNonTenant() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -146,7 +146,7 @@ public void activateProcessInstanceForTenant() { .suspend(); ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -169,7 +169,7 @@ public void activateProcessInstanceForNonTenant() { .suspend(); ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -188,7 +188,7 @@ public void suspendAndActivateProcessInstancesIncludingUserTasksForAllTenants() // given activated user tasks TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getRuntimeService() @@ -196,7 +196,7 @@ public void suspendAndActivateProcessInstancesIncludingUserTasksForAllTenants() .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -206,7 +206,7 @@ public void suspendAndActivateProcessInstancesIncludingUserTasksForAllTenants() .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -214,7 +214,7 @@ public void suspendProcessInstanceIncludingUserTaskForTenant() { // given activated user tasks TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -232,7 +232,7 @@ public void suspendProcessInstanceIncludingUserTaskForNonTenant() { // given activated user tasks TaskQuery query = engineRule.getTaskService().createTaskQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -254,7 +254,7 @@ public void activateProcessInstanceIncludingUserTaskForTenant() { .suspend(); TaskQuery query = engineRule.getTaskService().createTaskQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -277,7 +277,7 @@ public void activateProcessInstanceIncludingUserTaskForNonTenant() { .suspend(); TaskQuery query = engineRule.getTaskService().createTaskQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -296,7 +296,7 @@ public void suspendAndActivateProcessInstancesIncludingExternalTasksForAllTenant // given activated external tasks ExternalTaskQuery query = engineRule.getExternalTaskService().createExternalTaskQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getRuntimeService() @@ -304,7 +304,7 @@ public void suspendAndActivateProcessInstancesIncludingExternalTasksForAllTenant .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -314,7 +314,7 @@ public void suspendAndActivateProcessInstancesIncludingExternalTasksForAllTenant .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -322,7 +322,7 @@ public void suspendProcessInstanceIncludingExternalTaskForTenant() { // given activated external tasks ExternalTaskQuery query = engineRule.getExternalTaskService().createExternalTaskQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -340,7 +340,7 @@ public void suspendProcessInstanceIncludingExternalTaskForNonTenant() { // given activated external tasks ExternalTaskQuery query = engineRule.getExternalTaskService().createExternalTaskQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -362,7 +362,7 @@ public void activateProcessInstanceIncludingExternalTaskForTenant() { .suspend(); ExternalTaskQuery query = engineRule.getExternalTaskService().createExternalTaskQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -385,7 +385,7 @@ public void activateProcessInstanceIncludingExternalTaskForNonTenant() { .suspend(); ExternalTaskQuery query = engineRule.getExternalTaskService().createExternalTaskQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -404,7 +404,7 @@ public void suspendAndActivateProcessInstancesIncludingJobsForAllTenants() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); // first suspend engineRule.getRuntimeService() @@ -412,7 +412,7 @@ public void suspendAndActivateProcessInstancesIncludingJobsForAllTenants() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); // then activate @@ -422,7 +422,7 @@ public void suspendAndActivateProcessInstancesIncludingJobsForAllTenants() { .activate(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); } @Test @@ -430,7 +430,7 @@ public void suspendProcessInstanceIncludingJobForTenant() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -448,7 +448,7 @@ public void suspendProcessInstanceIncludingJobForNonTenant() { // given activated jobs JobQuery query = engineRule.getManagementService().createJobQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getRuntimeService() .updateProcessInstanceSuspensionState() @@ -470,7 +470,7 @@ public void activateProcessInstanceIncludingJobForTenant() { .suspend(); JobQuery query = engineRule.getManagementService().createJobQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -493,7 +493,7 @@ public void activateProcessInstanceIncludingJobForNonTenant() { .suspend(); JobQuery query = engineRule.getManagementService().createJobQuery(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); engineRule.getRuntimeService() @@ -512,7 +512,7 @@ public void suspendProcessInstanceNoAuthenticatedTenants() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, null); @@ -550,7 +550,7 @@ public void suspendProcessInstanceWithAuthenticatedTenant() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getIdentityService().setAuthentication("user", null, Arrays.asList(TENANT_ONE)); @@ -573,7 +573,7 @@ public void suspendProcessInstanceDisabledTenantCheck() { // given activated process instances ProcessInstanceQuery query = engineRule.getRuntimeService().createProcessInstanceQuery(); assertThat(query.active().count()).isEqualTo(3L); - assertThat(query.suspended().count()).isEqualTo(0L); + assertThat(query.suspended().count()).isZero(); engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false); engineRule.getIdentityService().setAuthentication("user", null, null); @@ -583,7 +583,7 @@ public void suspendProcessInstanceDisabledTenantCheck() { .byProcessDefinitionKey(PROCESS_DEFINITION_KEY) .suspend(); - assertThat(query.active().count()).isEqualTo(0L); + assertThat(query.active().count()).isZero(); assertThat(query.suspended().count()).isEqualTo(3L); assertThat(query.suspended().tenantIdIn(TENANT_ONE, TENANT_TWO).count()).isEqualTo(2L); assertThat(query.suspended().withoutTenantId().count()).isEqualTo(1L); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyCaseInstanceCmdsTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyCaseInstanceCmdsTenantCheckTest.java index c44c2802eab..89bb07506f2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyCaseInstanceCmdsTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyCaseInstanceCmdsTenantCheckTest.java @@ -351,7 +351,7 @@ public void getVariablesWithAuthenticatedTenant() { Map variables = caseService.getVariables(caseExecutionId); assertThat(variables).isNotNull(); - assertThat(variables.keySet()).contains(VARIABLE_NAME); + assertThat(variables).containsKey(VARIABLE_NAME); } @Test @@ -362,7 +362,7 @@ public void getVariablesDisabledTenantCheck() { Map variables = caseService.getVariables(caseExecutionId); assertThat(variables).isNotNull(); - assertThat(variables.keySet()).contains(VARIABLE_NAME); + assertThat(variables).containsKey(VARIABLE_NAME); } @Test @@ -442,7 +442,7 @@ public void removeVariablesWithAuthenticatedTenant() { identityService.clearAuthentication(); Map variables = caseService.getVariables(caseExecutionId); - assertThat(variables.isEmpty()).isTrue(); + assertThat(variables).isEmpty(); } @Test @@ -455,7 +455,7 @@ public void removeVariablesDisabledTenantCheck() { identityService.clearAuthentication(); Map variables = caseService.getVariables(caseExecutionId); - assertThat(variables.isEmpty()).isTrue(); + assertThat(variables).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyDeploymentCmdsTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyDeploymentCmdsTenantCheckTest.java index b7152ba005f..da5553820d0 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyDeploymentCmdsTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyDeploymentCmdsTenantCheckTest.java @@ -137,8 +137,8 @@ public void deleteDeploymentWithAuthenticatedTenant() { identityService.clearAuthentication(); DeploymentQuery query = repositoryService.createDeploymentQuery(); - assertThat(query.count()).isEqualTo(0L); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(query.count()).isZero(); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); } @Test @@ -153,9 +153,9 @@ public void deleteDeploymentDisabledTenantCheck() { repositoryService.deleteDeployment(deploymentTwo.getId()); DeploymentQuery query = repositoryService.createDeploymentQuery(); - assertThat(query.count()).isEqualTo(0L); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.count()).isZero(); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyExternalTaskCmdsTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyExternalTaskCmdsTenantCheckTest.java index 5dfc681f0a7..da6b40a1951 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyExternalTaskCmdsTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyExternalTaskCmdsTenantCheckTest.java @@ -228,7 +228,7 @@ public void testCompleteWithAuthenticatedTenant() { externalTaskService.complete(externalTaskId, WORKER_ID); - assertThat(externalTaskService.createExternalTaskQuery().active().count()).isEqualTo(0L); + assertThat(externalTaskService.createExternalTaskQuery().active().count()).isZero(); } @@ -269,7 +269,7 @@ public void testCompleteWithDisableTenantCheck() { externalTaskService.complete(externalTaskId, WORKER_ID); // then - assertThat(externalTaskService.createExternalTaskQuery().active().count()).isEqualTo(0L); + assertThat(externalTaskService.createExternalTaskQuery().active().count()).isZero(); } // handle failure test cases @@ -523,7 +523,7 @@ public void testUnlockWithAuthenticatedTenant() { externalTaskService.unlock(externalTaskId); // then - assertThat(externalTaskService.createExternalTaskQuery().locked().count()).isEqualTo(0L); + assertThat(externalTaskService.createExternalTaskQuery().locked().count()).isZero(); } @Test @@ -558,7 +558,7 @@ public void testUnlockWithDisabledTenantCheck() { externalTaskService.unlock(externalTaskId); // then - assertThat(externalTaskService.createExternalTaskQuery().locked().count()).isEqualTo(0L); + assertThat(externalTaskService.createExternalTaskQuery().locked().count()).isZero(); } // get error details tests diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricDataCmdsTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricDataCmdsTenantCheckTest.java index 985becbd7a9..6d5c7cf69b8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricDataCmdsTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricDataCmdsTenantCheckTest.java @@ -146,7 +146,7 @@ public void deleteHistoricProcessInstanceWithAuthenticatedTenant() { HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -164,7 +164,7 @@ public void deleteHistoricProcessInstanceWithDisabledTenantCheck() { historyService.deleteHistoricProcessInstance(processInstanceIdTwo); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -191,7 +191,7 @@ public void deleteHistoricTaskInstanceWithAuthenticatedTenant() { HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -207,7 +207,7 @@ public void deleteHistoricTaskInstanceWithDisabledTenantCheck() { HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -236,7 +236,7 @@ public void deleteHistoricCaseInstanceWithAuthenticatedTenant() { HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -254,7 +254,7 @@ public void deleteHistoricCaseInstanceWithDisabledTenantCheck() { historyService.deleteHistoricCaseInstance(caseInstanceIdTwo); HistoricCaseInstanceQuery query = historyService.createHistoricCaseInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -287,7 +287,7 @@ public void deleteHistoricDecisionInstanceWithAuthenticatedTenant() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -305,7 +305,7 @@ public void deleteHistoricDecisionInstanceWithDisabledTenantCheck() { historyService.deleteHistoricDecisionInstanceByDefinitionId(decisionDefinitionIdTwo); HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -344,7 +344,7 @@ public void deleteHistoricDecisionInstanceByInstanceIdWithAuthenticatedTenant() // then identityService.clearAuthentication(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -360,7 +360,7 @@ public void deleteHistoricDecisionInstanceByInstanceIdWithDisabledTenantCheck() HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); List historicDecisionInstances = query.includeInputs().includeOutputs().list(); - assertThat(historicDecisionInstances.size()).isEqualTo(2); + assertThat(historicDecisionInstances).hasSize(2); // when user has no authorization identityService.setAuthentication("user", null, null); @@ -373,7 +373,7 @@ public void deleteHistoricDecisionInstanceByInstanceIdWithDisabledTenantCheck() // then identityService.clearAuthentication(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -464,7 +464,7 @@ public void deleteHistoricVariableInstanceWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); historyService.deleteHistoricVariableInstance(variableInstanceId); - assertThat(variableQuery.count()).isEqualTo(0L); + assertThat(variableQuery.count()).isZero(); cleanUpAfterVariableInstanceTest(processInstanceId); } @@ -491,8 +491,8 @@ public void deleteHistoricVariableInstanceWithDisabledTenantCheck() { historyService.deleteHistoricVariableInstance(variableInstanceIdOne); historyService.deleteHistoricVariableInstance(variableInstanceIdTwo); - assertThat(variableQueryOne.count()).isEqualTo(0L); - assertThat(variableQueryTwo.count()).isEqualTo(0L); + assertThat(variableQueryOne.count()).isZero(); + assertThat(variableQueryTwo.count()).isZero(); cleanUpAfterVariableInstanceTest(processInstanceIdOne, processInstanceIdTwo); } @@ -532,7 +532,7 @@ public void deleteHistoricVariableInstancesWithAuthenticatedTenant() { identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE)); historyService.deleteHistoricVariableInstancesByProcessInstanceId(processInstanceId); - assertThat(variableQuery.count()).isEqualTo(0L); + assertThat(variableQuery.count()).isZero(); cleanUpAfterVariableInstanceTest(processInstanceId); } @@ -558,11 +558,11 @@ public void deleteHistoricVariableInstancesWithDisabledTenantCheck() { processEngineConfiguration.setTenantCheckEnabled(false); historyService.deleteHistoricVariableInstancesByProcessInstanceId(processInstanceIdOne); - assertThat(variableQueryOne.count()).isEqualTo(0L); + assertThat(variableQueryOne.count()).isZero(); assertThat(variableQueryTwo.count()).isEqualTo(2L); historyService.deleteHistoricVariableInstancesByProcessInstanceId(processInstanceIdTwo); - assertThat(variableQueryTwo.count()).isEqualTo(0L); + assertThat(variableQueryTwo.count()).isZero(); cleanUpAfterVariableInstanceTest(processInstanceIdOne, processInstanceIdTwo); } @@ -633,7 +633,7 @@ protected void cleanUpAfterVariableInstanceTest(String... processInstanceIds) { identityService.clearAuthentication(); HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery(); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); processEngineConfiguration.setTenantCheckEnabled(true); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricProcessInstanceReportCmdTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricProcessInstanceReportCmdTenantCheckTest.java index b29de46bf13..a515197107e 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricProcessInstanceReportCmdTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyHistoricProcessInstanceReportCmdTenantCheckTest.java @@ -96,7 +96,7 @@ public void getDurationReportByMonthNoAuthenticatedTenants() { .createHistoricProcessInstanceReport() .duration(MONTH); - assertThat(result).hasSize(0); + assertThat(result).isEmpty(); } @Test @@ -148,7 +148,7 @@ public void getReportByMultipleProcessDefinitionIdByMonthNoAuthenticatedTenants( .processDefinitionIdIn(processDefinitionIdOne, processDefinitionIdTwo) .duration(MONTH); - assertThat(result).hasSize(0); + assertThat(result).isEmpty(); } @Test @@ -209,7 +209,7 @@ public void getReportByProcessDefinitionKeyByMonthNoAuthenticatedTenants() { .processDefinitionKeyIn(PROCESS_DEFINITION_KEY) .duration(MONTH); - assertThat(result).hasSize(0); + assertThat(result).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyIdentityLinkCmdsTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyIdentityLinkCmdsTenantCheckTest.java index ef5e048689b..25190411f85 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyIdentityLinkCmdsTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyIdentityLinkCmdsTenantCheckTest.java @@ -266,7 +266,7 @@ public void deleteCandidateUserWithAuthenticatedTenant() { taskService.deleteCandidateUser(task.getId(), "demo"); // then - assertThat(taskService.createTaskQuery().taskCandidateUser("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskCandidateUser("demo").count()).isZero(); } @Test @@ -294,7 +294,7 @@ public void deleteCandidateUserWithDisabledTenantCheck() { taskService.deleteCandidateUser(task.getId(), "demo"); // then - assertThat(taskService.createTaskQuery().taskCandidateUser("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskCandidateUser("demo").count()).isZero(); } // delete candidate groups @@ -308,7 +308,7 @@ public void deleteCandidateGroupWithAuthenticatedTenant() { taskService.deleteCandidateGroup(task.getId(), "demo"); // then - assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isZero(); } @Test @@ -336,7 +336,7 @@ public void deleteCandidateGroupWithDisabledTenantCheck() { taskService.deleteCandidateGroup(task.getId(), "demo"); // then - assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isZero(); } // add user identity link @@ -424,7 +424,7 @@ public void deleteUserIdentityLinkWithAuthenticatedTenant() { taskService.deleteUserIdentityLink(task.getId(), "demo", IdentityLinkType.ASSIGNEE); // then - assertThat(taskService.createTaskQuery().taskAssignee("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskAssignee("demo").count()).isZero(); } @Test @@ -454,7 +454,7 @@ public void deleteUserIdentityLinkWithDisabledTenantCheck() { taskService.deleteUserIdentityLink(task.getId(), "demo", IdentityLinkType.ASSIGNEE); // then - assertThat(taskService.createTaskQuery().taskAssignee("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskAssignee("demo").count()).isZero(); } // delete group identity link @@ -468,7 +468,7 @@ public void deleteGroupIdentityLinkWithAuthenticatedTenant() { taskService.deleteGroupIdentityLink(task.getId(), "demo", IdentityLinkType.CANDIDATE); // then - assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isZero(); } @Test @@ -498,6 +498,6 @@ public void deleteGroupIdentityLinkWithDisabledTenantCheck() { taskService.deleteGroupIdentityLink(task.getId(), "demo", IdentityLinkType.CANDIDATE); // then - assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskCandidateGroup("demo").count()).isZero(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageCorrelationCmdTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageCorrelationCmdTenantCheckTest.java index 499180376cc..aa76799c0f0 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageCorrelationCmdTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageCorrelationCmdTenantCheckTest.java @@ -109,7 +109,7 @@ public void correlateMessageToStartEventWithAuthenticatedTenant() { ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -126,7 +126,7 @@ public void correlateMessageToStartEventDisabledTenantCheck() { ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -147,8 +147,8 @@ public void correlateMessageToIntermediateCatchEventNoAuthenticatedTenants() { identityService.clearAuthentication(); TaskQuery query = taskService.createTaskQuery(); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(1L); } @@ -169,7 +169,7 @@ public void correlateMessageToIntermediateCatchEventWithAuthenticatedTenant() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -191,7 +191,7 @@ public void correlateMessageToIntermediateCatchEventDisabledTenantCheck() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -211,7 +211,7 @@ public void correlateMessageToStartAndIntermediateCatchEventWithNoAuthenticatedT TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(2L); } @@ -233,7 +233,7 @@ public void correlateMessageToStartAndIntermediateCatchEventWithAuthenticatedTen TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageEventReceivedCmdTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageEventReceivedCmdTenantCheckTest.java index 69389920e7a..549457343f2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageEventReceivedCmdTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyMessageEventReceivedCmdTenantCheckTest.java @@ -86,7 +86,7 @@ public void correlateReceivedMessageToIntermediateCatchEventNoAuthenticatedTenan TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(1L); } @@ -134,7 +134,7 @@ public void correlateReceivedMessageToIntermediateCatchEventDisabledTenantCheck( TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyProcessDefinitionCmdsTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyProcessDefinitionCmdsTenantCheckTest.java index 56fe880a37a..97274807f2e 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyProcessDefinitionCmdsTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyProcessDefinitionCmdsTenantCheckTest.java @@ -409,7 +409,7 @@ public void testDeleteCascadeProcessDefinitionsByKeyWithAuthenticatedTenant() { // then identityService.clearAuthentication(); - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(1L); assertThat(repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); } @@ -456,7 +456,7 @@ public void testDeleteCascadeProcessDefinitionsByKeyDisabledTenantCheck() { // then identityService.clearAuthentication(); - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(1L); assertThat(repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); } @@ -524,7 +524,7 @@ public void testDeleteCascadeProcessDefinitionsByIdsWithAuthenticatedTenant() { // then identityService.clearAuthentication(); - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(1L); assertThat(repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); } @@ -573,7 +573,7 @@ public void testDeleteCascadeProcessDefinitionsByIdsDisabledTenantCheck() { // then identityService.clearAuthentication(); - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(1L); assertThat(repositoryService.createProcessDefinitionQuery().tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancySignalReceiveCmdTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancySignalReceiveCmdTenantCheckTest.java index 640c9047320..b032c12a394 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancySignalReceiveCmdTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancySignalReceiveCmdTenantCheckTest.java @@ -92,7 +92,7 @@ public void sendSignalToStartEventNoAuthenticatedTenants() { ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery(); assertThat(query.count()).isEqualTo(1L); assertThat(query.withoutTenantId().count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); } @Test @@ -109,7 +109,7 @@ public void sendSignalToStartEventWithAuthenticatedTenant() { ProcessInstanceQuery query = runtimeService.createProcessInstanceQuery(); assertThat(query.count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -144,7 +144,7 @@ public void sendSignalToIntermediateCatchEventNoAuthenticatedTenants() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(1L); } @@ -165,7 +165,7 @@ public void sendSignalToIntermediateCatchEventWithAuthenticatedTenant() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -203,7 +203,7 @@ public void sendSignalToStartAndIntermediateCatchEventNoAuthenticatedTenants() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_ONE).count()).isZero(); assertThat(taskService.createTaskQuery().withoutTenantId().count()).isEqualTo(2L); } @@ -224,7 +224,7 @@ public void sendSignalToStartAndIntermediateCatchEventWithAuthenticatedTenant() TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(2L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(2L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test @@ -354,7 +354,7 @@ public void signalIntermediateCatchEventDisabledTenantCheck() { TaskQuery query = taskService.createTaskQuery(); assertThat(query.count()).isEqualTo(1L); assertThat(query.tenantIdIn(TENANT_ONE).count()).isEqualTo(1L); - assertThat(query.tenantIdIn(TENANT_TWO).count()).isEqualTo(0L); + assertThat(query.tenantIdIn(TENANT_TWO).count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyTaskServiceCmdsTenantCheckTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyTaskServiceCmdsTenantCheckTest.java index 63d99977bdb..395a49e49b8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyTaskServiceCmdsTenantCheckTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/multitenancy/tenantcheck/MultiTenancyTaskServiceCmdsTenantCheckTest.java @@ -208,7 +208,7 @@ public void completeTaskWithAuthenticatedTenant() { // then taskService.complete(task.getId()); - assertThat(taskService.createTaskQuery().taskId(task.getId()).active().count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskId(task.getId()).active().count()).isZero(); } @Test @@ -231,7 +231,7 @@ public void completeWithDisabledTenantCheck() { // then taskService.complete(task.getId()); - assertThat(taskService.createTaskQuery().taskId(task.getId()).active().count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskId(task.getId()).active().count()).isZero(); } // delegate task test @@ -314,7 +314,7 @@ public void deleteTaskWithAuthenticatedTenant() { // then taskService.deleteTask(task.getId(), true); - assertThat(taskService.createTaskQuery().taskId(task.getId()).count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskId(task.getId()).count()).isZero(); } @Test @@ -350,7 +350,7 @@ public void deleteTaskWithDisabledTenantCheck() { // then taskService.deleteTask(task.getId(), true); - assertThat(taskService.createTaskQuery().taskId(task.getId()).count()).isEqualTo(0L); + assertThat(taskService.createTaskQuery().taskId(task.getId()).count()).isZero(); } protected Task createTaskforTenant() { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricActivityInstancesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricActivityInstancesForOptimizeTest.java index d34ae1922e9..fdb5c9520ba 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricActivityInstancesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricActivityInstancesForOptimizeTest.java @@ -16,21 +16,12 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static junit.framework.TestCase.assertTrue; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.delegate.ExecutionListener.EVENTNAME_START; - -import java.util.Arrays; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.history.HistoricActivityInstance; import org.operaton.bpm.engine.identity.Group; @@ -46,11 +37,12 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.*; + +import static junit.framework.TestCase.assertTrue; +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.bpm.engine.delegate.ExecutionListener.EVENTNAME_START; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public class GetCompletedHistoricActivityInstancesForOptimizeTest { @@ -118,7 +110,7 @@ public void getCompletedHistoricActivityInstances() { optimizeService.getCompletedHistoricActivityInstances(pastDate(), null, 10); // then - assertThat(completedHistoricActivityInstances.size()).isEqualTo(2); + assertThat(completedHistoricActivityInstances).hasSize(2); assertThatActivitiesHaveAllImportantInformation(completedHistoricActivityInstances); } @@ -144,7 +136,7 @@ public void fishedAfterParameterWorks() { // then Set allowedActivityIds = new HashSet<>(Arrays.asList("userTask", "endEvent")); - assertThat(completedHistoricActivityInstances.size()).isEqualTo(2); + assertThat(completedHistoricActivityInstances).hasSize(2); assertTrue(allowedActivityIds.contains(completedHistoricActivityInstances.get(0).getActivityId())); assertTrue(allowedActivityIds.contains(completedHistoricActivityInstances.get(1).getActivityId())); } @@ -170,7 +162,7 @@ public void fishedAtParameterWorks() { optimizeService.getCompletedHistoricActivityInstances(null, now, 10); // then - assertThat(completedHistoricActivityInstances.size()).isEqualTo(1); + assertThat(completedHistoricActivityInstances).hasSize(1); assertThat(completedHistoricActivityInstances.get(0).getActivityId()).isEqualTo("startEvent"); } @@ -195,7 +187,7 @@ public void fishedAfterAndFinishedAtParameterWorks() { optimizeService.getCompletedHistoricActivityInstances(now, now, 10); // then - assertThat(completedHistoricActivityInstances.size()).isEqualTo(0); + assertThat(completedHistoricActivityInstances).isEmpty(); } @Test @@ -221,7 +213,7 @@ public void maxResultsParameterWorks() { optimizeService.getCompletedHistoricActivityInstances(pastDate(), null, 3); // then - assertThat(completedHistoricActivityInstances.size()).isEqualTo(3); + assertThat(completedHistoricActivityInstances).hasSize(3); } @Test @@ -251,7 +243,7 @@ public void resultIsSortedByEndTime() { optimizeService.getCompletedHistoricActivityInstances(pastDate(), null, 4); // then - assertThat(completedHistoricActivityInstances.size()).isEqualTo(4); + assertThat(completedHistoricActivityInstances).hasSize(4); assertThat(completedHistoricActivityInstances.get(0).getActivityId()).isEqualTo("startEvent"); assertThat(completedHistoricActivityInstances.get(1).getActivityId()).isEqualTo("ServiceTask1"); assertThat(completedHistoricActivityInstances.get(2).getActivityId()).isEqualTo("ServiceTask2"); @@ -274,7 +266,7 @@ public void fetchOnlyCompletedActivities() { optimizeService.getCompletedHistoricActivityInstances(pastDate(), null, 10); // then - assertThat(completedHistoricActivityInstances.size()).isEqualTo(1); + assertThat(completedHistoricActivityInstances).hasSize(1); assertThat(completedHistoricActivityInstances.get(0).getActivityId()).isEqualTo("startEvent"); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricIncidentsForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricIncidentsForOptimizeTest.java index 536741d9081..ad055453fe8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricIncidentsForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricIncidentsForOptimizeTest.java @@ -16,6 +16,11 @@ */ package org.operaton.bpm.engine.test.api.optimize; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.ManagementService; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.RuntimeService; @@ -31,11 +36,6 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; import java.util.Date; import java.util.List; @@ -93,7 +93,7 @@ public void getCompletedHistoricIncidents() { optimizeService.getCompletedHistoricIncidents(pastDate(), null, 10); // then - assertThat(completedIncidents.size()).isEqualTo(1); + assertThat(completedIncidents).hasSize(1); assertThatInstanceHasAllImportantInformation(completedIncidents.get(0)); } @@ -115,7 +115,7 @@ public void fishedAfterParameterWorks() { optimizeService.getCompletedHistoricIncidents(now, null, 10); // then - assertThat(completedIncidents.size()).isEqualTo(1); + assertThat(completedIncidents).hasSize(1); assertThat(completedIncidents.get(0).getProcessInstanceId()).isEqualTo(processInstance2.getId()); } @@ -137,7 +137,7 @@ public void fishedAtParameterWorks() { optimizeService.getCompletedHistoricIncidents(null, now, 10); // then - assertThat(completedIncidents.size()).isEqualTo(1); + assertThat(completedIncidents).hasSize(1); assertThat(completedIncidents.get(0).getProcessInstanceId()).isEqualTo(processInstance.getId()); } @@ -159,7 +159,7 @@ public void fishedAfterAndFinishedAtParameterWorks() { optimizeService.getCompletedHistoricIncidents(now, now, 10); // then - assertThat(completedIncidents.size()).isEqualTo(0); + assertThat(completedIncidents).isEmpty(); } @Test @@ -176,7 +176,7 @@ public void maxResultsParameterWorks() { optimizeService.getCompletedHistoricIncidents(pastDate(), null, 3); // then - assertThat(completedIncidents.size()).isEqualTo(3); + assertThat(completedIncidents).hasSize(3); } @Test @@ -204,7 +204,7 @@ public void resultIsSortedByEndTime() { optimizeService.getCompletedHistoricIncidents(now, null, 10); // then - assertThat(completedIncidents.size()).isEqualTo(3); + assertThat(completedIncidents).hasSize(3); assertThat(completedIncidents.get(0).getProcessInstanceId()).isEqualTo(processInstance1.getId()); assertThat(completedIncidents.get(1).getProcessInstanceId()).isEqualTo(processInstance2.getId()); assertThat(completedIncidents.get(2).getProcessInstanceId()).isEqualTo(processInstance3.getId()); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricProcessInstancesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricProcessInstancesForOptimizeTest.java index 25a832d4771..e814f2cf2f3 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricProcessInstancesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricProcessInstancesForOptimizeTest.java @@ -16,16 +16,12 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; -import java.util.List; - -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.history.HistoricProcessInstance; import org.operaton.bpm.engine.identity.Group; @@ -41,11 +37,11 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @@ -112,7 +108,7 @@ public void getCompletedHistoricProcessInstances() { optimizeService.getCompletedHistoricProcessInstances(pastDate(), null, 10); // then - assertThat(completedHistoricProcessInstances.size()).isEqualTo(1); + assertThat(completedHistoricProcessInstances).hasSize(1); assertThatInstanceHasAllImportantInformation(completedHistoricProcessInstances.get(0)); } @@ -136,7 +132,7 @@ public void fishedAfterParameterWorks() { optimizeService.getCompletedHistoricProcessInstances(now, null, 10); // then - assertThat(completedHistoricProcessInstances.size()).isEqualTo(1); + assertThat(completedHistoricProcessInstances).hasSize(1); } @Test @@ -160,7 +156,7 @@ public void fishedAtParameterWorks() { optimizeService.getCompletedHistoricProcessInstances(null, now, 10); // then - assertThat(completedHistoricProcessInstances.size()).isEqualTo(1); + assertThat(completedHistoricProcessInstances).hasSize(1); assertThat(completedHistoricProcessInstances.get(0).getId()).isEqualTo(processInstance.getId()); } @@ -184,7 +180,7 @@ public void fishedAfterAndFinishedAtParameterWorks() { optimizeService.getCompletedHistoricProcessInstances(now, now, 10); // then - assertThat(completedHistoricProcessInstances.size()).isEqualTo(0); + assertThat(completedHistoricProcessInstances).isEmpty(); } @Test @@ -206,7 +202,7 @@ public void maxResultsParameterWorks() { optimizeService.getCompletedHistoricProcessInstances(pastDate(), null, 3); // then - assertThat(completedHistoricProcessInstances.size()).isEqualTo(3); + assertThat(completedHistoricProcessInstances).hasSize(3); } @Test @@ -236,7 +232,7 @@ public void resultIsSortedByEndTime() { optimizeService.getCompletedHistoricProcessInstances(now, null, 10); // then - assertThat(completedHistoricProcessInstances.size()).isEqualTo(3); + assertThat(completedHistoricProcessInstances).hasSize(3); assertThat(completedHistoricProcessInstances.get(0).getId()).isEqualTo(processInstance1.getId()); assertThat(completedHistoricProcessInstances.get(1).getId()).isEqualTo(processInstance2.getId()); assertThat(completedHistoricProcessInstances.get(2).getId()).isEqualTo(processInstance3.getId()); @@ -262,7 +258,7 @@ public void fetchOnlyCompletedProcessInstances() { optimizeService.getCompletedHistoricProcessInstances(pastDate(), null, 10); // then - assertThat(completedHistoricProcessInstances.size()).isEqualTo(1); + assertThat(completedHistoricProcessInstances).hasSize(1); assertThat(completedHistoricProcessInstances.get(0).getId()).isEqualTo(processInstanceToComplete.getId()); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricTaskInstancesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricTaskInstancesForOptimizeTest.java index 7ee1e074f94..0da28618699 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricTaskInstancesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetCompletedHistoricTaskInstancesForOptimizeTest.java @@ -114,7 +114,7 @@ public void getCompletedHistoricTaskInstances() { optimizeService.getCompletedHistoricTaskInstances(null, null, 10); // then - assertThat(completedHistoricTaskInstances.size()).isEqualTo(1); + assertThat(completedHistoricTaskInstances).hasSize(1); assertThatTasksHaveAllImportantInformation(completedHistoricTaskInstances.get(0)); } @@ -148,7 +148,7 @@ public void fishedAfterParameterWorks() { // then Set allowedTaskIds = new HashSet<>(Arrays.asList("userTask2", "userTask3")); - assertThat(completedHistoricTaskInstances.size()).isEqualTo(2); + assertThat(completedHistoricTaskInstances).hasSize(2); assertTrue(allowedTaskIds.contains(completedHistoricTaskInstances.get(0).getTaskDefinitionKey())); assertTrue(allowedTaskIds.contains(completedHistoricTaskInstances.get(1).getTaskDefinitionKey())); } @@ -176,7 +176,7 @@ public void fishedAtParameterWorks() { optimizeService.getCompletedHistoricTaskInstances(null, now, 10); // then - assertThat(completedHistoricTaskInstances.size()).isEqualTo(1); + assertThat(completedHistoricTaskInstances).hasSize(1); assertThat(completedHistoricTaskInstances.get(0).getTaskDefinitionKey()).isEqualTo("userTask1"); } @@ -203,7 +203,7 @@ public void fishedAfterAndFinishedAtParameterWorks() { optimizeService.getCompletedHistoricTaskInstances(now, now, 10); // then - assertThat(completedHistoricTaskInstances.size()).isEqualTo(0); + assertThat(completedHistoricTaskInstances).isEmpty(); } @Test @@ -229,7 +229,7 @@ public void maxResultsParameterWorks() { optimizeService.getCompletedHistoricTaskInstances(pastDate(), null, 3); // then - assertThat(completedHistoricTaskInstances.size()).isEqualTo(3); + assertThat(completedHistoricTaskInstances).hasSize(3); } @Test @@ -261,7 +261,7 @@ public void resultIsSortedByEndTime() { optimizeService.getCompletedHistoricTaskInstances(pastDate(), null, 4); // then - assertThat(completedHistoricTaskInstances.size()).isEqualTo(3); + assertThat(completedHistoricTaskInstances).hasSize(3); assertThat(completedHistoricTaskInstances.get(0).getTaskDefinitionKey()).isEqualTo("userTask1"); assertThat(completedHistoricTaskInstances.get(1).getTaskDefinitionKey()).isEqualTo("userTask2"); assertThat(completedHistoricTaskInstances.get(2).getTaskDefinitionKey()).isEqualTo("userTask3"); @@ -285,7 +285,7 @@ public void fetchOnlyCompletedTasks() { optimizeService.getCompletedHistoricTaskInstances(pastDate(), null, 10); // then - assertThat(completedHistoricTaskInstances.size()).isEqualTo(1); + assertThat(completedHistoricTaskInstances).hasSize(1); assertThat(completedHistoricTaskInstances.get(0).getTaskDefinitionKey()).isEqualTo("userTask1"); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricDecisionInstancesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricDecisionInstancesForOptimizeTest.java index 3879bbaa0d3..5c5d5a715bb 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricDecisionInstancesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricDecisionInstancesForOptimizeTest.java @@ -16,11 +16,11 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; -import java.util.List; - +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration; import org.operaton.bpm.engine.AuthorizationService; import org.operaton.bpm.engine.IdentityService; @@ -44,11 +44,11 @@ import org.operaton.bpm.engine.test.util.ResetDmnConfigUtil; import org.operaton.bpm.engine.variable.VariableMap; import org.operaton.bpm.engine.variable.Variables; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public class GetHistoricDecisionInstancesForOptimizeTest { @@ -135,7 +135,7 @@ public void getCompletedHistoricDecisionInstances() { optimizeService.getHistoricDecisionInstances(pastDate(), null, 10); // then - assertThat(decisionInstances.size()).isEqualTo(1); + assertThat(decisionInstances).hasSize(1); assertThatDecisionsHaveAllImportantInformation(decisionInstances); } @@ -152,11 +152,11 @@ public void decisionInputInstanceProperties() { optimizeService.getHistoricDecisionInstances(pastDate(), null, 10); // then - assertThat(decisionInstances.size()).isEqualTo(1); + assertThat(decisionInstances).hasSize(1); HistoricDecisionInstance decisionInstance = decisionInstances.get(0); List inputs = decisionInstance.getInputs(); assertThat(inputs).isNotNull(); - assertThat(inputs.size()).isEqualTo(1); + assertThat(inputs).hasSize(1); HistoricDecisionInputInstance input = inputs.get(0); assertThat(input.getDecisionInstanceId()).isEqualTo(decisionInstance.getId()); @@ -177,11 +177,11 @@ public void decisionOutputInstanceProperties() { optimizeService.getHistoricDecisionInstances(pastDate(), null, 10); // then - assertThat(decisionInstances.size()).isEqualTo(1); + assertThat(decisionInstances).hasSize(1); HistoricDecisionInstance decisionInstance = decisionInstances.get(0); List outputs = decisionInstance.getOutputs(); assertThat(outputs).isNotNull(); - assertThat(outputs.size()).isEqualTo(1); + assertThat(outputs).hasSize(1); HistoricDecisionOutputInstance output = outputs.get(0); assertThat(output.getDecisionInstanceId()).isEqualTo(decisionInstance.getId()); @@ -213,7 +213,7 @@ public void fishedAfterParameterWorks() { optimizeService.getHistoricDecisionInstances(now, null, 10); // then - assertThat(decisionInstances.size()).isEqualTo(1); + assertThat(decisionInstances).hasSize(1); HistoricDecisionInstance decisionInstance = decisionInstances.get(0); assertThat(decisionInstance.getProcessInstanceId()).isEqualTo(secondProcessInstance.getId()); } @@ -237,7 +237,7 @@ public void fishedAtParameterWorks() { optimizeService.getHistoricDecisionInstances(null, now, 10); // then - assertThat(decisionInstances.size()).isEqualTo(1); + assertThat(decisionInstances).hasSize(1); HistoricDecisionInstance decisionInstance = decisionInstances.get(0); assertThat(decisionInstance.getProcessInstanceId()).isEqualTo(firstProcessInstance.getId()); } @@ -264,7 +264,7 @@ public void fishedAfterAndFinishedAtParameterWorks() { optimizeService.getHistoricDecisionInstances(now, now, 10); // then - assertThat(decisionInstances.size()).isEqualTo(0); + assertThat(decisionInstances).isEmpty(); } @Test @@ -282,7 +282,7 @@ public void maxResultsParameterWorks() { optimizeService.getHistoricDecisionInstances(null, null, 2); // then - assertThat(decisionInstances.size()).isEqualTo(2); + assertThat(decisionInstances).hasSize(2); } @Test @@ -310,7 +310,7 @@ public void resultIsSortedByEvaluationTime() { optimizeService.getHistoricDecisionInstances(pastDate(), null, 3); // then - assertThat(decisionInstances.size()).isEqualTo(3); + assertThat(decisionInstances).hasSize(3); assertThat(decisionInstances.get(0).getProcessInstanceId()).isEqualTo(firstProcessInstance.getId()); assertThat(decisionInstances.get(1).getProcessInstanceId()).isEqualTo(secondProcessInstance.getId()); assertThat(decisionInstances.get(2).getProcessInstanceId()).isEqualTo(thirdProcessInstance.getId()); @@ -326,7 +326,7 @@ protected void createUser(String userId) { } private void assertThatDecisionsHaveAllImportantInformation(List decisionInstances) { - assertThat(decisionInstances.size()).isEqualTo(1); + assertThat(decisionInstances).hasSize(1); HistoricDecisionInstance decisionInstance = decisionInstances.get(0); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricIdentityLinkLogsForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricIdentityLinkLogsForOptimizeTest.java index 985a150aa58..ffccf49a9b1 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricIdentityLinkLogsForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricIdentityLinkLogsForOptimizeTest.java @@ -16,16 +16,12 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; -import java.util.List; - -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.identity.Group; import org.operaton.bpm.engine.identity.User; @@ -42,11 +38,11 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public class GetHistoricIdentityLinkLogsForOptimizeTest { @@ -121,7 +117,7 @@ public void allNecessaryInformationIsAvailable() { optimizeService.getHistoricIdentityLinkLogs(pastDate(), null, 10); // then - assertThat(identityLinkLogs.size()).isEqualTo(1); + assertThat(identityLinkLogs).hasSize(1); assertThatIdentityLinksHaveAllImportantInformation(identityLinkLogs.get(0), processInstance); } @@ -158,7 +154,7 @@ public void performCandidateOperations() { optimizeService.getHistoricIdentityLinkLogs(pastDate(), null, 10); // then - assertThat(identityLinkLogs.size()).isEqualTo(4); + assertThat(identityLinkLogs).hasSize(4); assertThat(identityLinkLogs.get(0).getUserId()).isEqualTo(userId); assertThat(identityLinkLogs.get(0).getOperationType()).isEqualTo(IDENTITY_LINK_ADD); assertThat(identityLinkLogs.get(0).getType()).isEqualTo(IdentityLinkType.CANDIDATE); @@ -197,7 +193,7 @@ public void performAssigneeOperations() { optimizeService.getHistoricIdentityLinkLogs(pastDate(), null, 10); // then - assertThat(identityLinkLogs.size()).isEqualTo(2); + assertThat(identityLinkLogs).hasSize(2); assertThat(identityLinkLogs.get(0).getUserId()).isEqualTo(userId); assertThat(identityLinkLogs.get(0).getOperationType()).isEqualTo(IDENTITY_LINK_ADD); assertThat(identityLinkLogs.get(0).getType()).isEqualTo(IdentityLinkType.ASSIGNEE); @@ -235,7 +231,7 @@ public void occurredAfterParameterWorks() { optimizeService.getHistoricIdentityLinkLogs(now, null, 10); // then - assertThat(identityLinkLogs.size()).isEqualTo(2); + assertThat(identityLinkLogs).hasSize(2); } @Test @@ -266,7 +262,7 @@ public void occurredAtParameterWorks() { optimizeService.getHistoricIdentityLinkLogs(null, now, 10); // then - assertThat(identityLinkLogs.size()).isEqualTo(1); + assertThat(identityLinkLogs).hasSize(1); } @Test @@ -297,7 +293,7 @@ public void occurredAfterAndOccurredAtParameterWorks() { optimizeService.getHistoricIdentityLinkLogs(now, now, 10); // then - assertThat(identityLinkLogs.size()).isEqualTo(0); + assertThat(identityLinkLogs).isEmpty(); } @Test @@ -322,7 +318,7 @@ public void maxResultsParameterWorks() { optimizeService.getHistoricIdentityLinkLogs(pastDate(), null, 3); // then - assertThat(identityLinkLogs.size()).isEqualTo(3); + assertThat(identityLinkLogs).hasSize(3); } @Test @@ -353,7 +349,7 @@ public void resultIsSortedByTimestamp() { optimizeService.getHistoricIdentityLinkLogs(pastDate(), null, 4); // then - assertThat(identityLinkLogs.size()).isEqualTo(3); + assertThat(identityLinkLogs).hasSize(3); assertThat(identityLinkLogs.get(0).getOperationType()).isEqualTo(IDENTITY_LINK_ADD); assertThat(identityLinkLogs.get(1).getOperationType()).isEqualTo(IDENTITY_LINK_DELETE); assertThat(identityLinkLogs.get(2).getOperationType()).isEqualTo(IDENTITY_LINK_ADD); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricOperationLogsForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricOperationLogsForOptimizeTest.java index 98c81b17dd0..045cf4d9e2f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricOperationLogsForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricOperationLogsForOptimizeTest.java @@ -16,30 +16,12 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static org.operaton.bpm.engine.history.UserOperationLogEntry.CATEGORY_OPERATOR; -import static org.operaton.bpm.engine.history.UserOperationLogEntry.OPERATION_TYPE_ACTIVATE; -import static org.operaton.bpm.engine.history.UserOperationLogEntry.OPERATION_TYPE_ACTIVATE_JOB; -import static org.operaton.bpm.engine.history.UserOperationLogEntry.OPERATION_TYPE_ACTIVATE_PROCESS_DEFINITION; -import static org.operaton.bpm.engine.history.UserOperationLogEntry.OPERATION_TYPE_SUSPEND; -import static org.operaton.bpm.engine.history.UserOperationLogEntry.OPERATION_TYPE_SUSPEND_JOB; -import static org.operaton.bpm.engine.history.UserOperationLogEntry.OPERATION_TYPE_SUSPEND_PROCESS_DEFINITION; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertTrue; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.operaton.bpm.engine.EntityTypes; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RepositoryService; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.batch.Batch; import org.operaton.bpm.engine.history.UserOperationLogEntry; import org.operaton.bpm.engine.identity.User; @@ -57,11 +39,12 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertTrue; +import static org.operaton.bpm.engine.history.UserOperationLogEntry.*; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public class GetHistoricOperationLogsForOptimizeTest { @@ -127,7 +110,7 @@ public void getHistoricUserOperationLogs_suspendProcessInstanceByProcessInstance optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(2); + assertThat(userOperationsLog).hasSize(2); assertThat(userOperationsLog.get(0)).isNotNull(); assertThat(userOperationsLog.get(0).getId()).isNotNull(); assertThat(userOperationsLog.get(0).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND); @@ -172,7 +155,7 @@ public void getHistoricUserOperationLogs_suspendProcessInstanceByProcessDefiniti optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(2); + assertThat(userOperationsLog).hasSize(2); assertThat(userOperationsLog.get(0)).isNotNull(); assertThat(userOperationsLog.get(0).getId()).isNotNull(); assertThat(userOperationsLog.get(0).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND); @@ -217,7 +200,7 @@ public void getHistoricUserOperationLogs_suspendProcessInstanceByProcessDefiniti optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(2); + assertThat(userOperationsLog).hasSize(2); assertThat(userOperationsLog.get(0)).isNotNull(); assertThat(userOperationsLog.get(0).getId()).isNotNull(); assertThat(userOperationsLog.get(0).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND); @@ -262,7 +245,7 @@ public void getHistoricUserOperationLogs_suspendProcessDefinitionById() { optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(4); + assertThat(userOperationsLog).hasSize(4); List newPossibleValue = new ArrayList<>(Arrays.asList( SuspensionState.SUSPENDED.getName(), SuspensionState.ACTIVE.getName(), @@ -330,7 +313,7 @@ public void getHistoricUserOperationLogs_suspendProcessDefinitionByKey() { optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(4); + assertThat(userOperationsLog).hasSize(4); List newPossibleValue = new ArrayList<>(Arrays.asList( SuspensionState.SUSPENDED.getName(), SuspensionState.ACTIVE.getName(), @@ -406,7 +389,7 @@ public void getHistoricUserOperationLogs_suspendByBatchJobAndProcessInstanceId() optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(4); + assertThat(userOperationsLog).hasSize(4); assertThat(userOperationsLog.get(0).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND_JOB); assertThat(userOperationsLog.get(0).getEntityType()).isEqualTo(EntityTypes.PROCESS_INSTANCE); assertThat(userOperationsLog.get(0).getProcessDefinitionKey()).isNull(); @@ -460,7 +443,7 @@ public void getHistoricUserOperationLogs_suspendByBatchJobAndQuery() { optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(4); + assertThat(userOperationsLog).hasSize(4); assertThat(userOperationsLog.get(0).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND_JOB); assertThat(userOperationsLog.get(0).getEntityType()).isEqualTo(EntityTypes.PROCESS_INSTANCE); assertThat(userOperationsLog.get(0).getProcessDefinitionKey()).isNull(); @@ -509,7 +492,7 @@ public void occurredAfterParameterWorks() { // then Set allowedOperationsTypes = new HashSet<>(Arrays.asList(OPERATION_TYPE_SUSPEND, OPERATION_TYPE_ACTIVATE)); - assertThat(userOperationsLog.size()).isEqualTo(2); + assertThat(userOperationsLog).hasSize(2); assertTrue(allowedOperationsTypes.contains(userOperationsLog.get(0).getOperationType())); assertTrue(allowedOperationsTypes.contains(userOperationsLog.get(1).getOperationType())); } @@ -531,7 +514,7 @@ public void occurredAtParameterWorks() { optimizeService.getHistoricUserOperationLogs(null, now, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(1); + assertThat(userOperationsLog).hasSize(1); assertThat(userOperationsLog.get(0).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND); } @@ -552,7 +535,7 @@ public void occurredAfterAndOccurredAtParameterWorks() { optimizeService.getHistoricUserOperationLogs(now, now, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(0); + assertThat(userOperationsLog).isEmpty(); } @Test @@ -569,7 +552,7 @@ public void maxResultsParameterWorks() { optimizeService.getHistoricUserOperationLogs(pastDate(), null, 3); // then - assertThat(userOperationsLog.size()).isEqualTo(3); + assertThat(userOperationsLog).hasSize(3); } @Test @@ -593,7 +576,7 @@ public void resultIsSortedByTimestamp() { optimizeService.getHistoricUserOperationLogs(pastDate(), null, 4); // then - assertThat(userOperationsLog.size()).isEqualTo(3); + assertThat(userOperationsLog).hasSize(3); assertThat(userOperationsLog.get(0).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND); assertThat(userOperationsLog.get(1).getOperationType()).isEqualTo(OPERATION_TYPE_ACTIVATE); assertThat(userOperationsLog.get(2).getOperationType()).isEqualTo(OPERATION_TYPE_SUSPEND); @@ -611,7 +594,7 @@ public void fetchOnlyProcessInstanceSuspensionStateBasedLogEntries() { optimizeService.getHistoricUserOperationLogs(pastDate(), null, 10); // then - assertThat(userOperationsLog.size()).isEqualTo(0); + assertThat(userOperationsLog).isEmpty(); } private void createLogEntriesThatShouldNotBeReturned(String processInstanceId) { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricVariableUpdatesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricVariableUpdatesForOptimizeTest.java index b57289f9889..7cfcb76121a 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricVariableUpdatesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetHistoricVariableUpdatesForOptimizeTest.java @@ -17,11 +17,12 @@ package org.operaton.bpm.engine.test.api.optimize; import com.google.common.collect.ImmutableList; -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.history.HistoricVariableUpdate; import org.operaton.bpm.engine.identity.Group; @@ -44,11 +45,6 @@ import org.operaton.bpm.engine.variable.value.builder.ObjectValueBuilder; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; import java.util.Date; import java.util.HashMap; @@ -128,7 +124,7 @@ public void getHistoricVariableUpdates() { optimizeService.getHistoricVariableUpdates(new Date(1L), null, false, 10); // then - assertThat(historicVariableUpdates.size()).isEqualTo(1); + assertThat(historicVariableUpdates).hasSize(1); assertThatUpdateHasAllImportantInformation(historicVariableUpdates.get(0)); } @@ -155,8 +151,8 @@ public void occurredAfterParameterWorks() { optimizeService.getHistoricVariableUpdates(now, null, false, 10); // then - assertThat(variableUpdates.size()).isEqualTo(1); - assertThat(variableUpdates.get(0).getValue().toString()).isEqualTo("value2"); + assertThat(variableUpdates).hasSize(1); + assertThat(variableUpdates.get(0).getValue()).hasToString("value2"); } @Test @@ -182,8 +178,8 @@ public void occurredAtParameterWorks() { optimizeService.getHistoricVariableUpdates(null, now, false, 10); // then - assertThat(variableUpdates.size()).isEqualTo(1); - assertThat(variableUpdates.get(0).getValue().toString()).isEqualTo("value1"); + assertThat(variableUpdates).hasSize(1); + assertThat(variableUpdates.get(0).getValue()).hasToString("value1"); } @Test @@ -209,7 +205,7 @@ public void occurredAfterAndOccurredAtParameterWorks() { optimizeService.getHistoricVariableUpdates(now, now, false, 10); // then - assertThat(variableUpdates.size()).isEqualTo(0); + assertThat(variableUpdates).isEmpty(); } @Test @@ -293,7 +289,7 @@ public void maxResultsParameterWorks() { optimizeService.getHistoricVariableUpdates(pastDate(), null, false, 3); // then - assertThat(variableUpdates.size()).isEqualTo(3); + assertThat(variableUpdates).hasSize(3); } @Test @@ -326,7 +322,7 @@ public void resultIsSortedByTime() { optimizeService.getHistoricVariableUpdates(now, null, false, 10); // then - assertThat(variableUpdates.size()).isEqualTo(3); + assertThat(variableUpdates).hasSize(3); assertThat(variableUpdates.get(0).getVariableName()).isEqualTo("var1"); assertThat(variableUpdates.get(1).getVariableName()).isEqualTo("var2"); assertThat(variableUpdates.get(2).getVariableName()).isEqualTo("var3"); @@ -355,7 +351,7 @@ public void fetchOnlyVariableUpdates() { optimizeService.getHistoricVariableUpdates(pastDate(), null, false, 10); // then - assertThat(variableUpdates.size()).isEqualTo(1); + assertThat(variableUpdates).hasSize(1); } /** diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetOpenHistoricIncidentsForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetOpenHistoricIncidentsForOptimizeTest.java index 1b418832b86..21a67e8e0f1 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetOpenHistoricIncidentsForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetOpenHistoricIncidentsForOptimizeTest.java @@ -16,6 +16,11 @@ */ package org.operaton.bpm.engine.test.api.optimize; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.ManagementService; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.RuntimeService; @@ -31,11 +36,6 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; import java.util.Date; import java.util.List; @@ -91,7 +91,7 @@ public void getOpenHistoricIncidents() { optimizeService.getOpenHistoricIncidents(pastDate(), null, 10); // then - assertThat(openIncidents.size()).isEqualTo(1); + assertThat(openIncidents).hasSize(1); assertThatInstanceHasAllImportantInformation(openIncidents.get(0)); } @@ -112,7 +112,7 @@ public void fishedAfterParameterWorks() { optimizeService.getOpenHistoricIncidents(now, null, 10); // then - assertThat(openIncidents.size()).isEqualTo(1); + assertThat(openIncidents).hasSize(1); assertThat(openIncidents.get(0).getProcessInstanceId()).isEqualTo(processInstance.getId()); } @@ -133,7 +133,7 @@ public void fishedAtParameterWorks() { optimizeService.getOpenHistoricIncidents(null, now, 10); // then - assertThat(openIncidents.size()).isEqualTo(1); + assertThat(openIncidents).hasSize(1); assertThat(openIncidents.get(0).getProcessInstanceId()).isEqualTo(processInstance.getId()); } @@ -153,7 +153,7 @@ public void fishedAfterAndFinishedAtParameterWorks() { optimizeService.getOpenHistoricIncidents(now, now, 10); // then - assertThat(openIncidents.size()).isEqualTo(0); + assertThat(openIncidents).isEmpty(); } @Test @@ -169,7 +169,7 @@ public void maxResultsParameterWorks() { optimizeService.getOpenHistoricIncidents(pastDate(), null, 3); // then - assertThat(openIncidents.size()).isEqualTo(3); + assertThat(openIncidents).hasSize(3); } @Test @@ -194,7 +194,7 @@ public void resultIsSortedByEndTime() { optimizeService.getOpenHistoricIncidents(now, null, 10); // then - assertThat(openIncidents.size()).isEqualTo(3); + assertThat(openIncidents).hasSize(3); assertThat(openIncidents.get(0).getProcessInstanceId()).isEqualTo(processInstance1.getId()); assertThat(openIncidents.get(1).getProcessInstanceId()).isEqualTo(processInstance2.getId()); assertThat(openIncidents.get(2).getProcessInstanceId()).isEqualTo(processInstance3.getId()); @@ -213,7 +213,7 @@ public void fetchOnlyOpenIncidents() { optimizeService.getOpenHistoricIncidents(pastDate(), null, 10); // then - assertThat(openIncidents.size()).isEqualTo(1); + assertThat(openIncidents).hasSize(1); assertThat(openIncidents.get(0).getProcessInstanceId()).isEqualTo(processInstanceWithOpenIncident.getId()); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricActivityInstancesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricActivityInstancesForOptimizeTest.java index a93875e2a18..46bc072f17e 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricActivityInstancesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricActivityInstancesForOptimizeTest.java @@ -16,16 +16,12 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; -import java.util.List; - -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.history.HistoricActivityInstance; import org.operaton.bpm.engine.identity.Group; @@ -42,11 +38,11 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public class GetRunningHistoricActivityInstancesForOptimizeTest { @@ -114,7 +110,7 @@ public void getRunningHistoricActivityInstances() { optimizeService.getRunningHistoricActivityInstances(pastDate(), null, 10); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(1); + assertThat(runningHistoricActivityInstances).hasSize(1); HistoricActivityInstance activityInstance = runningHistoricActivityInstances.get(0); assertThatActivitiesHaveAllImportantInformation(activityInstance); } @@ -141,7 +137,7 @@ public void startedAfterParameterWorks() { optimizeService.getRunningHistoricActivityInstances(now, null, 10); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(1); + assertThat(runningHistoricActivityInstances).hasSize(1); assertThat(runningHistoricActivityInstances.get(0).getProcessInstanceId()).isEqualTo(secondProcessInstance.getId()); } @@ -167,7 +163,7 @@ public void startedAtParameterWorks() { optimizeService.getRunningHistoricActivityInstances(null, now, 10); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(1); + assertThat(runningHistoricActivityInstances).hasSize(1); assertThat(runningHistoricActivityInstances.get(0).getProcessInstanceId()).isEqualTo(firstProcessInstance.getId()); } @@ -192,7 +188,7 @@ public void startedAfterAndStartedAtParameterWorks() { optimizeService.getRunningHistoricActivityInstances(now, now, 10); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(0); + assertThat(runningHistoricActivityInstances).isEmpty(); } @Test @@ -214,7 +210,7 @@ public void maxResultsParameterWorks() { optimizeService.getRunningHistoricActivityInstances(pastDate(), null, 3); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(3); + assertThat(runningHistoricActivityInstances).hasSize(3); } @Test @@ -241,7 +237,7 @@ public void resultIsSortedByStartTime() { optimizeService.getRunningHistoricActivityInstances(pastDate(), null, 4); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(3); + assertThat(runningHistoricActivityInstances).hasSize(3); assertThat(runningHistoricActivityInstances.get(0).getProcessInstanceId()).isEqualTo(firstProcessInstance.getId()); assertThat(runningHistoricActivityInstances.get(1).getProcessInstanceId()).isEqualTo(secondProcessInstance.getId()); assertThat(runningHistoricActivityInstances.get(2).getProcessInstanceId()).isEqualTo(thirdProcessInstance.getId()); @@ -269,7 +265,7 @@ public void fetchOnlyRunningActivities() { optimizeService.getRunningHistoricActivityInstances(pastDate(), null, 10); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(1); + assertThat(runningHistoricActivityInstances).hasSize(1); assertThat(runningHistoricActivityInstances.get(0).getActivityId()).isEqualTo("userTask"); // when @@ -278,7 +274,7 @@ public void fetchOnlyRunningActivities() { optimizeService.getRunningHistoricActivityInstances(pastDate(), null, 10); // then - assertThat(runningHistoricActivityInstances.size()).isEqualTo(0); + assertThat(runningHistoricActivityInstances).isEmpty(); } private Date pastDate() { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricProcessInstancesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricProcessInstancesForOptimizeTest.java index 863c20f6c4f..fde1a2a4037 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricProcessInstancesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricProcessInstancesForOptimizeTest.java @@ -16,16 +16,12 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; -import java.util.List; - -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.history.HistoricProcessInstance; import org.operaton.bpm.engine.identity.Group; @@ -41,11 +37,11 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) @@ -112,7 +108,7 @@ public void getRunningHistoricProcessInstances() { optimizeService.getRunningHistoricProcessInstances(pastDate(), null, 10); // then - assertThat(runningHistoricProcessInstances.size()).isEqualTo(1); + assertThat(runningHistoricProcessInstances).hasSize(1); assertThatInstanceHasAllImportantInformation(runningHistoricProcessInstances.get(0)); } @@ -137,7 +133,7 @@ public void startedAfterParameterWorks() { optimizeService.getRunningHistoricProcessInstances(now, null, 10); // then - assertThat(runningHistoricProcessInstances.size()).isEqualTo(1); + assertThat(runningHistoricProcessInstances).hasSize(1); } @Test @@ -162,7 +158,7 @@ public void startedAtParameterWorks() { optimizeService.getRunningHistoricProcessInstances(null, now, 10); // then - assertThat(runningHistoricProcessInstances.size()).isEqualTo(1); + assertThat(runningHistoricProcessInstances).hasSize(1); assertThat(runningHistoricProcessInstances.get(0).getId()).isEqualTo(processInstance.getId()); } @@ -188,7 +184,7 @@ public void startedAfterAndStartedAtParameterWorks() { optimizeService.getRunningHistoricProcessInstances(now, now, 10); // then - assertThat(runningHistoricProcessInstances.size()).isEqualTo(0); + assertThat(runningHistoricProcessInstances).isEmpty(); } @Test @@ -211,7 +207,7 @@ public void maxResultsParameterWorks() { optimizeService.getRunningHistoricProcessInstances(pastDate(), null, 3); // then - assertThat(runningHistoricProcessInstances.size()).isEqualTo(3); + assertThat(runningHistoricProcessInstances).hasSize(3); } @Test @@ -242,7 +238,7 @@ public void resultIsSortedByStartTime() { optimizeService.getRunningHistoricProcessInstances(new Date(now.getTime()), null, 10); // then - assertThat(runningHistoricProcessInstances.size()).isEqualTo(3); + assertThat(runningHistoricProcessInstances).hasSize(3); assertThat(runningHistoricProcessInstances.get(0).getId()).isEqualTo(processInstance1.getId()); assertThat(runningHistoricProcessInstances.get(1).getId()).isEqualTo(processInstance2.getId()); assertThat(runningHistoricProcessInstances.get(2).getId()).isEqualTo(processInstance3.getId()); @@ -267,7 +263,7 @@ public void fetchOnlyRunningProcessInstances() { optimizeService.getRunningHistoricProcessInstances(pastDate(), null, 10); // then - assertThat(runningHistoricProcessInstances.size()).isEqualTo(1); + assertThat(runningHistoricProcessInstances).hasSize(1); assertThat(runningHistoricProcessInstances.get(0).getId()).isEqualTo(runningProcessInstance.getId()); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricTaskInstancesForOptimizeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricTaskInstancesForOptimizeTest.java index 7c06546fee0..e8583882755 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricTaskInstancesForOptimizeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/optimize/GetRunningHistoricTaskInstancesForOptimizeTest.java @@ -16,16 +16,12 @@ */ package org.operaton.bpm.engine.test.api.optimize; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Date; -import java.util.List; - -import org.operaton.bpm.engine.AuthorizationService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.authorization.Authorization; import org.operaton.bpm.engine.history.HistoricTaskInstance; import org.operaton.bpm.engine.identity.Group; @@ -41,11 +37,11 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public class GetRunningHistoricTaskInstancesForOptimizeTest { @@ -111,7 +107,7 @@ public void getRunningHistoricTaskInstances() { optimizeService.getRunningHistoricTaskInstances(null, null, 10); // then - assertThat(runningHistoricTaskInstances.size()).isEqualTo(1); + assertThat(runningHistoricTaskInstances).hasSize(1); assertThatTasksHaveAllImportantInformation(runningHistoricTaskInstances.get(0)); } @@ -137,7 +133,7 @@ public void startedAfterParameterWorks() { optimizeService.getRunningHistoricTaskInstances(now, null, 10); // then - assertThat(runningHistoricTaskInstances.size()).isEqualTo(1); + assertThat(runningHistoricTaskInstances).hasSize(1); assertThat(runningHistoricTaskInstances.get(0).getProcessInstanceId()).isEqualTo(processInstance2.getId()); } @@ -163,7 +159,7 @@ public void startedAtParameterWorks() { optimizeService.getRunningHistoricTaskInstances(null, now, 10); // then - assertThat(runningHistoricTaskInstances.size()).isEqualTo(1); + assertThat(runningHistoricTaskInstances).hasSize(1); assertThat(runningHistoricTaskInstances.get(0).getProcessInstanceId()).isEqualTo(processInstance1.getId()); } @@ -189,7 +185,7 @@ public void startedAfterAndFinishedAtParameterWorks() { optimizeService.getRunningHistoricTaskInstances(now, now, 10); // then - assertThat(runningHistoricTaskInstances.size()).isEqualTo(0); + assertThat(runningHistoricTaskInstances).isEmpty(); } @Test @@ -211,7 +207,7 @@ public void maxResultsParameterWorks() { optimizeService.getRunningHistoricTaskInstances(pastDate(), null, 3); // then - assertThat(runningHistoricTaskInstances.size()).isEqualTo(3); + assertThat(runningHistoricTaskInstances).hasSize(3); } @Test @@ -240,7 +236,7 @@ public void resultIsSortedByStartTime() { optimizeService.getRunningHistoricTaskInstances(pastDate(), null, 10); // then - assertThat(runningHistoricTaskInstances.size()).isEqualTo(3); + assertThat(runningHistoricTaskInstances).hasSize(3); assertThat(runningHistoricTaskInstances.get(0).getProcessInstanceId()).isEqualTo(processInstance1.getId()); assertThat(runningHistoricTaskInstances.get(1).getProcessInstanceId()).isEqualTo(processInstance2.getId()); assertThat(runningHistoricTaskInstances.get(2).getProcessInstanceId()).isEqualTo(processInstance3.getId()); @@ -265,7 +261,7 @@ public void fetchOnlyRunningTasks() { optimizeService.getRunningHistoricTaskInstances(pastDate(), null, 10); // then - assertThat(runningHistoricTaskInstances.size()).isEqualTo(1); + assertThat(runningHistoricTaskInstances).hasSize(1); assertThat(runningHistoricTaskInstances.get(0).getTaskDefinitionKey()).isEqualTo("userTask2"); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsDelegate.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsDelegate.java index 6a4c1929e79..773946a7500 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsDelegate.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsDelegate.java @@ -16,14 +16,14 @@ */ package org.operaton.bpm.engine.test.api.queries; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; - import org.operaton.bpm.engine.delegate.DelegateExecution; import org.operaton.bpm.engine.delegate.JavaDelegate; import org.operaton.bpm.engine.runtime.ProcessInstance; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + public class BoundedNumberOfMaxResultsDelegate implements JavaDelegate { @Override @@ -33,7 +33,7 @@ public void execute(DelegateExecution execution) throws Exception { .createProcessInstanceQuery() .list(); - assertThat(processInstances.size()).isEqualTo(0); + assertThat(processInstances).isEmpty(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsTest.java index 1945b30177f..5256c86279d 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/queries/BoundedNumberOfMaxResultsTest.java @@ -16,19 +16,12 @@ */ package org.operaton.bpm.engine.test.api.queries; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.fail; - -import java.util.ArrayList; -import java.util.List; - -import org.operaton.bpm.engine.BadUserRequestException; -import org.operaton.bpm.engine.HistoryService; -import org.operaton.bpm.engine.IdentityService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.filter.Filter; import org.operaton.bpm.engine.history.HistoricProcessInstance; import org.operaton.bpm.engine.history.HistoricProcessInstanceQuery; @@ -46,11 +39,11 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.*; public class BoundedNumberOfMaxResultsTest { @@ -124,7 +117,7 @@ public void shouldReturnUnboundedResults_UnboundMaxResults() { List processInstances = processInstanceQuery.list(); // then - assertThat(processInstances.size()).isEqualTo(0); + assertThat(processInstances).isEmpty(); } @Test @@ -139,7 +132,7 @@ public void shouldReturnUnboundedResults_NotAuthenticated() { List processInstances = processInstanceQuery.list(); // then - assertThat(processInstances.size()).isEqualTo(0); + assertThat(processInstances).isEmpty(); } @Test @@ -164,7 +157,7 @@ public Void execute(CommandContext commandContext) { .list(); // then - assertThat(tasks.size()).isEqualTo(1); + assertThat(tasks).hasSize(1); return null; } @@ -247,7 +240,7 @@ public void shouldNotThrowException_unboundedResultList() { List processInstances = processInstanceQuery.unlimitedList(); // then - assertThat(processInstances.size()).isEqualTo(1); + assertThat(processInstances).hasSize(1); } @Test @@ -823,7 +816,7 @@ public void shouldReturnResultWhenMaxResultsLimitNotExceeded() { historicProcessInstanceQuery.listPage(0, 10); // then - assertThat(historicProcessInstances.size()).isEqualTo(1); + assertThat(historicProcessInstances).hasSize(1); } @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_ACTIVITY) @@ -847,7 +840,7 @@ public void shouldReturnResultWhenMaxResultsLimitNotExceeded2() { historicProcessInstanceQuery.listPage(0, 9); // then - assertThat(historicProcessInstances.size()).isEqualTo(1); + assertThat(historicProcessInstances).hasSize(1); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/CaseDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/CaseDefinitionQueryTest.java index 7cfdcda792e..8863b021913 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/CaseDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/CaseDefinitionQueryTest.java @@ -115,7 +115,7 @@ public void testQueryByCaseDefinitionIds() { .caseDefinitionIdIn(ids.toArray(new String[ids.size()])) .list(); - assertThat(ids.size()).isEqualTo(caseDefinitions.size()); + assertThat(ids).hasSize(caseDefinitions.size()); for (CaseDefinition caseDefinition : caseDefinitions) { assertThat(ids).contains(caseDefinition.getId()).withFailMessage("Expected to find case definition " + caseDefinition); } @@ -123,7 +123,7 @@ public void testQueryByCaseDefinitionIds() { assertThat(repositoryService.createCaseDefinitionQuery() .caseDefinitionIdIn(ids.toArray(new String[ids.size()])) .caseDefinitionId("nonExistent") - .count()).isEqualTo(0); + .count()).isZero(); } @Test @@ -517,7 +517,7 @@ public void testQuerySorting() { .desc(); List caseDefinitions = query.list(); - assertThat(caseDefinitions.size()).isEqualTo(4); + assertThat(caseDefinitions).hasSize(4); assertThat(caseDefinitions.get(0).getKey()).isEqualTo("one"); assertThat(caseDefinitions.get(0).getVersion()).isEqualTo(2); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionDefinitionQueryTest.java index cd930033dbf..6974240f850 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionDefinitionQueryTest.java @@ -209,7 +209,7 @@ public void testQueryByDeploymentTimeAfter() { // when decisionDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAfter(timeAfterDeploymentThree).list(); // then - assertThat(decisionDefinitions).hasSize(0); + assertThat(decisionDefinitions).isEmpty(); } @Test @@ -252,7 +252,7 @@ public void testQueryByDeploymentTimeAt() throws ParseException { assertThatDecisionDefinitionsWereDeployedAt(processDefinitions, timeAtDeploymentThree); processDefinitions = repositoryService.createDecisionDefinitionQuery().deployedAt(DateUtils.addSeconds(ClockUtil.getCurrentTime(), 5)).list(); - assertThat(processDefinitions).hasSize(0); + assertThat(processDefinitions).isEmpty(); } @Test @@ -635,7 +635,7 @@ public void querySorting() { .desc(); List decisionDefinitions = query.list(); - assertThat(decisionDefinitions.size()).isEqualTo(4); + assertThat(decisionDefinitions).hasSize(4); assertThat(decisionDefinitions.get(0).getKey()).isEqualTo("one"); assertThat(decisionDefinitions.get(0).getVersion()).isEqualTo(2); @@ -648,7 +648,7 @@ public void querySorting() { protected void verifyQueryResults(DecisionDefinitionQuery query, int expectedCount) { assertThat(query.count()).isEqualTo(expectedCount); - assertThat(query.list().size()).isEqualTo(expectedCount); + assertThat(query.list()).hasSize(expectedCount); } @org.operaton.bpm.engine.test.Deployment(resources = { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionRequirementsDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionRequirementsDefinitionQueryTest.java index 159bc258891..4351bd889f4 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionRequirementsDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DecisionRequirementsDefinitionQueryTest.java @@ -69,7 +69,7 @@ public void init() { public void queryByDecisionRequirementsDefinitionId() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionId("notExisting").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionId("notExisting").count()).isZero(); assertThat(query.decisionRequirementsDefinitionId(decisionRequirementsDefinitionId).count()).isEqualTo(1L); assertThat(query.singleResult().getKey()).isEqualTo("score"); @@ -79,7 +79,7 @@ public void queryByDecisionRequirementsDefinitionId() { public void queryByDecisionRequirementsDefinitionIds() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionIdIn("not", "existing").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionIdIn("not", "existing").count()).isZero(); assertThat(query.decisionRequirementsDefinitionIdIn(decisionRequirementsDefinitionId, "notExisting").count()).isEqualTo(1L); assertThat(query.singleResult().getKey()).isEqualTo("score"); @@ -89,7 +89,7 @@ public void queryByDecisionRequirementsDefinitionIds() { public void queryByDecisionRequirementsDefinitionKey() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionKey("notExisting").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionKey("notExisting").count()).isZero(); assertThat(query.decisionRequirementsDefinitionKey("score").count()).isEqualTo(1L); assertThat(query.singleResult().getKey()).isEqualTo("score"); @@ -99,7 +99,7 @@ public void queryByDecisionRequirementsDefinitionKey() { public void queryByDecisionRequirementsDefinitionKeyLike() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionKeyLike("%notExisting%").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionKeyLike("%notExisting%").count()).isZero(); assertThat(query.decisionRequirementsDefinitionKeyLike("%sco%").count()).isEqualTo(1L); assertThat(query.decisionRequirementsDefinitionKeyLike("%dis%").count()).isEqualTo(2L); @@ -110,7 +110,7 @@ public void queryByDecisionRequirementsDefinitionKeyLike() { public void queryByDecisionRequirementsDefinitionName() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionName("notExisting").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionName("notExisting").count()).isZero(); assertThat(query.decisionRequirementsDefinitionName("Score").count()).isEqualTo(1L); assertThat(query.singleResult().getKey()).isEqualTo("score"); @@ -120,7 +120,7 @@ public void queryByDecisionRequirementsDefinitionName() { public void queryByDecisionRequirementsDefinitionNameLike() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionNameLike("%notExisting%").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionNameLike("%notExisting%").count()).isZero(); assertThat(query.decisionRequirementsDefinitionNameLike("%Sco%").count()).isEqualTo(1L); assertThat(query.decisionRequirementsDefinitionNameLike("%ish%").count()).isEqualTo(2L); @@ -130,7 +130,7 @@ public void queryByDecisionRequirementsDefinitionNameLike() { public void queryByDecisionRequirementsDefinitionCategory() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionCategory("notExisting").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionCategory("notExisting").count()).isZero(); assertThat(query.decisionRequirementsDefinitionCategory("test-drd-1").count()).isEqualTo(1L); assertThat(query.singleResult().getKey()).isEqualTo("score"); @@ -140,7 +140,7 @@ public void queryByDecisionRequirementsDefinitionCategory() { public void queryByDecisionRequirementsDefinitionCategoryLike() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionCategoryLike("%notExisting%").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionCategoryLike("%notExisting%").count()).isZero(); assertThat(query.decisionRequirementsDefinitionCategoryLike("%test%").count()).isEqualTo(3L); @@ -151,7 +151,7 @@ public void queryByDecisionRequirementsDefinitionCategoryLike() { public void queryByResourceName() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionResourceName("notExisting").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionResourceName("notExisting").count()).isZero(); assertThat(query.decisionRequirementsDefinitionResourceName(DRD_SCORE_RESOURCE).count()).isEqualTo(1L); assertThat(query.singleResult().getKey()).isEqualTo("score"); @@ -161,7 +161,7 @@ public void queryByResourceName() { public void queryByResourceNameLike() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.decisionRequirementsDefinitionResourceNameLike("%notExisting%").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionResourceNameLike("%notExisting%").count()).isZero(); assertThat(query.decisionRequirementsDefinitionResourceNameLike("%.dmn11.xml%").count()).isEqualTo(4L); } @@ -179,7 +179,7 @@ public void queryByVersion() { assertThat(query.decisionRequirementsDefinitionVersion(1).count()).isEqualTo(3L); assertThat(query.decisionRequirementsDefinitionVersion(2).count()).isEqualTo(1L); - assertThat(query.decisionRequirementsDefinitionVersion(3).count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionVersion(3).count()).isZero(); } @Test @@ -194,7 +194,7 @@ public void queryByLatest() { public void queryByDeploymentId() { DecisionRequirementsDefinitionQuery query = repositoryService.createDecisionRequirementsDefinitionQuery(); - assertThat(query.deploymentId("notExisting").count()).isEqualTo(0L); + assertThat(query.deploymentId("notExisting").count()).isZero(); assertThat(query.deploymentId(firstDeploymentId).count()).isEqualTo(2L); assertThat(query.deploymentId(secondDeploymentId).count()).isEqualTo(1L); @@ -205,7 +205,7 @@ public void orderByDecisionRequirementsDefinitionId() { List decisionRequirementsDefinitions = repositoryService.createDecisionRequirementsDefinitionQuery() .orderByDecisionRequirementsDefinitionId().asc().list(); - assertThat(decisionRequirementsDefinitions.size()).isEqualTo(4); + assertThat(decisionRequirementsDefinitions).hasSize(4); assertThat(decisionRequirementsDefinitions.get(0).getId()).startsWith("dish:1"); assertThat(decisionRequirementsDefinitions.get(1).getId()).startsWith("dish:2"); assertThat(decisionRequirementsDefinitions.get(2).getId()).startsWith("score:1"); @@ -225,7 +225,7 @@ public void orderByDecisionRequirementsDefinitionKey() { List decisionRequirementsDefinitions = repositoryService.createDecisionRequirementsDefinitionQuery() .orderByDecisionRequirementsDefinitionKey().asc().list(); - assertThat(decisionRequirementsDefinitions.size()).isEqualTo(4); + assertThat(decisionRequirementsDefinitions).hasSize(4); assertThat(decisionRequirementsDefinitions.get(0).getKey()).isEqualTo("dish"); assertThat(decisionRequirementsDefinitions.get(1).getKey()).isEqualTo("dish"); assertThat(decisionRequirementsDefinitions.get(2).getKey()).isEqualTo("score"); @@ -245,7 +245,7 @@ public void orderByDecisionRequirementsDefinitionName() { List decisionRequirementsDefinitions = repositoryService.createDecisionRequirementsDefinitionQuery() .orderByDecisionRequirementsDefinitionName().asc().list(); - assertThat(decisionRequirementsDefinitions.size()).isEqualTo(4); + assertThat(decisionRequirementsDefinitions).hasSize(4); assertThat(decisionRequirementsDefinitions.get(0).getName()).isEqualTo("Dish"); assertThat(decisionRequirementsDefinitions.get(1).getName()).isEqualTo("Dish"); assertThat(decisionRequirementsDefinitions.get(2).getName()).isEqualTo("Score"); @@ -265,7 +265,7 @@ public void orderByDecisionRequirementsDefinitionCategory() { List decisionRequirementsDefinitions = repositoryService.createDecisionRequirementsDefinitionQuery() .orderByDecisionRequirementsDefinitionCategory().asc().list(); - assertThat(decisionRequirementsDefinitions.size()).isEqualTo(4); + assertThat(decisionRequirementsDefinitions).hasSize(4); assertThat(decisionRequirementsDefinitions.get(0).getCategory()).isEqualTo("test-drd-1"); assertThat(decisionRequirementsDefinitions.get(1).getCategory()).isEqualTo("test-drd-2"); assertThat(decisionRequirementsDefinitions.get(2).getCategory()).isEqualTo("test-drd-2"); @@ -285,7 +285,7 @@ public void orderByDecisionRequirementsDefinitionVersion() { List decisionRequirementsDefinitions = repositoryService.createDecisionRequirementsDefinitionQuery() .orderByDecisionRequirementsDefinitionVersion().asc().list(); - assertThat(decisionRequirementsDefinitions.size()).isEqualTo(4); + assertThat(decisionRequirementsDefinitions).hasSize(4); assertThat(decisionRequirementsDefinitions.get(0).getVersion()).isEqualTo(1); assertThat(decisionRequirementsDefinitions.get(1).getVersion()).isEqualTo(1); assertThat(decisionRequirementsDefinitions.get(2).getVersion()).isEqualTo(1); @@ -304,7 +304,7 @@ public void orderByDeploymentId() { List decisionRequirementsDefinitions = repositoryService.createDecisionRequirementsDefinitionQuery() .orderByDeploymentId().asc().list(); - assertThat(decisionRequirementsDefinitions.size()).isEqualTo(4); + assertThat(decisionRequirementsDefinitions).hasSize(4); assertThat(decisionRequirementsDefinitions.get(0).getDeploymentId()).isEqualTo(firstDeploymentId); assertThat(decisionRequirementsDefinitions.get(1).getDeploymentId()).isEqualTo(firstDeploymentId); assertThat(decisionRequirementsDefinitions.get(2).getDeploymentId()).isEqualTo(secondDeploymentId); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DeleteProcessDefinitionTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DeleteProcessDefinitionTest.java index df43598686e..178bcc71430 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DeleteProcessDefinitionTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/DeleteProcessDefinitionTest.java @@ -16,24 +16,11 @@ */ package org.operaton.bpm.engine.test.api.repository; -import static junit.framework.TestCase.assertNotNull; -import static junit.framework.TestCase.assertNull; -import static junit.framework.TestCase.assertTrue; -import static junit.framework.TestCase.fail; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.operaton.bpm.engine.test.api.repository.RedeploymentTest.DEPLOYMENT_NAME; -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.operaton.bpm.engine.HistoryService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngineException; -import org.operaton.bpm.engine.RepositoryService; -import org.operaton.bpm.engine.RuntimeService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.delegate.ExecutionListener; import org.operaton.bpm.engine.exception.NotFoundException; import org.operaton.bpm.engine.exception.NullValueException; @@ -51,10 +38,17 @@ import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; import org.operaton.commons.utils.cache.Cache; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static junit.framework.TestCase.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.assertEquals; +import static org.operaton.bpm.engine.test.api.repository.RedeploymentTest.DEPLOYMENT_NAME; /** * @@ -378,9 +372,9 @@ public void testDeleteProcessDefinitionsByKeyCascading() { .delete(); // then - assertThat(historyService.createHistoricVariableInstanceQuery().count()).isEqualTo(0L); - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); - assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricVariableInstanceQuery().count()).isZero(); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); + assertThat(repositoryService.createProcessDefinitionQuery().count()).isZero(); } @Test @@ -402,7 +396,7 @@ public void testDeleteProcessDefinitionsByKeyWithCustomListenersSkipped() { .delete(); // then - assertThat(IncrementCounterListener.counter).isEqualTo(0); + assertThat(IncrementCounterListener.counter).isZero(); } @Test @@ -425,7 +419,7 @@ public void testDeleteProcessDefinitionsByKeyWithIoMappingsSkipped() { List processDefinitions = repositoryService.createProcessDefinitionQuery().list(); // then - assertThat(processDefinitions.size()).isEqualTo(0); + assertThat(processDefinitions).isEmpty(); } @Test @@ -518,9 +512,9 @@ public void testDeleteProcessDefinitionsByIdsCascading() { .delete(); // then - assertThat(historyService.createHistoricVariableInstanceQuery().count()).isEqualTo(0L); - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); - assertThat(repositoryService.createProcessDefinitionQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricVariableInstanceQuery().count()).isZero(); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); + assertThat(repositoryService.createProcessDefinitionQuery().count()).isZero(); } @Test @@ -541,7 +535,7 @@ public void testDeleteProcessDefinitionsByIdsWithCustomListenersSkipped() { .delete(); // then - assertThat(IncrementCounterListener.counter).isEqualTo(0); + assertThat(IncrementCounterListener.counter).isZero(); } @Test @@ -565,7 +559,7 @@ public void testDeleteProcessDefinitionsByIdsWithIoMappingsSkipped() { List processDefinitions = repositoryService.createProcessDefinitionQuery().list(); // then - assertThat(processDefinitions.size()).isEqualTo(0); + assertThat(processDefinitions).isEmpty(); } private void deployTwoProcessDefinitions() { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/HistoryTimeToLiveDeploymentTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/HistoryTimeToLiveDeploymentTest.java index 31b72286ee2..63257de0638 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/HistoryTimeToLiveDeploymentTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/HistoryTimeToLiveDeploymentTest.java @@ -197,7 +197,7 @@ public void shouldNotLogMessageOnDefaultConfigOriginatingFromConfig() { .addClasspathResource("org/operaton/bpm/engine/test/api/repository/version1.bpmn20.xml")); // then - assertThat(loggingRule.getFilteredLog(EXPECTED_DEFAULT_CONFIG_MSG)).hasSize(0); + assertThat(loggingRule.getFilteredLog(EXPECTED_DEFAULT_CONFIG_MSG)).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/ProcessDefinitionQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/ProcessDefinitionQueryTest.java index 781d7882e30..513eb8d7a5f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/ProcessDefinitionQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/repository/ProcessDefinitionQueryTest.java @@ -16,18 +16,10 @@ */ package org.operaton.bpm.engine.test.api.repository; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.inverted; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.processDefinitionByDeployTime; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.verifySortingAndCount; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.List; -import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.time.DateUtils; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.operaton.bpm.engine.ProcessEngineException; import org.operaton.bpm.engine.impl.util.ClockUtil; import org.operaton.bpm.engine.repository.Deployment; @@ -37,9 +29,16 @@ import org.operaton.bpm.engine.runtime.ProcessInstance; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.*; /** @@ -89,7 +88,7 @@ public void testProcessDefinitionProperties() { assertThat(processDefinition.getDescription()).isEqualTo("Desc one"); assertThat(processDefinition.getId()).startsWith("one:1"); assertThat(processDefinition.getCategory()).isEqualTo("Examples"); - assertThat(processDefinition.isStartableInTasklist()).isEqualTo(true); + assertThat(processDefinition.isStartableInTasklist()).isTrue(); processDefinition = processDefinitions.get(1); assertThat(processDefinition.getKey()).isEqualTo("one"); @@ -97,7 +96,7 @@ public void testProcessDefinitionProperties() { assertThat(processDefinition.getDescription()).isEqualTo("Desc one"); assertThat(processDefinition.getId()).startsWith("one:2"); assertThat(processDefinition.getCategory()).isEqualTo("Examples"); - assertThat(processDefinition.isStartableInTasklist()).isEqualTo(true); + assertThat(processDefinition.isStartableInTasklist()).isTrue(); processDefinition = processDefinitions.get(2); assertThat(processDefinition.getKey()).isEqualTo("two"); @@ -105,7 +104,7 @@ public void testProcessDefinitionProperties() { assertThat(processDefinition.getDescription()).isNull(); assertThat(processDefinition.getId().startsWith("two:1")); assertThat(processDefinition.getCategory()).isEqualTo("Examples2"); - assertThat(processDefinition.isStartableInTasklist()).isEqualTo(true); + assertThat(processDefinition.isStartableInTasklist()).isTrue(); processDefinition = processDefinitions.get(3); assertThat(processDefinition.getKey()).isEqualTo("xyz_"); @@ -113,7 +112,7 @@ public void testProcessDefinitionProperties() { assertThat(processDefinition.getDescription()).isNull(); assertThat(processDefinition.getId().startsWith("xyz_:1")); assertThat(processDefinition.getCategory()).isEqualTo("xyz_"); - assertThat(processDefinition.isStartableInTasklist()).isEqualTo(false); + assertThat(processDefinition.isStartableInTasklist()).isFalse(); } @Test @@ -177,7 +176,7 @@ public void testQueryByDeploymentTimeAfter() { // when processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAfter(timeAfterDeploymentThree).list(); // then - assertThat(processDefinitions).hasSize(0); + assertThat(processDefinitions).isEmpty(); } @Test @@ -220,7 +219,7 @@ public void testQueryByDeploymentTimeAt() throws ParseException { assertThatProcessDefinitionsWereDeployedAt(processDefinitions, timeAtDeploymentThree); processDefinitions = repositoryService.createProcessDefinitionQuery().deployedAt(DateUtils.addSeconds(ClockUtil.getCurrentTime(), 5)).list(); - assertThat(processDefinitions).hasSize(0); + assertThat(processDefinitions).isEmpty(); } @Test @@ -304,7 +303,7 @@ public void testQueryByKeys() { assertThat(found).withFailMessage("Expected to find process definition " + processDefinition); } - assertThat(repositoryService.createProcessDefinitionQuery().processDefinitionKey("dummyKey").processDefinitionKeysIn(processDefinitionKeys).count()).isEqualTo(0); + assertThat(repositoryService.createProcessDefinitionQuery().processDefinitionKey("dummyKey").processDefinitionKeysIn(processDefinitionKeys).count()).isZero(); } @Test @@ -466,7 +465,7 @@ public void testQuerySorting() { // Typical use case query = repositoryService.createProcessDefinitionQuery().orderByProcessDefinitionKey().asc().orderByProcessDefinitionVersion().desc(); List processDefinitions = query.list(); - assertThat(processDefinitions.size()).isEqualTo(4); + assertThat(processDefinitions).hasSize(4); assertThat(processDefinitions.get(0).getKey()).isEqualTo("one"); assertThat(processDefinitions.get(0).getVersion()).isEqualTo(2); @@ -493,7 +492,7 @@ public void testQueryByMessageSubscription() { assertThat(repositoryService.createProcessDefinitionQuery() .messageEventSubscriptionName("bogus") - .count()).isEqualTo(0); + .count()).isZero(); repositoryService.deleteDeployment(deployment.getId()); } @@ -510,7 +509,7 @@ public void testQueryByIncidentId() { testRule.waitForJobExecutorToProcessAllJobs(); List incidentList = runtimeService.createIncidentQuery().list(); - assertThat(incidentList.size()).isEqualTo(1); + assertThat(incidentList).hasSize(1); Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult(); @@ -578,7 +577,7 @@ public void testQueryByIncidentMessage() { testRule.waitForJobExecutorToProcessAllJobs(); List incidentList = runtimeService.createIncidentQuery().list(); - assertThat(incidentList.size()).isEqualTo(1); + assertThat(incidentList).hasSize(1); Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult(); @@ -663,7 +662,7 @@ public void testQueryByProcessDefinitionIds() { assertThat(found).withFailMessage("Expected to find process definition " + processDefinition); } - assertThat(repositoryService.createProcessDefinitionQuery().processDefinitionId("dummyId").processDefinitionIdIn(ids).count()).isEqualTo(0); + assertThat(repositoryService.createProcessDefinitionQuery().processDefinitionId("dummyId").processDefinitionIdIn(ids).count()).isZero(); } @Test @@ -920,7 +919,7 @@ public void testQueryByStartableInTasklistNestedProcessDeployedSecondTime() { .deploymentId(deploymentId1) .notStartableInTasklist() .count(); - assertThat(processes).isEqualTo(0); + assertThat(processes).isZero(); // deploy second version // startable super process diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CorrelateAllMessageBatchTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CorrelateAllMessageBatchTest.java index 429e26ef490..ad9c5e2b263 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CorrelateAllMessageBatchTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CorrelateAllMessageBatchTest.java @@ -16,24 +16,13 @@ */ package org.operaton.bpm.engine.test.api.runtime; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.tuple; -import static java.util.stream.Stream.of; -import static java.util.stream.Collectors.toSet; - -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.List; - import org.assertj.core.api.Assertions; -import org.operaton.bpm.engine.BadUserRequestException; -import org.operaton.bpm.engine.HistoryService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.ProcessEngineException; -import org.operaton.bpm.engine.RuntimeService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.batch.Batch; import org.operaton.bpm.engine.batch.history.HistoricBatch; import org.operaton.bpm.engine.exception.NullValueException; @@ -54,11 +43,15 @@ import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Arrays; +import java.util.Collections; +import java.util.Date; +import java.util.List; + +import static java.util.stream.Collectors.toSet; +import static java.util.stream.Stream.of; +import static org.assertj.core.api.Assertions.*; public class CorrelateAllMessageBatchTest { @@ -137,17 +130,17 @@ public void shouldCorrelateAllWithInstanceIds() { .processInstanceId(processInstanceIdThree); // assume - assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceOne.count()).isZero(); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); // when rule.syncExec(batch); // then assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(1L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); } @Test @@ -176,17 +169,17 @@ public void shouldCorrelateAllWithInstanceQuery() { .processInstanceId(processInstanceIdThree); // assume - assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceOne.count()).isZero(); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); // when rule.syncExec(batch); // then assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(1L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); } @Test @@ -215,17 +208,17 @@ public void shouldCorrelateAllWithHistoricInstanceQuery() { .processInstanceId(processInstanceIdThree); // assume - assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceOne.count()).isZero(); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); // when rule.syncExec(batch); // then assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(1L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); } @Test @@ -253,16 +246,16 @@ public void shouldCorrelateAllWithoutMessage() { .processInstanceId(processInstanceIdThree); // assume - assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceOne.count()).isZero(); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); // when rule.syncExec(batch); // then assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(1L); - assertThat(taskExecutionQueryInstanceTwo.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceTwo.count()).isZero(); assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(1L); } @@ -286,15 +279,15 @@ public void shouldNotCorrelateStartMessageEvent() { .processDefinitionKey(PROCESS_THREE_KEY); // assume - assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(0L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceOne.count()).isZero(); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); // when rule.syncExec(batch); // then assertThat(taskExecutionQueryInstanceOne.count()).isEqualTo(1L); - assertThat(taskExecutionQueryInstanceThree.count()).isEqualTo(0L); + assertThat(taskExecutionQueryInstanceThree.count()).isZero(); } @Test @@ -557,7 +550,7 @@ public void shouldNotLogInstanceOperation() { .operationType(UserOperationLogEntry.OPERATION_TYPE_SET_VARIABLE) .list(); - assertThat(logs.size()).isEqualTo(0); + assertThat(logs).isEmpty(); // clear managementService.deleteBatch(batch.getId(), true); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CreateAndResolveIncidentTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CreateAndResolveIncidentTest.java index bf2e6ed56b1..d9272cf4581 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CreateAndResolveIncidentTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/CreateAndResolveIncidentTest.java @@ -280,7 +280,7 @@ public void shouldCallDeleteForCustomHandlerOnProcessInstanceCancellation() { assertThat(deleteContext.getConfiguration()).isEqualTo("configuration"); long numIncidents = runtimeService.createIncidentQuery().count(); - assertThat(numIncidents).isEqualTo(0); + assertThat(numIncidents).isZero(); } @Test @@ -306,7 +306,7 @@ public void shouldCallDeleteForJobHandlerOnProcessInstanceCancellation() { assertThat(deleteContext.getConfiguration()).isEqualTo(job.getId()); long numIncidents = runtimeService.createIncidentQuery().count(); - assertThat(numIncidents).isEqualTo(0); + assertThat(numIncidents).isZero(); } @Test @@ -334,7 +334,7 @@ public void shouldCallDeleteForExternalTasksHandlerOnProcessInstanceCancellation assertThat(deleteContext.getConfiguration()).isEqualTo(task.getId()); long numIncidents = runtimeService.createIncidentQuery().count(); - assertThat(numIncidents).isEqualTo(0); + assertThat(numIncidents).isZero(); } @Test @@ -359,7 +359,7 @@ public void shouldCallResolveForJobHandler() { assertThat(deleteContext.getConfiguration()).isEqualTo(job.getId()); long numIncidents = runtimeService.createIncidentQuery().count(); - assertThat(numIncidents).isEqualTo(0); + assertThat(numIncidents).isZero(); } @Test @@ -386,7 +386,7 @@ public void shouldCallResolveForExternalTaskHandler() { assertThat(resolveContext.getConfiguration()).isEqualTo(task.getId()); long numIncidents = runtimeService.createIncidentQuery().count(); - assertThat(numIncidents).isEqualTo(0); + assertThat(numIncidents).isZero(); } public static class CustomIncidentHandler implements IncidentHandler { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/IncidentUserOperationLogTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/IncidentUserOperationLogTest.java index 94cb5c8793c..40a2c1dee7c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/IncidentUserOperationLogTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/IncidentUserOperationLogTest.java @@ -41,7 +41,7 @@ public void shouldLogIncidentCreation() { // given testRule.deploy(ProcessModels.TWO_TASKS_PROCESS); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process"); - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when Incident incident = doAuthenticated(() -> runtimeService.createIncident("foo", processInstance.getId(), "aa", "bar")); @@ -75,13 +75,13 @@ public void shouldLogIncidentCreation() { @Test public void shouldNotLogIncidentCreationFailure() { // given - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when/then assertThatThrownBy(() -> runtimeService.createIncident("foo", null, "userTask1", "bar")) .isInstanceOf(BadUserRequestException.class); - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); } @Test @@ -90,7 +90,7 @@ public void shouldLogIncidentResolution() { testRule.deploy(ProcessModels.TWO_TASKS_PROCESS); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("Process"); Incident incident = runtimeService.createIncident("foo", processInstance.getId(), "userTask1", "bar"); - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when doAuthenticated(() -> runtimeService.resolveIncident(incident.getId())); @@ -113,13 +113,13 @@ public void shouldLogIncidentResolution() { @Test public void shouldNotLogIncidentResolutionFailure() { // given - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when/then assertThatThrownBy(() -> runtimeService.resolveIncident("foo")) .isInstanceOf(NotFoundException.class); - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); } @Test @@ -131,7 +131,7 @@ public void shouldLogSetAnnotationToIncident() { Incident incident = runtimeService.createIncident("foo", processInstance.getId(), "userTask1", "bar"); // assume - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when doAuthenticated(() -> runtimeService.setAnnotationForIncidentById(incident.getId(), annotation)); @@ -155,7 +155,7 @@ public void shouldLogClearAnnotationToIncident() { Incident incident = runtimeService.createIncident("foo", processInstance.getId(), "userTask1", "bar"); // assume - assertThat(historyService.createUserOperationLogQuery().count()).isEqualTo(0L); + assertThat(historyService.createUserOperationLogQuery().count()).isZero(); // when doAuthenticated(() -> runtimeService.clearAnnotationForIncidentById(incident.getId())); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceModificationSubProcessTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceModificationSubProcessTest.java index 07aac8b70d9..8e7a6a6f001 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceModificationSubProcessTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceModificationSubProcessTest.java @@ -149,7 +149,7 @@ public void shouldCompleteParentProcess() { .execute(); // then the process should be finished - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @Test @@ -235,7 +235,7 @@ public void shouldCompleteParentProcessWithParallelGateway() { .execute(); // then the process should be finished - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @@ -324,7 +324,7 @@ public void shouldCompleteParentProcessWithMultiInstance() { .execute(); // then the process should be finished - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @@ -414,7 +414,7 @@ public void shouldCompleteParentProcessWithMultiInstanceInsideEmbeddedSubProcess .execute(); // then the process should be finished - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @Test @@ -510,7 +510,7 @@ public void shouldCompleteParentProcessWithMultiInstanceEmbeddedSubProcess() { .execute(); // then the process should be finished - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @Test @@ -605,7 +605,7 @@ public void shouldCancelParentProcessWithMultiInstanceCallActivity() { .execute(); // then - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @Test @@ -655,7 +655,7 @@ public void shouldCancelParentProcessWithCallActivityInMultiInstanceEmbeddedSubp .execute(); // then - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryOrTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryOrTest.java index dc2037f75e7..e4eb35b496b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryOrTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryOrTest.java @@ -558,7 +558,7 @@ public void shouldReturnByProcessDefinitionKeyOrActivityId() { .list(); // then - assertThat(processInstances.size()).isEqualTo(2); + assertThat(processInstances).hasSize(2); } @Test @@ -597,7 +597,7 @@ public void shouldReturnByProcessDefinitionIdOrIncidentType() { .list(); // then - assertThat(processInstances.size()).isEqualTo(2); + assertThat(processInstances).hasSize(2); } } \ No newline at end of file diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryTest.java index 9c13c24fc01..6868c7f9aeb 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceQueryTest.java @@ -16,44 +16,17 @@ */ package org.operaton.bpm.engine.test.api.runtime; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.processInstanceByBusinessKey; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.processInstanceByProcessDefinitionId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.processInstanceByProcessInstanceId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.verifySorting; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -import org.operaton.bpm.engine.CaseService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngineException; -import org.operaton.bpm.engine.RepositoryService; -import org.operaton.bpm.engine.RuntimeService; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.exception.NullValueException; import org.operaton.bpm.engine.impl.ProcessInstanceQueryImpl; import org.operaton.bpm.engine.impl.util.ImmutablePair; import org.operaton.bpm.engine.repository.ProcessDefinition; -import org.operaton.bpm.engine.runtime.Execution; -import org.operaton.bpm.engine.runtime.Incident; -import org.operaton.bpm.engine.runtime.Job; -import org.operaton.bpm.engine.runtime.ProcessInstance; -import org.operaton.bpm.engine.runtime.ProcessInstanceQuery; +import org.operaton.bpm.engine.runtime.*; import org.operaton.bpm.engine.task.Task; import org.operaton.bpm.engine.test.Deployment; import org.operaton.bpm.engine.test.ProcessEngineRule; @@ -63,11 +36,14 @@ import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.*; +import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.*; /** * @author Joram Barrez @@ -275,7 +251,7 @@ public void testQueryByProcessDefinitionKeyIn() { // then assertThat(query.count()).isEqualTo(5l); - assertThat(query.list().size()).isEqualTo(5); + assertThat(query.list()).hasSize(5); } @Test @@ -285,8 +261,8 @@ public void testQueryByNonExistingProcessDefinitionKeyIn() { .processDefinitionKeyIn("not-existing-key"); // then - assertThat(query.count()).isEqualTo(0l); - assertThat(query.list().size()).isEqualTo(0); + assertThat(query.count()).isZero(); + assertThat(query.list()).isEmpty(); } @Test @@ -331,7 +307,7 @@ public void testQueryByProcessDefinitionKeyNotIn() { // then assertThat(query.count()).isEqualTo(2l); - assertThat(query.list().size()).isEqualTo(2); + assertThat(query.list()).hasSize(2); } @Test @@ -342,7 +318,7 @@ public void testQueryByNonExistingProcessDefinitionKeyNotIn() { // then assertThat(query.count()).isEqualTo(5l); - assertThat(query.list().size()).isEqualTo(5); + assertThat(query.list()).hasSize(5); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceTerminationCascadeStateTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceTerminationCascadeStateTest.java index 53b108b225b..1b1089f683c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceTerminationCascadeStateTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/ProcessInstanceTerminationCascadeStateTest.java @@ -204,7 +204,7 @@ public void shouldCascadeStateFromProcessDownCancelation() { protected void assertHistoricProcessInstances() { List historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list(); - assertThat(historicProcessInstances.size()).isEqualTo(2); + assertThat(historicProcessInstances).hasSize(2); for (HistoricProcessInstance historicProcessInstance : historicProcessInstances) { assertThat(historicProcessInstance.getState()) .isEqualTo(externallyTerminated ? HistoricProcessInstance.STATE_EXTERNALLY_TERMINATED : HistoricProcessInstance.STATE_INTERNALLY_TERMINATED); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RootProcessInstanceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RootProcessInstanceTest.java index 5b7c064eb07..997c6f5de66 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RootProcessInstanceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RootProcessInstanceTest.java @@ -195,8 +195,8 @@ public void shouldPointToRootWithInitialCallAfterParallelGateway() { assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(5L); assertThat(callingProcessInstance.getProcessInstanceId()).isNotNull(); - assertThat(calledProcessInstances.size()).isEqualTo(2); - assertThat(calledAndCallingProcessInstances.size()).isEqualTo(2); + assertThat(calledProcessInstances).hasSize(2); + assertThat(calledAndCallingProcessInstances).hasSize(2); // then assertThat(callingProcessInstance.getRootProcessInstanceId()).isEqualTo(callingProcessInstance.getProcessInstanceId()); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceAsyncOperationsTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceAsyncOperationsTest.java index b5692b74e64..219d26bb4ba 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceAsyncOperationsTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceAsyncOperationsTest.java @@ -16,18 +16,11 @@ */ package org.operaton.bpm.engine.test.api.runtime; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.operaton.bpm.engine.test.api.runtime.migration.ModifiableBpmnModelInstance.modify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; import org.assertj.core.api.Assertions; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.ProcessEngineException; import org.operaton.bpm.engine.batch.Batch; @@ -47,10 +40,16 @@ import org.operaton.bpm.engine.test.util.ProcessEngineTestRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.*; +import static org.operaton.bpm.engine.test.api.runtime.migration.ModifiableBpmnModelInstance.modify; /** @@ -156,7 +155,7 @@ public void testDeleteProcessInstancesAsyncWithFake() throws Exception { // then assertEquals(0, exceptions.size()); - assertThat(managementService.createJobQuery().withException().list().size()).isEqualTo(0); + assertThat(managementService.createJobQuery().withException().list()).isEmpty(); processIds.remove("aFake"); assertHistoricTaskDeletionPresent(processIds, TESTING_INSTANCE_DELETE, testRule); @@ -330,7 +329,7 @@ public void testDeleteProcessInstancesAsyncWithInvalidQueryParameter() throws Ex } protected void assertProcessInstancesAreDeleted() { - assertThat(runtimeService.createProcessInstanceQuery().list().size()).isEqualTo(0); + assertThat(runtimeService.createProcessInstanceQuery().list()).isEmpty(); } @Test @@ -355,7 +354,7 @@ public void testDeleteProcessInstancesAsyncWithSkipCustomListeners() { executeBatchJobs(batch); // then - assertThat(IncrementCounterListener.counter).isEqualTo(0); + assertThat(IncrementCounterListener.counter).isZero(); } @Test @@ -434,8 +433,8 @@ public void shouldNotApplySkipIoMappingOnDeleteProcessInstancesAsyncFalse() { testRule.assertProcessEnded(instanceId1); testRule.assertProcessEnded(instanceId2); - assertThat(historyService.createHistoricVariableInstanceQuery().processInstanceId(instanceId1).list().size()).isEqualTo(2); - assertThat(historyService.createHistoricVariableInstanceQuery().processInstanceId(instanceId2).list().size()).isEqualTo(2); + assertThat(historyService.createHistoricVariableInstanceQuery().processInstanceId(instanceId1).list()).hasSize(2); + assertThat(historyService.createHistoricVariableInstanceQuery().processInstanceId(instanceId2).list()).hasSize(2); assertThat(historyService.createHistoricVariableInstanceQuery().variableName("inputMappingExecuted").count()).isEqualTo(2); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceTest.java index 2797e6031d1..d86f4e62266 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/RuntimeServiceTest.java @@ -246,7 +246,7 @@ public void testDeleteProcessInstances() { // if we skip the custom listeners, runtimeService.deleteProcessInstances(Arrays.asList(processInstance.getId(),processInstance2.getId()), null, false, false); - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0l); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); } @Deployment diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/SetVariablesBatchTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/SetVariablesBatchTest.java index 78f3abc5a9b..9d9668ac7b6 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/SetVariablesBatchTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/SetVariablesBatchTest.java @@ -16,24 +16,13 @@ */ package org.operaton.bpm.engine.test.api.runtime; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.tuple; - -import java.util.Arrays; -import java.util.Collections; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import org.assertj.core.api.Assertions; -import org.operaton.bpm.engine.BadUserRequestException; -import org.operaton.bpm.engine.HistoryService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.ProcessEngineException; -import org.operaton.bpm.engine.RuntimeService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.batch.Batch; import org.operaton.bpm.engine.batch.history.HistoricBatch; import org.operaton.bpm.engine.exception.NullValueException; @@ -54,11 +43,10 @@ import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.*; + +import static org.assertj.core.api.Assertions.*; public class SetVariablesBatchTest { @@ -665,7 +653,7 @@ public void shouldNotLogInstanceOperation() { .operationType(UserOperationLogEntry.OPERATION_TYPE_SET_VARIABLE) .list(); - assertThat(logs.size()).isEqualTo(0); + assertThat(logs).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/TransientVariableTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/TransientVariableTest.java index 2685f16382a..4cd46907a90 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/TransientVariableTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/TransientVariableTest.java @@ -656,7 +656,7 @@ public void testTransientLocalVariable() { .createVariableInstanceQuery() .count(); - assertThat(numVariables).isEqualTo(0); + assertThat(numVariables).isZero(); } @Test @@ -698,7 +698,7 @@ public void shouldRemoveTransientAndSetTransient() { // then assertThat(runtimeService.createVariableInstanceQuery().variableName(VARIABLE_NAME).count()) - .isEqualTo(0L); + .isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/message/MessageCorrelationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/message/MessageCorrelationTest.java index ac359bbc41c..17a4a1a775b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/message/MessageCorrelationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/message/MessageCorrelationTest.java @@ -1731,7 +1731,7 @@ public void testCorrelationWithTransientLocalVariables() { .createHistoricVariableInstanceQuery() .count(); - assertThat(numHistoricVariables).isEqualTo(0); + assertThat(numHistoricVariables).isZero(); } @Deployment(resources = { "org/operaton/bpm/engine/test/api/runtime/message/MessageCorrelationTest.waitForMessageProcess.bpmn20.xml", @@ -2095,7 +2095,7 @@ public void testStartMessageOnlyFlagWithVariablesInResult() { ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery().processDefinitionKey("messageStartEvent") .variableValueEquals("aKey", "aValue"); assertThat(processInstanceQuery.count()).isEqualTo(1); - assertThat(result.getVariables().size()).isEqualTo(1); + assertThat(result.getVariables()).hasSize(1); assertThat(result.getVariables().getValueTyped("aKey").getValue()).isEqualTo("aValue"); } @@ -2126,7 +2126,7 @@ public void testStartMessageOnlyFlagAllWithVariablesInResult() { .variableValueEquals("aKey", "aValue"); assertThat(processInstanceQuery.count()).isEqualTo(1); MessageCorrelationResultWithVariables result = results.get(0); - assertThat(result.getVariables().size()).isEqualTo(1); + assertThat(result.getVariables()).hasSize(1); assertThat(result.getVariables().getValueTyped("aKey").getValue()).isEqualTo("aValue"); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/migration/MigrationUserTaskTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/migration/MigrationUserTaskTest.java index 994fe10b461..8d44a44d371 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/migration/MigrationUserTaskTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/runtime/migration/MigrationUserTaskTest.java @@ -16,16 +16,11 @@ */ package org.operaton.bpm.engine.test.api.runtime.migration; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.test.api.runtime.migration.ModifiableBpmnModelInstance.modify; -import static org.operaton.bpm.engine.test.util.ActivityInstanceAssert.describeActivityInstanceTree; -import static org.operaton.bpm.engine.test.util.ExecutionAssert.describeExecutionTree; -import static org.operaton.bpm.engine.test.util.MigratingProcessInstanceValidationReportAssert.assertThat; - -import java.util.Date; -import java.util.List; -import java.util.concurrent.TimeUnit; - +import org.joda.time.DateTime; +import org.junit.Assert; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.delegate.TaskListener; import org.operaton.bpm.engine.impl.history.HistoryLevel; import org.operaton.bpm.engine.impl.jobexecutor.TimerTaskListenerJobHandler; @@ -48,11 +43,16 @@ import org.operaton.bpm.model.bpmn.BpmnModelInstance; import org.operaton.bpm.model.bpmn.instance.UserTask; import org.operaton.bpm.model.bpmn.instance.operaton.OperatonTaskListener; -import org.joda.time.DateTime; -import org.junit.Assert; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.Date; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.bpm.engine.test.api.runtime.migration.ModifiableBpmnModelInstance.modify; +import static org.operaton.bpm.engine.test.util.ActivityInstanceAssert.describeActivityInstanceTree; +import static org.operaton.bpm.engine.test.util.ExecutionAssert.describeExecutionTree; +import static org.operaton.bpm.engine.test.util.MigratingProcessInstanceValidationReportAssert.assertThat; /** * @author Thorben Lindhauer @@ -441,8 +441,8 @@ public void testAccessModelInNewTimeoutTaskListenerAfterMigrationToDifferentUser // then testHelper.assertTaskListenerTimerJobCreated("userTask2"); - assertThat(testHelper.snapshotBeforeMigration.getJobs().size()).isEqualTo(0); - assertThat(testHelper.snapshotAfterMigration.getJobs().size()).isEqualTo(1); + assertThat(testHelper.snapshotBeforeMigration.getJobs()).isEmpty(); + assertThat(testHelper.snapshotAfterMigration.getJobs()).hasSize(1); // and the task listener was able to access the bpmn model instance and set a variable testTimeoutListenerCanBeTriggered(processInstance, "userTask2"); @@ -467,8 +467,8 @@ public void testTimeoutTaskListenerRemovedAfterMigrationToDifferentUserTask() { // then testHelper.assertTaskListenerTimerJobRemoved("userTask2"); - assertThat(testHelper.snapshotBeforeMigration.getJobs().size()).isEqualTo(1); - assertThat(testHelper.snapshotAfterMigration.getJobs().size()).isEqualTo(0); + assertThat(testHelper.snapshotBeforeMigration.getJobs()).hasSize(1); + assertThat(testHelper.snapshotAfterMigration.getJobs()).isEmpty(); } @Test @@ -490,8 +490,8 @@ public void testTimeoutTaskListenerMigratedAfterMigrationToDifferentUserTask() { // then testHelper.assertTaskListenerTimerJobMigrated("userTask2", "userTask"); - assertThat(testHelper.snapshotBeforeMigration.getJobs().size()).isEqualTo(1); - assertThat(testHelper.snapshotAfterMigration.getJobs().size()).isEqualTo(1); + assertThat(testHelper.snapshotBeforeMigration.getJobs()).hasSize(1); + assertThat(testHelper.snapshotAfterMigration.getJobs()).hasSize(1); // and the task listener was able to access the bpmn model instance and set a variable testTimeoutListenerCanBeTriggered(processInstance, "userTask"); @@ -519,8 +519,8 @@ public void testTimeoutTaskListenerMigratedAndUpdatedAfterMigrationToDifferentUs // then Date newDueDate = new DateTime(ClockUtil.getCurrentTime()).plusHours(3).toDate(); testHelper.assertTaskListenerTimerJobMigrated("userTask2", "userTask", newDueDate); - assertThat(testHelper.snapshotBeforeMigration.getJobs().size()).isEqualTo(1); - assertThat(testHelper.snapshotAfterMigration.getJobs().size()).isEqualTo(1); + assertThat(testHelper.snapshotBeforeMigration.getJobs()).hasSize(1); + assertThat(testHelper.snapshotAfterMigration.getJobs()).hasSize(1); // and the task listener was able to access the bpmn model instance and set a variable testTimeoutListenerCanBeTriggered(processInstance, "userTask"); @@ -570,8 +570,8 @@ public void testOneTimeoutTaskListenerRemovedAfterMigration() { testHelper.createProcessInstanceAndMigrate(migrationPlan); // then - assertThat(testHelper.snapshotBeforeMigration.getJobs().size()).isEqualTo(2); - assertThat(testHelper.snapshotAfterMigration.getJobs().size()).isEqualTo(1); + assertThat(testHelper.snapshotBeforeMigration.getJobs()).hasSize(2); + assertThat(testHelper.snapshotAfterMigration.getJobs()).hasSize(1); JobEntity job = (JobEntity) testHelper.snapshotAfterMigration.getJobs().get(0); String jobHandlerConfiguration = job.getJobHandlerConfigurationRaw(); assertThat(jobHandlerConfiguration).contains("timeout-friendly"); @@ -595,12 +595,12 @@ public void testOneTimeoutTaskListenerAddedAfterMigration() { testHelper.createProcessInstanceAndMigrate(migrationPlan); // then - assertThat(testHelper.snapshotBeforeMigration.getJobs().size()).isEqualTo(1); + assertThat(testHelper.snapshotBeforeMigration.getJobs()).hasSize(1); JobEntity job = (JobEntity) testHelper.snapshotBeforeMigration.getJobs().get(0); String jobHandlerConfiguration = job.getJobHandlerConfigurationRaw(); assertThat(jobHandlerConfiguration).contains("timeout-friendly"); - assertThat(testHelper.snapshotAfterMigration.getJobs().size()).isEqualTo(2); + assertThat(testHelper.snapshotAfterMigration.getJobs()).hasSize(2); job = (JobEntity) testHelper.snapshotAfterMigration.getJobs().get(1); jobHandlerConfiguration = job.getJobHandlerConfigurationRaw(); assertThat(jobHandlerConfiguration).contains("timeout-hard"); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryExpressionTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryExpressionTest.java index e0ae4ac9e3a..906584bcda2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryExpressionTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryExpressionTest.java @@ -580,7 +580,7 @@ public void testQueryOverrideExpression() { // execute query so expression will be evaluated taskQuery.count(); - assertThat(taskQuery.getCandidateGroups().size()).isEqualTo(1); + assertThat(taskQuery.getCandidateGroups()).hasSize(1); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryTest.java index 1214a2f5498..baa5b42f666 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/task/TaskQueryTest.java @@ -16,46 +16,9 @@ */ package org.operaton.bpm.engine.test.api.task; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.inverted; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByAssignee; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByCaseExecutionId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByCaseInstanceId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByCreateTime; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByDescription; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByDueDate; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByExecutionId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByFollowUpDate; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskById; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByName; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByPriority; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.taskByProcessInstanceId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.verifySortingAndCount; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertThrows; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.operaton.bpm.engine.BadUserRequestException; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.ProcessEngineException; @@ -82,9 +45,16 @@ import org.operaton.bpm.engine.variable.value.FileValue; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.*; +import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.*; /** * @author Joram Barrez @@ -278,14 +248,14 @@ public void testTaskQueryLookupByNameCaseInsensitive() { List tasks = query.list(); assertNotNull(tasks); - assertThat(tasks.size()).isEqualTo(6); + assertThat(tasks).hasSize(6); query = taskService.createTaskQuery(); query.taskName("TeStTaSk"); tasks = query.list(); assertNotNull(tasks); - assertThat(tasks.size()).isEqualTo(6); + assertThat(tasks).hasSize(6); } /** @@ -301,14 +271,14 @@ public void testTaskQueryLookupByNameLikeCaseInsensitive() { List tasks = query.list(); assertNotNull(tasks); - assertThat(tasks.size()).isEqualTo(10); + assertThat(tasks).hasSize(10); query = taskService.createTaskQuery(); query.taskNameLike("%Task%"); tasks = query.list(); assertNotNull(tasks); - assertThat(tasks.size()).isEqualTo(10); + assertThat(tasks).hasSize(10); } @Test @@ -5492,7 +5462,7 @@ public void testQueryByProcessInstanceIdIn() { List tasks = taskService.createTaskQuery().processInstanceIdIn(instance1, instance2, "nonexisting").list(); // then - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); for (Task task : tasks) { assertThat(task.getProcessInstanceId()).isIn(instance1, instance2); } @@ -5508,7 +5478,7 @@ public void testQueryByProcessInstanceIdInNonExisting() { List tasks = taskService.createTaskQuery().processInstanceIdIn("nonexisting").list(); // then - assertThat(tasks.size()).isZero(); + assertThat(tasks).isEmpty(); } @Deployment(resources = "org/operaton/bpm/engine/test/api/task/TaskQueryTest.shouldContainOperatonFormRefIfInitialized.bpmn") diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/AbstractVariableIgnoreCaseTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/AbstractVariableIgnoreCaseTest.java index 16cad6103e1..0c00e99fc82 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/AbstractVariableIgnoreCaseTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/AbstractVariableIgnoreCaseTest.java @@ -64,7 +64,7 @@ protected T queryNameValueIgnoreCase() { } protected void assertThatListContainsOnlyExpectedElement(List instances, U instance) { - assertThat(instances.size()).isEqualTo(1); + assertThat(instances).hasSize(1); assertThatTwoInstancesAreEqual(instances.get(0), instance); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/CaseExecutionQueryVariableIgnoreCaseTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/CaseExecutionQueryVariableIgnoreCaseTest.java index 4e293281de0..581810bf15d 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/CaseExecutionQueryVariableIgnoreCaseTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/api/variables/CaseExecutionQueryVariableIgnoreCaseTest.java @@ -62,7 +62,7 @@ protected void assertThatTwoInstancesAreEqual(CaseExecution one, CaseExecution t public void assertThatListContainsOnlyExpectedElements(List instances, CaseExecution instance) { // normally we would only get one result. here we also get the corresponding CaseInstance - assertThat(instances.size()).isEqualTo(2); + assertThat(instances).hasSize(2); assertThat(instances.get(0).getCaseInstanceId()).isEqualTo(instance.getCaseInstanceId()); assertThat(instances.get(1).getCaseInstanceId()).isEqualTo(instance.getCaseInstanceId()); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/OperatonFormDefinitionStrictParseTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/OperatonFormDefinitionStrictParseTest.java index dbb6d0e9faf..4a463402a58 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/OperatonFormDefinitionStrictParseTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/OperatonFormDefinitionStrictParseTest.java @@ -82,7 +82,7 @@ public void shouldParseAnyFormFile_strictParsingDisabled() { // no form definition was created List formDefinitions = engineRule.getProcessEngineConfiguration().getCommandExecutorTxRequired() .execute(new FindOperatonFormDefinitionsCmd()); - assertThat(formDefinitions).hasSize(0); + assertThat(formDefinitions).isEmpty(); } @@ -96,6 +96,6 @@ public void shouldNotParseAnyFormFile_strictParsingEnabled() { testRule.deploy(FORM); }).isInstanceOf(ProcessEngineException.class) .hasMessageContaining("ENGINE-09033 Could not parse Operaton Form resource org/operaton/bpm/engine/test/bpmn/OperatonFormDefinitionStrictParseTest.anyForm.form."); - assertThat(repositoryService.createDeploymentQuery().list()).hasSize(0); + assertThat(repositoryService.createDeploymentQuery().list()).isEmpty(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/callactivity/CallActivityTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/callactivity/CallActivityTest.java index 7a6dc379888..2bda16a2bd4 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/callactivity/CallActivityTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/callactivity/CallActivityTest.java @@ -1860,7 +1860,7 @@ public void testTransientVariableInputMapping() { // and long numVariables = runtimeService.createVariableInstanceQuery().count(); - assertThat(numVariables).isEqualTo(0); + assertThat(numVariables).isZero(); } @@ -1893,7 +1893,7 @@ public void testTransientVariableOutputMapping() { // presence of transient variable was asserted in delegate long numVariables = runtimeService.createVariableInstanceQuery().count(); - assertThat(numVariables).isEqualTo(0); + assertThat(numVariables).isZero(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.java index d1c15bcf0d5..0a55da32e9c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.java @@ -16,12 +16,10 @@ */ package org.operaton.bpm.engine.test.bpmn.deployment; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - -import java.io.InputStream; -import java.util.List; - +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.operaton.bpm.engine.ProcessEngineException; import org.operaton.bpm.engine.impl.RepositoryServiceImpl; import org.operaton.bpm.engine.impl.context.Context; @@ -32,21 +30,19 @@ import org.operaton.bpm.engine.impl.pvm.ReadOnlyProcessDefinition; import org.operaton.bpm.engine.impl.util.IoUtil; import org.operaton.bpm.engine.impl.util.ReflectUtil; -import org.operaton.bpm.engine.repository.DeploymentBuilder; -import org.operaton.bpm.engine.repository.DeploymentHandlerFactory; -import org.operaton.bpm.engine.repository.DeploymentWithDefinitions; -import org.operaton.bpm.engine.repository.ProcessDefinition; -import org.operaton.bpm.engine.repository.Resource; +import org.operaton.bpm.engine.repository.*; import org.operaton.bpm.engine.test.Deployment; import org.operaton.bpm.engine.test.util.PluggableProcessEngineTest; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; import org.operaton.commons.testing.ProcessEngineLoggingRule; import org.operaton.commons.testing.WatchLogger; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; + +import java.io.InputStream; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; /** @@ -81,7 +77,7 @@ public void testGetBpmnXmlFileThroughService() { List deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId); // verify bpmn file name - assertThat(deploymentResources.size()).isEqualTo(1); + assertThat(deploymentResources).hasSize(1); String bpmnResourceName = "org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml"; assertThat(deploymentResources.get(0)).isEqualTo(bpmnResourceName); @@ -96,8 +92,8 @@ public void testGetBpmnXmlFileThroughService() { // verify content InputStream deploymentInputStream = repositoryService.getResourceAsStream(deploymentId, bpmnResourceName); String contentFromDeployment = readInputStreamToString(deploymentInputStream); - assertThat(contentFromDeployment.length() > 0).isTrue(); - assertThat(contentFromDeployment.contains("process id=\"emptyProcess\"")).isTrue(); + assertThat(contentFromDeployment).isNotEmpty(); + assertThat(contentFromDeployment).contains("process id=\"emptyProcess\""); InputStream fileInputStream = ReflectUtil.getResourceAsStream("org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml"); String contentFromFile = readInputStreamToString(fileInputStream); @@ -117,7 +113,7 @@ public void FAILING_testViolateProcessDefinitionIdMaximumLength() { assertThatThrownBy(() -> testRule.deploy(deployment)) .hasMessageContaining("id can be maximum 64 characters"); // then - assertThat(repositoryService.createDeploymentQuery().count()).isEqualTo(0); + assertThat(repositoryService.createDeploymentQuery().count()).isZero(); } @Test @@ -132,7 +128,7 @@ public void testDeploySameFileTwice() { List deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId); // verify bpmn file name - assertThat(deploymentResources.size()).isEqualTo(1); + assertThat(deploymentResources).hasSize(1); assertThat(deploymentResources.get(0)).isEqualTo(bpmnResourceName); testRule.deploy(repositoryService.createDeployment() @@ -155,7 +151,7 @@ public void shouldNotFilterDuplicateWithSameFileDeployedTwiceWithoutDeploymentNa .addClasspathResource(bpmnResourceName)); // then List deploymentList = repositoryService.createDeploymentQuery().list(); - assertThat(deploymentList.size()).isEqualTo(2); + assertThat(deploymentList).hasSize(2); } @Test @@ -172,7 +168,7 @@ public void shouldLogWarningForDuplicateFilteringWithoutName() { testRule.deploy(deploymentBuilder); // then - assertThat(loggingRule.getFilteredLog(CMD_LOGGER, "Deployment name set to null. Filtering duplicates will not work properly.").size()).isEqualTo(1); + assertThat(loggingRule.getFilteredLog(CMD_LOGGER, "Deployment name set to null. Filtering duplicates will not work properly.")).hasSize(1); } @Test @@ -192,7 +188,7 @@ public void shouldLogWarningForDuplicateFilteringWithoutPreviousDeploymentName() testRule.deploy(deploymentBuilder); // then - assertThat(loggingRule.getFilteredLog(CMD_LOGGER, "Deployment name set to null. Filtering duplicates will not work properly.").size()).isEqualTo(1); + assertThat(loggingRule.getFilteredLog(CMD_LOGGER, "Deployment name set to null. Filtering duplicates will not work properly.")).hasSize(1); } @Test @@ -261,7 +257,7 @@ public void testPartialChangesDeployAll() { .name("twice")); List deploymentResources = repositoryService.getDeploymentResourceNames(deployment1.getId()); - assertThat(deploymentResources.size()).isEqualTo(2); + assertThat(deploymentResources).hasSize(2); BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().endEvent().done(); @@ -271,7 +267,7 @@ public void testPartialChangesDeployAll() { .addModelInstance("process2.bpmn20.xml", changedModel2) .name("twice")); List deploymentList = repositoryService.createDeploymentQuery().list(); - assertThat(deploymentList.size()).isEqualTo(2); + assertThat(deploymentList).hasSize(2); // there should be new versions of both processes assertThat(repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").count()).isEqualTo(2); @@ -288,7 +284,7 @@ public void testPartialChangesDeployChangedOnly() { .name("thrice")); List deploymentResources = repositoryService.getDeploymentResourceNames(deployment1.getId()); - assertThat(deploymentResources.size()).isEqualTo(2); + assertThat(deploymentResources).hasSize(2); BpmnModelInstance changedModel2 = Bpmn.createExecutableProcess("process2").startEvent().endEvent().done(); @@ -299,7 +295,7 @@ public void testPartialChangesDeployChangedOnly() { .name("thrice")); List deploymentList = repositoryService.createDeploymentQuery().list(); - assertThat(deploymentList.size()).isEqualTo(2); + assertThat(deploymentList).hasSize(2); // there should be only one version of process 1 ProcessDefinition process1Definition = repositoryService.createProcessDefinitionQuery().processDefinitionKey("process1").singleResult(); @@ -364,7 +360,7 @@ public void testDeployTwoProcessesWithDuplicateIdAtTheSameTime() { .addClasspathResource(bpmnResourceName2) .name("duplicateAtTheSameTime"))); // then - assertThat(repositoryService.createDeploymentQuery().count()).isEqualTo(0); + assertThat(repositoryService.createDeploymentQuery().count()).isZero(); } @Test @@ -379,7 +375,7 @@ public void testDeployDifferentFiles() { List deploymentResources = repositoryService.getDeploymentResourceNames(deploymentId); // verify bpmn file name - assertThat(deploymentResources.size()).isEqualTo(1); + assertThat(deploymentResources).hasSize(1); assertThat(deploymentResources.get(0)).isEqualTo(bpmnResourceName); bpmnResourceName = "org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.bpmn20.xml"; @@ -388,7 +384,7 @@ public void testDeployDifferentFiles() { .addClasspathResource(bpmnResourceName) .name("twice")); List deploymentList = repositoryService.createDeploymentQuery().list(); - assertThat(deploymentList.size()).isEqualTo(2); + assertThat(deploymentList).hasSize(2); } @Test @@ -408,11 +404,11 @@ public ProcessDefinitionEntity execute(CommandContext commandContext) { }); assertThat(processDefinitionEntity).isNotNull(); - assertThat(processDefinitionEntity.getActivities().size()).isEqualTo(7); + assertThat(processDefinitionEntity.getActivities()).hasSize(7); // Check that no diagram has been created List resourceNames = repositoryService.getDeploymentResourceNames(processDefinitionEntity.getDeploymentId()); - assertThat(resourceNames.size()).isEqualTo(1); + assertThat(resourceNames).hasSize(1); } @Deployment(resources={ @@ -433,7 +429,7 @@ public void testProcessDiagramResource() { .getResourceAsStream(processDefinition.getDeploymentId(), "org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testProcessDiagramResource.jpg"); byte[] diagramBytes = IoUtil.readInputStream(diagramStream, "diagram stream"); - assertThat(diagramBytes.length).isEqualTo(33343); + assertThat(diagramBytes).hasSize(33343); } @Deployment(resources={ @@ -474,7 +470,7 @@ public void testDeployInvalidExpression() { .hasMessageContaining("ENGINE-01009 Error while parsing process") .withFailMessage("Expected exception when deploying process with invalid expression."); // then - assertThat(repositoryService.createDeploymentQuery().count()).isEqualTo(0); + assertThat(repositoryService.createDeploymentQuery().count()).isZero(); } @Deployment(resources = {"org/operaton/bpm/engine/test/bpmn/deployment/BpmnDeploymentTest.testGetBpmnXmlFileThroughService.bpmn20.xml"}) @@ -483,7 +479,7 @@ public void testDeploymentIdOfResource() { String deploymentId = repositoryService.createDeploymentQuery().singleResult().getId(); List resources = repositoryService.getDeploymentResources(deploymentId); - assertThat(resources.size()).isEqualTo(1); + assertThat(resources).hasSize(1); Resource resource = resources.get(0); assertThat(resource.getDeploymentId()).isEqualTo(deploymentId); @@ -516,7 +512,7 @@ public void testDeployAndGetProcessDefinition() throws Exception { // then deployment contains deployed process definitions List deployedProcessDefinitions = deployment.getDeployedProcessDefinitions(); - assertThat(deployedProcessDefinitions.size()).isEqualTo(1); + assertThat(deployedProcessDefinitions).hasSize(1); assertThat(deployment.getDeployedCaseDefinitions()).isNull();; assertThat(deployment.getDeployedDecisionDefinitions()).isNull();; assertThat(deployment.getDeployedDecisionRequirementsDefinitions()).isNull();; diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/compensate/CompensationEventParseInvalidProcessTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/compensate/CompensationEventParseInvalidProcessTest.java index 3f695fe6067..e412fc76d2f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/compensate/CompensationEventParseInvalidProcessTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/compensate/CompensationEventParseInvalidProcessTest.java @@ -93,7 +93,7 @@ public void testParseInvalidProcessDefinition() { } catch (ParseException e) { assertExceptionMessageContainsText(e, expectedErrorMessage); List errors = e.getResorceReports().get(0).getErrors(); - assertThat(errors.size()).isEqualTo(1); + assertThat(errors).hasSize(1); assertThat(errors.get(0).getMainElementId()).isEqualTo(bpmnElementIds[0]); if (bpmnElementIds.length == 2) { assertThat(errors.get(0).getElementIds()).containsExactlyInAnyOrder(bpmnElementIds); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/BoundaryTimerNonInterruptingEventTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/BoundaryTimerNonInterruptingEventTest.java index 07bb002f98b..e461017e3d1 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/BoundaryTimerNonInterruptingEventTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/BoundaryTimerNonInterruptingEventTest.java @@ -800,7 +800,7 @@ public void shouldReevaluateLongerTimerCycleWhenDue() throws Exception { assertThat(jobQuery.count()).isEqualTo(1); moveByHours(2); // execute second job of the new cycle => no more jobs - assertThat(jobQuery.count()).isEqualTo(0); + assertThat(jobQuery.count()).isZero(); } @Test @@ -837,7 +837,7 @@ public void shouldReevaluateShorterTimerCycleWhenDue() throws Exception { assertThat(jobQuery.count()).isEqualTo(1); moveByHours(1); // execute second job of the new cycle => no more jobs - assertThat(jobQuery.count()).isEqualTo(0); + assertThat(jobQuery.count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/UpdateDuedateOnRecurringTimerTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/UpdateDuedateOnRecurringTimerTest.java index 72f6a6031ca..b0c3391bb9b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/UpdateDuedateOnRecurringTimerTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/event/timer/UpdateDuedateOnRecurringTimerTest.java @@ -135,9 +135,9 @@ public void testCascadeChangeToRecurringTimerAddToDuedateMultipleTimes() { // then assertThat(ClockUtil.getCurrentTime()).isAfter(job3.getDuedate()); - assertThat(managementService.createJobQuery().count()).isEqualTo(0); + assertThat(managementService.createJobQuery().count()).isZero(); // no duplicates - assertThat(new HashSet(Arrays.asList(job1.getId(), job2.getId(), job3.getId())).size()).isEqualTo(3); + assertThat(new HashSet(Arrays.asList(job1.getId(), job2.getId(), job3.getId()))).hasSize(3); // job1 is due after 45 minutes (30 + 15 offset) assertThat(job1.getDuedate().getTime()).isEqualTo(t0.getTime() + minutes(45)); // job2 is due 25 minutes after job1 (keeps offset due to cascade=true and @@ -212,7 +212,7 @@ public void testCascadeMixedChangesToRecurringTimerDuedate() { // then // no duplicate jobs - assertThat(new HashSet(Arrays.asList(job1.getId(), job2.getId(), job3.getId())).size()).isEqualTo(3); + assertThat(new HashSet(Arrays.asList(job1.getId(), job2.getId(), job3.getId()))).hasSize(3); // job1 is due at t=15 assertThat(job1.getDuedate().getTime()).isEqualTo(t0.getTime() + minutes(15)); // job2 is due 40 minutes after job1 (keeps offset due to cascade=true at @@ -256,7 +256,7 @@ public void testChangesToRecurringTimerDuedateShouldNotCascade() { // then // no duplicate jobs - assertThat(new HashSet(Arrays.asList(job1.getId(), job2.getId(), job3.getId())).size()).isEqualTo(3); + assertThat(new HashSet(Arrays.asList(job1.getId(), job2.getId(), job3.getId()))).hasSize(3); // job1 is due at t=15 assertThat(job1.getDuedate().getTime()).isEqualTo(t0.getTime() + minutes(15)); // job2 is due 15 minutes after job1 (ignores offset due to cascade=false at diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/external/ExternalTaskParseTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/external/ExternalTaskParseTest.java index 893e727a4ee..a8ad558034b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/external/ExternalTaskParseTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/external/ExternalTaskParseTest.java @@ -46,7 +46,7 @@ public void testParseExternalTaskWithoutTopic() { fail("exception expected"); } catch (ParseException e) { testRule.assertTextPresent("External tasks must specify a 'topic' attribute in the operaton namespace", e.getMessage()); - assertThat(e.getResorceReports().get(0).getErrors().size()).isEqualTo(1); + assertThat(e.getResorceReports().get(0).getErrors()).hasSize(1); assertThat(e.getResorceReports().get(0).getErrors().get(0).getMainElementId()).isEqualTo("externalTask"); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/EventBasedGatewayInputOutputTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/EventBasedGatewayInputOutputTest.java index 1fc2980c5ae..db6f021dd93 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/EventBasedGatewayInputOutputTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/EventBasedGatewayInputOutputTest.java @@ -101,9 +101,9 @@ public void shouldNotProcessInputOutputParametersAfterEventGatewayDeletion() { assertThat(VariableLogDelegate.LOCAL_VARIABLES).isEmpty(); assertThat(historyService.createHistoricVariableInstanceQuery() .variableName("eventOutput") - .count()).isEqualTo(0L); + .count()).isZero(); assertThat(historyService.createHistoricVariableInstanceQuery() .variableName("variable1") - .count()).isEqualTo(0L); + .count()).isZero(); } } \ No newline at end of file diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.java index 63c3565e960..84199f91a94 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/gateway/InclusiveGatewayTest.java @@ -794,7 +794,7 @@ public void shouldCompleteWithConcurrentExecution_ParallelGateway() { testRule.executeAvailableJobs(1); // then - Assertions.assertThat(managementService.createJobQuery().count()).isEqualTo(0); + Assertions.assertThat(managementService.createJobQuery().count()).isZero(); Assertions.assertThat(historyService.createHistoricProcessInstanceQuery().singleResult().getState()) .isEqualTo("COMPLETED"); } @@ -809,7 +809,7 @@ public void shouldCompleteWithConcurrentExecution_InclusiveGateway() { testRule.executeAvailableJobs(1); // then - Assertions.assertThat(managementService.createJobQuery().count()).isEqualTo(0); + Assertions.assertThat(managementService.createJobQuery().count()).isZero(); Assertions.assertThat(historyService.createHistoricProcessInstanceQuery().singleResult().getState()) .isEqualTo("COMPLETED"); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/multiinstance/MultiInstanceVariablesTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/multiinstance/MultiInstanceVariablesTest.java index aa452bc42ce..512ca487e2e 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/multiinstance/MultiInstanceVariablesTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/multiinstance/MultiInstanceVariablesTest.java @@ -67,8 +67,8 @@ public void testMultiInstanceWithAllInOutMapping() { engineRule.getTaskService().complete(task.getId()); } - assertThat(engineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(SUB_PROCESS_ID).list()).hasSize(0); - assertThat(engineRule.getRuntimeService().createExecutionQuery().activityId(CALL_ACTIVITY).list()).hasSize(0); + assertThat(engineRule.getRuntimeService().createExecutionQuery().processDefinitionKey(SUB_PROCESS_ID).list()).isEmpty(); + assertThat(engineRule.getRuntimeService().createExecutionQuery().activityId(CALL_ACTIVITY).list()).isEmpty(); } protected void addAllOut(BpmnModelInstance modelInstance, CallActivityBuilder callActivityBuilder) { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerDelegateCompletionTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerDelegateCompletionTest.java index b92e1973725..7ae6c638617 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerDelegateCompletionTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerDelegateCompletionTest.java @@ -158,7 +158,7 @@ public void testCompletionIsPossibleOnTimeout() { testHelper.waitForJobExecutorToProcessAllJobs(5000L); // then - assertThat(taskQuery.count()).isEqualTo(0L); + assertThat(taskQuery.count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerEventLifecycleTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerEventLifecycleTest.java index 62261c52ca7..e83550009f6 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerEventLifecycleTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerEventLifecycleTest.java @@ -66,7 +66,7 @@ public void shouldOnlyFireCreateAndAssignmentEventsWhenTaskIsCreated() { // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_ASSIGNMENT); } @@ -85,7 +85,7 @@ public void shouldFireCompleteEventOnTaskCompletedInCreateListener() { // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_COMPLETE); } @@ -106,7 +106,7 @@ public void shouldFireCompleteEventOnTaskCompletedInAssignmentListenerWhenTaskCr // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(4); + assertThat(orderedEvents).hasSize(4); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_UPDATE, TaskListener.EVENTNAME_ASSIGNMENT, @@ -136,7 +136,7 @@ public void shouldFireCreateEventBeforeTimeoutEventWhenTaskCreated() { // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); // the TIMEOUT event will always fire after the CREATE event, since the Timer Job can't be // picked up by the JobExecutor before it's committed. And it is committed in the same @@ -174,7 +174,7 @@ public void shouldCancelTimeoutTaskListenerWhenTaskCompleted() { LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); assertThat(runningJobCount).isOne(); assertThat(completedJobCount).isZero(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_COMPLETE); } @@ -193,7 +193,7 @@ public void shouldFireUpdateEventOnPropertyChangeWhenTaskUpdated() { // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); // create event fired on task creation - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_UPDATE); } @@ -211,7 +211,7 @@ public void shouldFireUpdateEventBeforeAssignmentEventOnSetAssigneeWhenTaskUpdat // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(3); + assertThat(orderedEvents).hasSize(3); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_UPDATE, TaskListener.EVENTNAME_ASSIGNMENT); @@ -235,7 +235,7 @@ public void shouldFireCompleteEventOnTaskCompletedInUpdateListener() { List orderedEvents = RecorderTaskListener.getOrderedEvents(); // assignment event should not be processed - assertThat(orderedEvents.size()).isEqualTo(3); + assertThat(orderedEvents).hasSize(3); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_UPDATE, TaskListener.EVENTNAME_COMPLETE); @@ -258,7 +258,7 @@ public void shouldFireCompleteEventOnTaskCompletedInAssignmentListenerWhenTaskUp // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(4); + assertThat(orderedEvents).hasSize(4); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_UPDATE, TaskListener.EVENTNAME_ASSIGNMENT, @@ -280,7 +280,7 @@ public void shouldNotFireUpdateEventAfterCreateTaskListenerUpdatesProperties() { // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); // ASSIGNMENT Event is fired, since the ModifyingTaskListener sets an assignee, and the // ASSIGNMENT Event evaluation happens after the CREATE Event evaluation assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, @@ -305,7 +305,7 @@ public void shouldNotFireUpdateEventAfterUpdateTaskListenerUpdatesProperties() { // only the initial, first update event is expected List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(3); + assertThat(orderedEvents).hasSize(3); // ASSIGNMENT Event is fired, since the ModifyingTaskListener sets an assignee, and the // ASSIGNMENT Event evaluation happens after the UPDATE Event evaluation assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, @@ -331,7 +331,7 @@ public void shouldNotFireUpdateEventAfterAssignmentTaskListenerUpdatesProperties // only one update event is expected, from the initial assignment List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(3); + assertThat(orderedEvents).hasSize(3); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_UPDATE, TaskListener.EVENTNAME_ASSIGNMENT); @@ -354,7 +354,7 @@ public void shouldNotFireUpdateEventAfterCompleteTaskListenerUpdatesProperties() // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_COMPLETE); } @@ -376,7 +376,7 @@ public void shouldNotFireUpdateEventAfterDeleteTaskListenerUpdatesProperties() { // then List orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_DELETE); } @@ -396,7 +396,7 @@ public void shouldFireCompleteEventLastWhenTaskCompleted() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_COMPLETE); } @@ -417,7 +417,7 @@ public void shouldNotFireUpdateEventOnPropertyChangesInCompleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_COMPLETE); } @@ -438,7 +438,7 @@ public void shouldNotFireAssignmentEventOnAssigneeChangesInCompleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_COMPLETE); } @@ -463,7 +463,7 @@ public void shouldNotFireDeleteEventOnTaskDeletedInCompleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_COMPLETE); } } @@ -485,7 +485,7 @@ public void shouldFireDeleteEventOnProcessInstanceDeletedInCompleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(3); + assertThat(orderedEvents).hasSize(3); assertThat(orderedEvents).containsExactly(TaskListener.EVENTNAME_CREATE, TaskListener.EVENTNAME_COMPLETE, TaskListener.EVENTNAME_DELETE); @@ -512,7 +512,7 @@ public void shouldNotFireCompleteEventOnTaskCompletedInCompleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getFirst()).isEqualToIgnoringCase(TaskListener.EVENTNAME_CREATE); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_COMPLETE); } @@ -532,7 +532,7 @@ public void shouldFireDeleteEventLastWhenProcessDeleted() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getFirst()).isEqualToIgnoringCase(TaskListener.EVENTNAME_CREATE); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_DELETE); } @@ -553,7 +553,7 @@ public void shouldNotFireUpdateEventOnPropertyChangesInDeleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getFirst()).isEqualToIgnoringCase(TaskListener.EVENTNAME_CREATE); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_DELETE); } @@ -574,7 +574,7 @@ public void shouldNotFireAssignmentEventOnAssigneeChangesInDeleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getFirst()).isEqualToIgnoringCase(TaskListener.EVENTNAME_CREATE); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_DELETE); } @@ -599,7 +599,7 @@ public void shouldNotFireCompleteEventOnCompleteAttemptInDeleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getFirst()).isEqualToIgnoringCase(TaskListener.EVENTNAME_CREATE); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_DELETE); } @@ -625,7 +625,7 @@ public void shouldNotFireDeleteEventOnTaskDeleteAttemptInDeleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getFirst()).isEqualToIgnoringCase(TaskListener.EVENTNAME_CREATE); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_DELETE); } @@ -647,7 +647,7 @@ public void shouldNotFireDeleteEventOnProcessDeleteAttemptInDeleteListener() { // then LinkedList orderedEvents = RecorderTaskListener.getOrderedEvents(); - assertThat(orderedEvents.size()).isEqualTo(2); + assertThat(orderedEvents).hasSize(2); assertThat(orderedEvents.getFirst()).isEqualToIgnoringCase(TaskListener.EVENTNAME_CREATE); assertThat(orderedEvents.getLast()).isEqualToIgnoringCase(TaskListener.EVENTNAME_DELETE); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerTest.java index 82e5b9e64d9..615cd1990e9 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/bpmn/tasklistener/TaskListenerTest.java @@ -846,8 +846,8 @@ public void testTimeoutTaskListenerNotCalledWhenTaskCompleted() { // then HistoricVariableInstanceQuery variableQuery = historyService.createHistoricVariableInstanceQuery().variableName("timeout-status"); - assertThat(variableQuery.count()).isEqualTo(0L); - assertThat(jobQuery.count()).isEqualTo(0L); + assertThat(variableQuery.count()).isZero(); + assertThat(jobQuery.count()).isZero(); } @Test @@ -866,8 +866,8 @@ public void testTimeoutTaskListenerNotCalledWhenTaskCompletedByBoundaryEvent() { // then HistoricVariableInstanceQuery variableQuery = historyService.createHistoricVariableInstanceQuery().variableName("timeout-status"); - assertThat(variableQuery.count()).isEqualTo(0L); - assertThat(jobQuery.count()).isEqualTo(0L); + assertThat(variableQuery.count()).isZero(); + assertThat(jobQuery.count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentDeploymentTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentDeploymentTest.java index 2d21bd7b370..d56a16c36ec 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentDeploymentTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentDeploymentTest.java @@ -89,7 +89,7 @@ public void testVersioning() throws InterruptedException { .asc() .list(); - assertThat(processDefinitions.size()).isEqualTo(2); + assertThat(processDefinitions).hasSize(2); assertThat(processDefinitions.get(0).getVersion()).isEqualTo(1); assertThat(processDefinitions.get(1).getVersion()).isEqualTo(2); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentJobExecutorTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentJobExecutorTest.java index 3ba3e243ae9..0302a247171 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentJobExecutorTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/ConcurrentJobExecutorTest.java @@ -181,7 +181,7 @@ public void shouldCompleteTimeoutRetryWhenTimeoutedJobCompletesInbetween() { .hasMessageContaining("DELETE MessageEntity") .hasMessageContaining("Entity was updated by another transaction concurrently"); assertThat(threadTwo.exception).isNull(); - assertThat(managementService.createJobQuery().count()).isEqualTo(0L); + assertThat(managementService.createJobQuery().count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/DeleteProcessDefinitionTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/DeleteProcessDefinitionTest.java index 27aefa81a93..358ea1c0fae 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/DeleteProcessDefinitionTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/concurrency/DeleteProcessDefinitionTest.java @@ -40,7 +40,7 @@ public void testDeploymentOfProcessDefinitionWithOrphanMessageEvent() { // given String resource = "org/operaton/bpm/engine/test/api/repository/processWithNewInvoiceMessage.bpmn20.xml"; List processDefinitions = deployProcessDefinitionTwice(resource); - assertThat(processDefinitions.size()).isEqualTo(2); + assertThat(processDefinitions).hasSize(2); deleteProcessDefinitionsSimultaneously(processDefinitions.get(0).getId(), processDefinitions.get(1).getId()); assertThat(repositoryService.createProcessDefinitionQuery().list()).isEmpty(); @@ -59,7 +59,7 @@ public void testDeploymentOfProcessDefinitionWithOrphanJob() { // given String resource = "org/operaton/bpm/engine/test/bpmn/event/timer/StartTimerEventTest.testTimeCycle.bpmn20.xml"; List processDefinitions = deployProcessDefinitionTwice(resource); - assertThat(processDefinitions.size()).isEqualTo(2); + assertThat(processDefinitions).hasSize(2); deleteProcessDefinitionsSimultaneously(processDefinitions.get(0).getId(), processDefinitions.get(1).getId()); assertThat(repositoryService.createProcessDefinitionQuery().list()).isEmpty(); @@ -78,7 +78,7 @@ public void testDeploymentOfProcessDefinitionWithOrphanSignalEvent() { // given String resource = "org/operaton/bpm/engine/test/api/repository/processWithStartSignalEvent.bpmn20.xml"; List processDefinitions = deployProcessDefinitionTwice(resource); - assertThat(processDefinitions.size()).isEqualTo(2); + assertThat(processDefinitions).hasSize(2); deleteProcessDefinitionsSimultaneously(processDefinitions.get(0).getId(), processDefinitions.get(1).getId()); assertThat(repositoryService.createProcessDefinitionQuery().list()).isEmpty(); @@ -100,7 +100,7 @@ public void testDeploymentOfProcessDefinitionWithOrphanEventAndPreviousVersion() repositoryService.createDeployment().addClasspathResource(resource).deploy(); repositoryService.createDeployment().addClasspathResource(resource).deploy(); List processDefinitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey("otherMessageProcess").list(); - assertThat(processDefinitions.size()).isEqualTo(3); + assertThat(processDefinitions).hasSize(3); deleteProcessDefinitionsSimultaneously(processDefinitions.get(1).getId(), processDefinitions.get(2).getId()); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/dmn/businessruletask/DmnBusinessRuleTaskResultMappingTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/dmn/businessruletask/DmnBusinessRuleTaskResultMappingTest.java index 01e428fc0d4..d69d042c916 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/dmn/businessruletask/DmnBusinessRuleTaskResultMappingTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/dmn/businessruletask/DmnBusinessRuleTaskResultMappingTest.java @@ -190,7 +190,7 @@ public void testInvalidMapping() { fail("expect parse exception"); } catch (ParseException e) { testRule.assertTextPresent("No decision result mapper found for name 'invalid'", e.getMessage()); - assertThat(e.getResorceReports().get(0).getErrors().size()).isEqualTo(1); + assertThat(e.getResorceReports().get(0).getErrors()).hasSize(1); assertThat(e.getResorceReports().get(0).getErrors().get(0).getMainElementId()).isEqualTo("ruleTask"); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/dmn/deployment/DecisionDefinitionTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/dmn/deployment/DecisionDefinitionTest.java index 26d404d44a2..236da0d618b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/dmn/deployment/DecisionDefinitionTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/dmn/deployment/DecisionDefinitionTest.java @@ -102,7 +102,7 @@ public void shouldUseHistoryTTLOnDecisionDefinitions() { DeploymentWithDefinitions deployment = testRule.deploy(builder); // then - assertThat(deployment.getDeployedDecisionDefinitions().size()).isEqualTo(1); + assertThat(deployment.getDeployedDecisionDefinitions()).hasSize(1); assertThat(deployment.getDeployedDecisionDefinitions().get(0).getHistoryTimeToLive()).isEqualTo(30); } @@ -117,7 +117,7 @@ public void shouldNotOverrideWithGlobalConfigOnDecisionHistoryTTLPresence() { DeploymentWithDefinitions deployment = testRule.deploy(builder); // then - assertThat(deployment.getDeployedDecisionDefinitions().size()).isEqualTo(1); + assertThat(deployment.getDeployedDecisionDefinitions()).hasSize(1); assertThat(deployment.getDeployedDecisionDefinitions().get(0).getHistoryTimeToLive()).isEqualTo(10); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/form/deployment/OperatonFormDefinitionDeploymentTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/form/deployment/OperatonFormDefinitionDeploymentTest.java index 0f5fbc8f0a5..a06c67941ab 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/form/deployment/OperatonFormDefinitionDeploymentTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/form/deployment/OperatonFormDefinitionDeploymentTest.java @@ -184,8 +184,8 @@ public void shouldDeleteFormDefinitionWhenDeletingDeployment() { assertThat(deployments).hasSize(1); // after deletion of deployment - assertThat(findAllOperatonFormDefinitionEntities(processEngineConfiguration)).hasSize(0); - assertThat(repositoryService.createDeploymentQuery().list()).hasSize(0); + assertThat(findAllOperatonFormDefinitionEntities(processEngineConfiguration)).isEmpty(); + assertThat(repositoryService.createDeploymentQuery().list()).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/CompositeHistoryEventHandlerTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/CompositeHistoryEventHandlerTest.java index b075294146e..c9e778ce8b8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/CompositeHistoryEventHandlerTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/CompositeHistoryEventHandlerTest.java @@ -79,7 +79,7 @@ public void shouldUseCompositeHistoryEventHandlerNonArgumentConstructorAddNotNul startProcessAndCompleteUserTask(); assertThat(countCustomHistoryEventHandler).isEqualTo(2); - assertThat(historyService.createHistoricDetailQuery().count()).isEqualTo(0); + assertThat(historyService.createHistoricDetailQuery().count()).isZero(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricActivityInstanceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricActivityInstanceTest.java index 35651de82d8..637bccd446d 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricActivityInstanceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricActivityInstanceTest.java @@ -1081,7 +1081,7 @@ public void testEndParallelJoin() { .activityId("parallelJoinEnd") .list(); - assertThat(activityInstance.size()).isEqualTo(2); + assertThat(activityInstance).hasSize(2); assertThat(pi.isEnded()).isTrue(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricCaseActivityStatisticsQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricCaseActivityStatisticsQueryTest.java index 0e543f3c96c..75d9699a9a1 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricCaseActivityStatisticsQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricCaseActivityStatisticsQueryTest.java @@ -86,7 +86,7 @@ public void testNoCaseActivityInstances() { // then assertEquals(0, query.count()); - assertThat(query.list()).hasSize(0); + assertThat(query.list()).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricExternalTaskLogQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricExternalTaskLogQueryTest.java index 77429242bd3..77097012ec8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricExternalTaskLogQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricExternalTaskLogQueryTest.java @@ -16,17 +16,10 @@ */ package org.operaton.bpm.engine.test.history; -import static junit.framework.TestCase.assertNotNull; -import static junit.framework.TestCase.assertNull; -import static junit.framework.TestCase.assertTrue; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.operaton.bpm.engine.test.api.runtime.migration.models.builder.DefaultExternalTaskModelBuilder.DEFAULT_EXTERNAL_TASK_NAME; -import static org.operaton.bpm.engine.test.api.runtime.migration.models.builder.DefaultExternalTaskModelBuilder.DEFAULT_TOPIC; -import static org.operaton.bpm.engine.test.api.runtime.migration.models.builder.DefaultExternalTaskModelBuilder.createDefaultExternalTaskModel; - -import java.util.LinkedList; -import java.util.List; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.ExternalTaskService; import org.operaton.bpm.engine.HistoryService; import org.operaton.bpm.engine.ProcessEngineConfiguration; @@ -43,10 +36,14 @@ import org.operaton.bpm.engine.test.util.ProcessEngineTestRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.LinkedList; +import java.util.List; + +import static junit.framework.TestCase.*; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.operaton.bpm.engine.test.api.runtime.migration.models.builder.DefaultExternalTaskModelBuilder.*; @RequiredHistoryLevel(ProcessEngineConfiguration.HISTORY_FULL) public class HistoricExternalTaskLogQueryTest { @@ -802,7 +799,7 @@ public void testQueryByLowerThanOrEqualAPriority() { .list(); // then - assertThat(externalTaskLogs.size()).isEqualTo(3); + assertThat(externalTaskLogs).hasSize(3); for (HistoricExternalTaskLog log : externalTaskLogs) { assertTrue(log.getPriority() <= 2); } @@ -822,7 +819,7 @@ public void testQueryByHigherThanOrEqualAPriority() { .list(); // then - assertThat(externalTaskLogs.size()).isEqualTo(3); + assertThat(externalTaskLogs).hasSize(3); for (HistoricExternalTaskLog log : externalTaskLogs) { assertTrue(log.getPriority() >= 2); } @@ -843,7 +840,7 @@ public void testQueryByPriorityRange() { .list(); // then - assertThat(externalTaskLogs.size()).isEqualTo(3); + assertThat(externalTaskLogs).hasSize(3); for (HistoricExternalTaskLog log : externalTaskLogs) { assertTrue(log.getPriority() <= 3 && log.getPriority() >= 1); } @@ -864,7 +861,7 @@ public void testQueryByDisjunctivePriorityStatements() { .list(); // then - assertThat(externalTaskLogs.size()).isEqualTo(0); + assertThat(externalTaskLogs).isEmpty(); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogQueryTest.java index aa1d4cdf153..a105566c8ca 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogQueryTest.java @@ -16,33 +16,12 @@ */ package org.operaton.bpm.engine.test.history; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Assertions.fail; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByActivityId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByDeploymentId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByExecutionId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByJobDefinitionId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByJobDueDate; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByJobId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByJobPriority; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByJobRetries; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByProcessDefinitionId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByProcessDefinitionKey; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByProcessInstanceId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogByTimestamp; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicJobLogPartiallyByOccurence; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.inverted; - -import java.util.ArrayList; -import java.util.List; - -import org.operaton.bpm.engine.HistoryService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngine; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.ProcessEngineException; -import org.operaton.bpm.engine.RuntimeService; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.history.HistoricJobLog; import org.operaton.bpm.engine.history.HistoricJobLogQuery; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; @@ -54,15 +33,16 @@ import org.operaton.bpm.engine.test.RequiredHistoryLevel; import org.operaton.bpm.engine.test.api.runtime.FailingDelegate; import org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil; -import org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.NullTolerantComparator; +import org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.*; import org.operaton.bpm.engine.test.util.ProcessEngineTestRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; import org.operaton.bpm.engine.variable.Variables; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.ArrayList; +import java.util.List; + +import static org.assertj.core.api.Assertions.*; +import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.*; /** * @author Roman Smirnov @@ -620,7 +600,7 @@ public void testQueryByJobPriority() { .asc() .list(); - assertThat(jobLogs.size()).isEqualTo(3); + assertThat(jobLogs).hasSize(3); for (HistoricJobLog log : jobLogs) { assertThat(log.getJobPriority() <= 2).isTrue(); } @@ -632,7 +612,7 @@ public void testQueryByJobPriority() { .asc() .list(); - assertThat(jobLogs.size()).isEqualTo(2); + assertThat(jobLogs).hasSize(2); for (HistoricJobLog log : jobLogs) { assertThat(log.getJobPriority() >= 3).isTrue(); } @@ -645,7 +625,7 @@ public void testQueryByJobPriority() { .asc() .list(); - assertThat(jobLogs.size()).isEqualTo(3); + assertThat(jobLogs).hasSize(3); for (HistoricJobLog log : jobLogs) { assertThat(log.getJobPriority() >= 1 && log.getJobPriority() <= 3).isTrue(); } @@ -657,7 +637,7 @@ public void testQueryByJobPriority() { .orderByJobPriority() .asc() .list(); - assertThat(jobLogs.size()).isEqualTo(0); + assertThat(jobLogs).isEmpty(); } @Deployment(resources = {"org/operaton/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) @@ -965,7 +945,7 @@ protected void startProcessInstanceWithJobAndCompleteJob(boolean failJob) { } protected void verifyQueryResults(HistoricJobLogQuery query, int countExpected) { - assertThat(query.list().size()).isEqualTo(countExpected); + assertThat(query.list()).hasSize(countExpected); assertThat(query.count()).isEqualTo(countExpected); if (countExpected == 1) { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogTest.java index 28926233da8..cb544c5c435 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricJobLogTest.java @@ -656,7 +656,7 @@ public void testFailedJobEvents() { // there exists one historic job log entry assertThat(query.count()).isEqualTo(1); assertThat(createdQuery.count()).isEqualTo(1); - assertThat(failedQuery.count()).isEqualTo(0); + assertThat(failedQuery.count()).isZero(); // when (1) try { @@ -750,7 +750,7 @@ public void testFailedJobEvents() { assertThat(failedJobLogEntry.getJobRetries()).isEqualTo(1); failedJobLogEntry = failedQuery.list().get(3); - assertThat(failedJobLogEntry.getJobRetries()).isEqualTo(0); + assertThat(failedJobLogEntry.getJobRetries()).isZero(); } @Deployment(resources = {"org/operaton/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) @@ -768,7 +768,7 @@ public void testFailedJobEventsExecutedByJobExecutor() { // there exists one historic job log entry assertThat(query.count()).isEqualTo(1); assertThat(createdQuery.count()).isEqualTo(1); - assertThat(failedQuery.count()).isEqualTo(0); + assertThat(failedQuery.count()).isZero(); // when (1) testRule.executeAvailableJobs(); @@ -816,7 +816,7 @@ public void testFailedJobEventsExecutedByJobExecutor() { assertThat(failedJobLogEntry.getJobRetries()).isEqualTo(1); failedJobLogEntry = failedQuery.list().get(3); - assertThat(failedJobLogEntry.getJobRetries()).isEqualTo(0); + assertThat(failedJobLogEntry.getJobRetries()).isZero(); } @Deployment(resources = {"org/operaton/bpm/engine/test/history/HistoricJobLogTest.testAsyncContinuation.bpmn20.xml"}) @@ -834,7 +834,7 @@ public void testSuccessfulJobEvent() { // there exists one historic job log entry assertThat(query.count()).isEqualTo(1); assertThat(createdQuery.count()).isEqualTo(1); - assertThat(succeededQuery.count()).isEqualTo(0); + assertThat(succeededQuery.count()).isZero(); // when managementService.executeJob(jobId); @@ -866,7 +866,7 @@ public void testSuccessfulJobEventExecutedByJobExecutor() { // there exists one historic job log entry assertThat(query.count()).isEqualTo(1); assertThat(createdQuery.count()).isEqualTo(1); - assertThat(succeededQuery.count()).isEqualTo(0); + assertThat(succeededQuery.count()).isZero(); // when testRule.executeAvailableJobs(); @@ -899,8 +899,8 @@ public void testSuccessfulAndFailedJobEvents() { // there exists one historic job log entry assertThat(query.count()).isEqualTo(1); assertThat(createdQuery.count()).isEqualTo(1); - assertThat(failedQuery.count()).isEqualTo(0); - assertThat(succeededQuery.count()).isEqualTo(0); + assertThat(failedQuery.count()).isZero(); + assertThat(succeededQuery.count()).isZero(); // when (1) try { @@ -914,7 +914,7 @@ public void testSuccessfulAndFailedJobEvents() { assertThat(query.count()).isEqualTo(2); assertThat(createdQuery.count()).isEqualTo(1); assertThat(failedQuery.count()).isEqualTo(1); - assertThat(succeededQuery.count()).isEqualTo(0); + assertThat(succeededQuery.count()).isZero(); HistoricJobLog createdJobLogEntry = createdQuery.singleResult(); assertThat(createdJobLogEntry.getJobRetries()).isEqualTo(3); @@ -934,7 +934,7 @@ public void testSuccessfulAndFailedJobEvents() { assertThat(query.count()).isEqualTo(3); assertThat(createdQuery.count()).isEqualTo(1); assertThat(failedQuery.count()).isEqualTo(2); - assertThat(succeededQuery.count()).isEqualTo(0); + assertThat(succeededQuery.count()).isZero(); createdJobLogEntry = createdQuery.singleResult(); assertThat(createdJobLogEntry.getJobRetries()).isEqualTo(3); @@ -987,8 +987,8 @@ public void testTerminateEndEvent() { assertThat(serviceTask1Query.count()).isEqualTo(1); assertThat(serviceTask1CreatedQuery.count()).isEqualTo(1); - assertThat(serviceTask1DeletedQuery.count()).isEqualTo(0); - assertThat(serviceTask1SuccessfulQuery.count()).isEqualTo(0); + assertThat(serviceTask1DeletedQuery.count()).isZero(); + assertThat(serviceTask1SuccessfulQuery.count()).isZero(); // serviceTask2 String serviceTask2JobId = managementService.createJobQuery().activityId("serviceTask2").singleResult().getId(); @@ -1000,8 +1000,8 @@ public void testTerminateEndEvent() { assertThat(serviceTask2Query.count()).isEqualTo(1); assertThat(serviceTask2CreatedQuery.count()).isEqualTo(1); - assertThat(serviceTask2DeletedQuery.count()).isEqualTo(0); - assertThat(serviceTask2SuccessfulQuery.count()).isEqualTo(0); + assertThat(serviceTask2DeletedQuery.count()).isZero(); + assertThat(serviceTask2SuccessfulQuery.count()).isZero(); // when managementService.executeJob(serviceTask1JobId); @@ -1012,7 +1012,7 @@ public void testTerminateEndEvent() { // serviceTas1 assertThat(serviceTask1Query.count()).isEqualTo(2); assertThat(serviceTask1CreatedQuery.count()).isEqualTo(1); - assertThat(serviceTask1DeletedQuery.count()).isEqualTo(0); + assertThat(serviceTask1DeletedQuery.count()).isZero(); assertThat(serviceTask1SuccessfulQuery.count()).isEqualTo(1); HistoricJobLog serviceTask1CreatedJobLogEntry = serviceTask1CreatedQuery.singleResult(); @@ -1025,7 +1025,7 @@ public void testTerminateEndEvent() { assertThat(serviceTask2Query.count()).isEqualTo(2); assertThat(serviceTask2CreatedQuery.count()).isEqualTo(1); assertThat(serviceTask2DeletedQuery.count()).isEqualTo(1); - assertThat(serviceTask2SuccessfulQuery.count()).isEqualTo(0); + assertThat(serviceTask2SuccessfulQuery.count()).isZero(); HistoricJobLog serviceTask2CreatedJobLogEntry = serviceTask2CreatedQuery.singleResult(); assertThat(serviceTask2CreatedJobLogEntry.getJobRetries()).isEqualTo(3); @@ -1056,8 +1056,8 @@ public void testErrorEndEventInterruptingCallActivity() { assertThat(serviceTask1Query.count()).isEqualTo(1); assertThat(serviceTask1CreatedQuery.count()).isEqualTo(1); - assertThat(serviceTask1DeletedQuery.count()).isEqualTo(0); - assertThat(serviceTask1SuccessfulQuery.count()).isEqualTo(0); + assertThat(serviceTask1DeletedQuery.count()).isZero(); + assertThat(serviceTask1SuccessfulQuery.count()).isZero(); // serviceTask2 String serviceTask2JobId = managementService.createJobQuery().activityId("serviceTask2").singleResult().getId(); @@ -1069,8 +1069,8 @@ public void testErrorEndEventInterruptingCallActivity() { assertThat(serviceTask2Query.count()).isEqualTo(1); assertThat(serviceTask2CreatedQuery.count()).isEqualTo(1); - assertThat(serviceTask2DeletedQuery.count()).isEqualTo(0); - assertThat(serviceTask2SuccessfulQuery.count()).isEqualTo(0); + assertThat(serviceTask2DeletedQuery.count()).isZero(); + assertThat(serviceTask2SuccessfulQuery.count()).isZero(); // when managementService.executeJob(serviceTask1JobId); @@ -1081,7 +1081,7 @@ public void testErrorEndEventInterruptingCallActivity() { // serviceTask1 assertThat(serviceTask1Query.count()).isEqualTo(2); assertThat(serviceTask1CreatedQuery.count()).isEqualTo(1); - assertThat(serviceTask1DeletedQuery.count()).isEqualTo(0); + assertThat(serviceTask1DeletedQuery.count()).isZero(); assertThat(serviceTask1SuccessfulQuery.count()).isEqualTo(1); HistoricJobLog serviceTask1CreatedJobLogEntry = serviceTask1CreatedQuery.singleResult(); @@ -1094,7 +1094,7 @@ public void testErrorEndEventInterruptingCallActivity() { assertThat(serviceTask2Query.count()).isEqualTo(2); assertThat(serviceTask2CreatedQuery.count()).isEqualTo(1); assertThat(serviceTask2DeletedQuery.count()).isEqualTo(1); - assertThat(serviceTask2SuccessfulQuery.count()).isEqualTo(0); + assertThat(serviceTask2SuccessfulQuery.count()).isZero(); HistoricJobLog serviceTask2CreatedJobLogEntry = serviceTask2CreatedQuery.singleResult(); assertThat(serviceTask2CreatedJobLogEntry.getJobRetries()).isEqualTo(3); @@ -1121,7 +1121,7 @@ public void testDeletedJob() { // there exists one historic job log entry assertThat(query.count()).isEqualTo(1); assertThat(createdQuery.count()).isEqualTo(1); - assertThat(deletedQuery.count()).isEqualTo(0); + assertThat(deletedQuery.count()).isZero(); // when managementService.deleteJob(jobId); @@ -1153,7 +1153,7 @@ public void testDeletedProcessInstance() { // there exists one historic job log entry assertThat(query.count()).isEqualTo(1); assertThat(createdQuery.count()).isEqualTo(1); - assertThat(deletedQuery.count()).isEqualTo(0); + assertThat(deletedQuery.count()).isZero(); // when runtimeService.deleteProcessInstance(processInstanceId, null); @@ -1418,7 +1418,7 @@ public void testDeleteByteArray() { return null; }); - assertThat(historyService.createHistoricJobLogQuery().count()).isEqualTo(0); + assertThat(historyService.createHistoricJobLogQuery().count()).isZero(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceQueryOrTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceQueryOrTest.java index e18b569990e..1608a67a15b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceQueryOrTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceQueryOrTest.java @@ -774,7 +774,7 @@ public void shouldReturnByProcessDefinitionKeyOrActivityId() { .list(); // then - assertThat(processInstances.size()).isEqualTo(2); + assertThat(processInstances).hasSize(2); } @Test @@ -814,7 +814,7 @@ public void shouldReturnByProcessDefinitionIdOrIncidentType() { .list(); // then - assertThat(processInstances.size()).isEqualTo(2); + assertThat(processInstances).hasSize(2); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java index e0e42c61990..287d0d2d2ed 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.java @@ -16,12 +16,9 @@ */ package org.operaton.bpm.engine.test.history; -import static junit.framework.TestCase.fail; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.assertEquals; - -import java.util.List; - +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.history.HistoricProcessInstance; import org.operaton.bpm.engine.history.HistoricTaskInstance; @@ -36,9 +33,12 @@ import org.operaton.bpm.model.bpmn.BpmnModelInstance; import org.operaton.bpm.model.bpmn.instance.EndEvent; import org.operaton.bpm.model.bpmn.instance.TerminateEventDefinition; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.List; + +import static junit.framework.TestCase.fail; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.assertEquals; /** * @author Askar Akhmerov @@ -213,7 +213,7 @@ public void testSateOfScriptTaskProcessWithTransactionCommitAndException() { //expected } - assertThat(processEngineRule.getRuntimeService().createProcessInstanceQuery().active().list().size()).isEqualTo(1); + assertThat(processEngineRule.getRuntimeService().createProcessInstanceQuery().active().list()).hasSize(1); HistoricProcessInstance entity = getHistoricProcessInstanceWithAssertion(processDefinition); assertThat(entity.getState()).isEqualTo(HistoricProcessInstance.STATE_ACTIVE); assertEquals(1, processEngineRule.getHistoryService().createHistoricProcessInstanceQuery().active().count()); @@ -238,7 +238,7 @@ public void testErrorEndEvent() { @Deployment(resources = {"org/operaton/bpm/engine/test/history/HistoricProcessInstanceStateTest.testWithCallActivity.bpmn"}) public void testWithCallActivity() { processEngineRule.getRuntimeService().startProcessInstanceByKey("Main_Process"); - assertThat(processEngineRule.getRuntimeService().createProcessInstanceQuery().active().list().size()).isEqualTo(0); + assertThat(processEngineRule.getRuntimeService().createProcessInstanceQuery().active().list()).isEmpty(); HistoricProcessInstance entity1 = processEngineRule.getHistoryService().createHistoricProcessInstanceQuery() .processDefinitionKey("Main_Process").singleResult(); @@ -303,7 +303,7 @@ private HistoricProcessInstance getHistoricProcessInstanceWithAssertion(ProcessD List entities = processEngineRule.getHistoryService().createHistoricProcessInstanceQuery() .processDefinitionId(processDefinition.getId()).list(); assertThat(entities).isNotNull(); - assertThat(entities.size()).isEqualTo(1); + assertThat(entities).hasSize(1); return entities.get(0); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java index 18c52f1aaca..29845dc9de6 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/HistoricProcessInstanceTest.java @@ -16,42 +16,12 @@ */ package org.operaton.bpm.engine.test.history; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicProcessInstanceByProcessDefinitionId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicProcessInstanceByProcessDefinitionKey; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicProcessInstanceByProcessDefinitionName; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicProcessInstanceByProcessDefinitionVersion; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.historicProcessInstanceByProcessInstanceId; -import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.verifySorting; -import static org.operaton.bpm.engine.test.api.runtime.migration.ModifiableBpmnModelInstance.modify; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -import java.util.Set; -import java.util.stream.Collectors; import org.apache.commons.lang3.time.DateUtils; -import org.operaton.bpm.engine.BadUserRequestException; -import org.operaton.bpm.engine.CaseService; -import org.operaton.bpm.engine.HistoryService; -import org.operaton.bpm.engine.ManagementService; -import org.operaton.bpm.engine.ProcessEngineConfiguration; -import org.operaton.bpm.engine.ProcessEngineException; -import org.operaton.bpm.engine.RepositoryService; -import org.operaton.bpm.engine.RuntimeService; -import org.operaton.bpm.engine.TaskService; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; +import org.operaton.bpm.engine.*; import org.operaton.bpm.engine.exception.NotValidException; import org.operaton.bpm.engine.exception.NullValueException; import org.operaton.bpm.engine.history.HistoricActivityInstance; @@ -81,10 +51,14 @@ import org.operaton.bpm.engine.variable.Variables; import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.*; +import java.util.stream.Collectors; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.*; +import static org.operaton.bpm.engine.test.api.runtime.TestOrderingUtil.*; +import static org.operaton.bpm.engine.test.api.runtime.migration.ModifiableBpmnModelInstance.modify; /** * @author Tom Baeyens @@ -2029,16 +2003,16 @@ public void shouldQueryByActivityIdInWithMultipleScopeAndIncident() { historyService.createHistoricProcessInstanceQuery().activityIdIn("innerServiceTask", "outerTask").list(); // then - assertThat(queryByInnerServiceActivityId.size()).isEqualTo(1); + assertThat(queryByInnerServiceActivityId).hasSize(1); assertThat(queryByInnerServiceActivityId.get(0).getId()).isEqualTo(processInstance.getId()); - assertThat(queryBySubProcessActivityId.size()).isEqualTo(1); + assertThat(queryBySubProcessActivityId).hasSize(1); assertThat(queryBySubProcessActivityId.get(0).getId()).isEqualTo(processInstance.getId()); - assertThat(queryByOuterProcessActivityId.size()).isEqualTo(1); + assertThat(queryByOuterProcessActivityId).hasSize(1); assertThat(queryByOuterProcessActivityId.get(0).getId()).isEqualTo(processInstance2.getId()); - assertThat(queryByOuterAndInnedActivityId.size()).isEqualTo(2); + assertThat(queryByOuterAndInnedActivityId).hasSize(2); assertThat(queryByOuterAndInnedActivityId.stream() .map(HistoricProcessInstance::getId) .collect(Collectors.toList())) @@ -2068,16 +2042,16 @@ public void shouldQueryByActivityIdInWithMultipleScope() { historyService.createHistoricProcessInstanceQuery().activityIdIn("innerTask", "outerTask").list(); // then - assertThat(queryByInnerServiceActivityId.size()).isEqualTo(1); + assertThat(queryByInnerServiceActivityId).hasSize(1); assertThat(queryByInnerServiceActivityId.get(0).getId()).isEqualTo(processInstance.getId()); - assertThat(queryBySubProcessActivityId.size()).isEqualTo(1); + assertThat(queryBySubProcessActivityId).hasSize(1); assertThat(queryBySubProcessActivityId.get(0).getId()).isEqualTo(processInstance.getId()); - assertThat(queryByOuterProcessActivityId.size()).isEqualTo(1); + assertThat(queryByOuterProcessActivityId).hasSize(1); assertThat(queryByOuterProcessActivityId.get(0).getId()).isEqualTo(processInstance2.getId()); - assertThat(queryByOuterAndInnedActivityId.size()).isEqualTo(2); + assertThat(queryByOuterAndInnedActivityId).hasSize(2); assertThat(queryByOuterAndInnedActivityId.stream() .map(HistoricProcessInstance::getId) .collect(Collectors.toList())) @@ -2227,7 +2201,7 @@ public void testQueryWithProcessDefinitionKeyIn() { // then assertThat(query.count()).isEqualTo(6l); - assertThat(query.list().size()).isEqualTo(6); + assertThat(query.list()).hasSize(6); } @Test @@ -2241,8 +2215,8 @@ public void testQueryByNonExistingProcessDefinitionKeyIn() { .processDefinitionKeyIn("not-existing-key"); // then - assertThat(query.count()).isEqualTo(0l); - assertThat(query.list().size()).isEqualTo(0); + assertThat(query.count()).isZero(); + assertThat(query.list()).isEmpty(); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/MetricsManagerForCleanupTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/MetricsManagerForCleanupTest.java index e6abba319da..2a997101923 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/MetricsManagerForCleanupTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/MetricsManagerForCleanupTest.java @@ -123,7 +123,7 @@ public Object execute(CommandContext commandContext) { .findTaskMetricsForCleanup(batchSize, taskMetricHistoryTTL, 0, 59); // then - assertThat(taskMetricIdsForCleanup.size()).isEqualTo(resultCount); + assertThat(taskMetricIdsForCleanup).hasSize(resultCount); return null; } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/PartitioningTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/PartitioningTest.java index 271150d37ff..8bf0db1d537 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/PartitioningTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/PartitioningTest.java @@ -106,7 +106,7 @@ public Void execute(CommandContext commandContext) { }); // assume - assertThat(historyService.createHistoricProcessInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricProcessInstanceQuery().count()).isZero(); // when runtimeService.deleteProcessInstance(processInstanceId, "aDeleteReason"); @@ -166,7 +166,7 @@ public Void execute(CommandContext commandContext) { }); // assume - assertThat(historyService.createHistoricActivityInstanceQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricActivityInstanceQuery().count()).isZero(); // when String taskId = taskService.createTaskQuery() @@ -200,15 +200,15 @@ public Void execute(CommandContext commandContext) { }); // assume - assertThat(historyService.createHistoricIncidentQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricIncidentQuery().count()).isZero(); assertThat(runtimeService.createIncidentQuery().count()).isEqualTo(1L); // when runtimeService.resolveIncident(incidentId); // then - assertThat(runtimeService.createIncidentQuery().count()).isEqualTo(0L); - assertThat(historyService.createHistoricIncidentQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createIncidentQuery().count()).isZero(); + assertThat(historyService.createHistoricIncidentQuery().count()).isZero(); } @Test @@ -235,7 +235,7 @@ public Void execute(CommandContext commandContext) { }); // assume - assertThat(historyService.createHistoricBatchQuery().count()).isEqualTo(0L); + assertThat(historyService.createHistoricBatchQuery().count()).isZero(); // when String seedJobDefinitionId = batch.getSeedJobDefinitionId(); @@ -254,8 +254,8 @@ public Void execute(CommandContext commandContext) { } // then - assertThat(runtimeService.createProcessInstanceQuery().count()).isEqualTo(0L); - assertThat(managementService.createBatchQuery().count()).isEqualTo(0L); + assertThat(runtimeService.createProcessInstanceQuery().count()).isZero(); + assertThat(managementService.createBatchQuery().count()).isZero(); // cleanup cleanUp(processInstanceId); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceQueryTest.java index d724d1e01f8..fecd334d1f8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceQueryTest.java @@ -16,12 +16,10 @@ */ package org.operaton.bpm.engine.test.history.dmn; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; - -import java.util.Date; -import java.util.List; - +import org.joda.time.DateTime; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.operaton.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.ProcessEngineException; @@ -39,10 +37,12 @@ import org.operaton.bpm.engine.test.util.ResetDmnConfigUtil; import org.operaton.bpm.engine.variable.VariableMap; import org.operaton.bpm.engine.variable.Variables; -import org.joda.time.DateTime; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; + +import java.util.Date; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; /** * @author Philipp Ossler @@ -191,7 +191,7 @@ public void testQueryByDecisionInstanceId() { assertThat(query.decisionInstanceId(decisionInstanceId1).count()).isEqualTo(1L); assertThat(query.decisionInstanceId(decisionInstanceId2).count()).isEqualTo(1L); - assertThat(query.decisionInstanceId("unknown").count()).isEqualTo(0L); + assertThat(query.decisionInstanceId("unknown").count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) @@ -221,7 +221,7 @@ public void testQueryByDecisionDefinitionId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionDefinitionId(decisionDefinitionId).count()).isEqualTo(1L); - assertThat(query.decisionDefinitionId("other id").count()).isEqualTo(0L); + assertThat(query.decisionDefinitionId("other id").count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN, DRG_DMN }) @@ -242,7 +242,7 @@ public void testQueryByDecisionDefinitionIdIn() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionDefinitionIdIn(decisionDefinitionId, decisionDefinitionId2).count()).isEqualTo(2L); - assertThat(query.decisionDefinitionIdIn("other id", "anotherFake").count()).isEqualTo(0L); + assertThat(query.decisionDefinitionIdIn("other id", "anotherFake").count()).isZero(); } @Deployment(resources = {DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN, DRG_DMN}) @@ -271,7 +271,7 @@ public void testQueryByDecisionDefinitionKeyIn() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionDefinitionKeyIn(DISH_DECISION, DECISION_DEFINITION_KEY).count()).isEqualTo(2L); - assertThat(query.decisionDefinitionKeyIn("other id", "anotherFake").count()).isEqualTo(0L); + assertThat(query.decisionDefinitionKeyIn("other id", "anotherFake").count()).isZero(); } @Deployment(resources = {DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN, DRG_DMN}) @@ -295,7 +295,7 @@ public void testQueryByDecisionDefinitionKey() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionDefinitionKey(DECISION_DEFINITION_KEY).count()).isEqualTo(1L); - assertThat(query.decisionDefinitionKey("other key").count()).isEqualTo(0L); + assertThat(query.decisionDefinitionKey("other key").count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) @@ -307,7 +307,7 @@ public void testQueryByDecisionDefinitionName() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.decisionDefinitionName("sample decision").count()).isEqualTo(1L); - assertThat(query.decisionDefinitionName("other name").count()).isEqualTo(0L); + assertThat(query.decisionDefinitionName("other name").count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_PROCESS_WITH_UNDERSCORE, DECISION_SINGLE_OUTPUT_DMN, DECISION_SINGLE_OUTPUT_DMN_WITH_UNDERSCORE }) @@ -332,7 +332,7 @@ public void testQueryByInvalidDecisionDefinitionNameLike() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.decisionDefinitionNameLike("%invalid%").count()).isEqualTo(0L); + assertThat(query.decisionDefinitionNameLike("%invalid%").count()).isZero(); try { query.decisionDefinitionNameLike(null); @@ -352,7 +352,7 @@ public void testQueryByProcessDefinitionKey() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.processDefinitionKey(processDefinitionKey).count()).isEqualTo(1L); - assertThat(query.processDefinitionKey("other process").count()).isEqualTo(0L); + assertThat(query.processDefinitionKey("other process").count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) @@ -365,7 +365,7 @@ public void testQueryByProcessDefinitionId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.processDefinitionId(processDefinitionId).count()).isEqualTo(1L); - assertThat(query.processDefinitionId("other process").count()).isEqualTo(0L); + assertThat(query.processDefinitionId("other process").count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) @@ -379,7 +379,7 @@ public void testQueryByProcessInstanceId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.processInstanceId(processInstanceId).count()).isEqualTo(1L); - assertThat(query.processInstanceId("other process").count()).isEqualTo(0L); + assertThat(query.processInstanceId("other process").count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) @@ -391,7 +391,7 @@ public void testQueryByActivityId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.activityIdIn("task").count()).isEqualTo(1L); - assertThat(query.activityIdIn("other activity").count()).isEqualTo(0L); + assertThat(query.activityIdIn("other activity").count()).isZero(); assertThat(query.activityIdIn("task", "other activity").count()).isEqualTo(1L); } @@ -405,7 +405,7 @@ public void testQueryByActivityInstanceId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.activityInstanceIdIn(activityInstanceId).count()).isEqualTo(1L); - assertThat(query.activityInstanceIdIn("other activity").count()).isEqualTo(0L); + assertThat(query.activityInstanceIdIn("other activity").count()).isZero(); assertThat(query.activityInstanceIdIn(activityInstanceId, "other activity").count()).isEqualTo(1L); } @@ -422,7 +422,7 @@ public void testQueryByEvaluatedBefore() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.evaluatedBefore(afterEvaluated).count()).isEqualTo(1L); assertThat(query.evaluatedBefore(evaluated).count()).isEqualTo(1L); - assertThat(query.evaluatedBefore(beforeEvaluated).count()).isEqualTo(0L); + assertThat(query.evaluatedBefore(beforeEvaluated).count()).isZero(); ClockUtil.reset(); } @@ -440,7 +440,7 @@ public void testQueryByEvaluatedAfter() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.evaluatedAfter(beforeEvaluated).count()).isEqualTo(1L); assertThat(query.evaluatedAfter(evaluated).count()).isEqualTo(1L); - assertThat(query.evaluatedAfter(afterEvaluated).count()).isEqualTo(0L); + assertThat(query.evaluatedAfter(afterEvaluated).count()).isZero(); ClockUtil.reset(); } @@ -459,7 +459,7 @@ public void testQueryByCaseDefinitionKey() { public void testQueryByInvalidCaseDefinitionKey() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.caseDefinitionKey("invalid").count()).isEqualTo(0L); + assertThat(query.caseDefinitionKey("invalid").count()).isZero(); try { query.caseDefinitionKey(null); @@ -482,7 +482,7 @@ public void testQueryByCaseDefinitionId() { public void testQueryByInvalidCaseDefinitionId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.caseDefinitionId("invalid").count()).isEqualTo(0L); + assertThat(query.caseDefinitionId("invalid").count()).isZero(); try { query.caseDefinitionId(null); @@ -505,7 +505,7 @@ public void testQueryByCaseInstanceId() { public void testQueryByInvalidCaseInstanceId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.caseInstanceId("invalid").count()).isEqualTo(0L); + assertThat(query.caseInstanceId("invalid").count()).isZero(); try { query.caseInstanceId(null); @@ -531,7 +531,7 @@ public void testQueryByInvalidUserId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.userId("dem1").count()).isEqualTo(0L); + assertThat(query.userId("dem1").count()).isZero(); try { query.userId(null); @@ -556,8 +556,8 @@ public void testQueryByRootDecisionInstanceId() { query = historyService.createHistoricDecisionInstanceQuery(); assertThat(query.rootDecisionInstanceId(rootDecisionInstanceId).count()).isEqualTo(3L); - assertThat(query.rootDecisionInstanceId(requiredDecisionInstanceId1).count()).isEqualTo(0L); - assertThat(query.rootDecisionInstanceId(requiredDecisionInstanceId2).count()).isEqualTo(0L); + assertThat(query.rootDecisionInstanceId(requiredDecisionInstanceId1).count()).isZero(); + assertThat(query.rootDecisionInstanceId(requiredDecisionInstanceId2).count()).isZero(); } @Deployment(resources = { DRG_DMN }) @@ -585,7 +585,7 @@ public void testQueryByDecisionRequirementsDefinitionId() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.decisionRequirementsDefinitionId("notExisting").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionId("notExisting").count()).isZero(); assertThat(query.decisionRequirementsDefinitionId(decisionRequirementsDefinition.getId()).count()).isEqualTo(3L); } @@ -598,7 +598,7 @@ public void testQueryByDecisionRequirementsDefinitionKey() { HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery(); - assertThat(query.decisionRequirementsDefinitionKey("notExisting").count()).isEqualTo(0L); + assertThat(query.decisionRequirementsDefinitionKey("notExisting").count()).isZero(); assertThat(query.decisionRequirementsDefinitionKey("dish").count()).isEqualTo(3L); } @@ -613,14 +613,14 @@ public void testNativeQuery() { NativeHistoricDecisionInstanceQuery nativeQuery = historyService .createNativeHistoricDecisionInstanceQuery().sql("SELECT * FROM " + tablePrefix + "ACT_HI_DECINST"); - assertThat(nativeQuery.list().size()).isEqualTo(1); + assertThat(nativeQuery.list()).hasSize(1); NativeHistoricDecisionInstanceQuery nativeQueryWithParameter = historyService .createNativeHistoricDecisionInstanceQuery() .sql("SELECT * FROM " + tablePrefix + "ACT_HI_DECINST H WHERE H.DEC_DEF_KEY_ = #{decisionDefinitionKey}"); - assertThat(nativeQueryWithParameter.parameter("decisionDefinitionKey", DECISION_DEFINITION_KEY).list().size()).isEqualTo(1); - assertThat(nativeQueryWithParameter.parameter("decisionDefinitionKey", "other decision").list().size()).isEqualTo(0); + assertThat(nativeQueryWithParameter.parameter("decisionDefinitionKey", DECISION_DEFINITION_KEY).list()).hasSize(1); + assertThat(nativeQueryWithParameter.parameter("decisionDefinitionKey", "other decision").list()).isEmpty(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) @@ -649,8 +649,8 @@ public void testNativeQueryPaging() { NativeHistoricDecisionInstanceQuery nativeQuery = historyService.createNativeHistoricDecisionInstanceQuery() .sql("SELECT * FROM " + tablePrefix + "ACT_HI_DECINST"); - assertThat(nativeQuery.listPage(0, 2).size()).isEqualTo(2); - assertThat(nativeQuery.listPage(1, 1).size()).isEqualTo(1); + assertThat(nativeQuery.listPage(0, 2)).hasSize(2); + assertThat(nativeQuery.listPage(1, 1)).hasSize(1); } protected ProcessInstance startProcessInstanceAndEvaluateDecision() { diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceTest.java index ea07a753180..0dad5cbe49f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/dmn/HistoricDecisionInstanceTest.java @@ -16,12 +16,10 @@ */ package org.operaton.bpm.engine.test.history.dmn; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import org.joda.time.DateTime; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; import org.operaton.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration; import org.operaton.bpm.engine.ProcessEngineConfiguration; import org.operaton.bpm.engine.history.HistoricDecisionInputInstance; @@ -43,10 +41,12 @@ import org.operaton.bpm.engine.test.util.ResetDmnConfigUtil; import org.operaton.bpm.engine.variable.VariableMap; import org.operaton.bpm.engine.variable.Variables; -import org.joda.time.DateTime; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.assertj.core.api.Assertions.assertThat; /** * @author Philipp Ossler @@ -190,7 +190,7 @@ public void testDecisionInputInstanceProperties() { HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeInputs().singleResult(); List inputs = historicDecisionInstance.getInputs(); assertThat(inputs).isNotNull(); - assertThat(inputs.size()).isEqualTo(1); + assertThat(inputs).hasSize(1); HistoricDecisionInputInstance input = inputs.get(0); assertThat(input.getDecisionInstanceId()).isEqualTo(historicDecisionInstance.getId()); @@ -211,14 +211,14 @@ public void testMultipleDecisionInstances() { .includeInputs() .orderByEvaluationTime().asc() .list(); - assertThat(historicDecisionInstances.size()).isEqualTo(2); + assertThat(historicDecisionInstances).hasSize(2); List inputsOfFirstDecision = historicDecisionInstances.get(0).getInputs(); - assertThat(inputsOfFirstDecision.size()).isEqualTo(1); + assertThat(inputsOfFirstDecision).hasSize(1); assertThat(inputsOfFirstDecision.get(0).getValue()).isEqualTo((Object) "a"); List inputsOfSecondDecision = historicDecisionInstances.get(1).getInputs(); - assertThat(inputsOfSecondDecision.size()).isEqualTo(1); + assertThat(inputsOfSecondDecision).hasSize(1); assertThat(inputsOfSecondDecision.get(0).getValue()).isEqualTo((Object) "b"); } @@ -233,7 +233,7 @@ public void testMultipleDecisionInputInstances() { HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeInputs().singleResult(); List inputs = historicDecisionInstance.getInputs(); - assertThat(inputs.size()).isEqualTo(2); + assertThat(inputs).hasSize(2); assertThat(inputs.get(0).getValue()).isEqualTo((Object) "a"); assertThat(inputs.get(1).getValue()).isEqualTo((Object) 1); @@ -248,7 +248,7 @@ public void testDisableDecisionInputInstanceByteValue() { HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeInputs().disableBinaryFetching().singleResult(); List inputs = historicDecisionInstance.getInputs(); - assertThat(inputs.size()).isEqualTo(1); + assertThat(inputs).hasSize(1); HistoricDecisionInputInstance input = inputs.get(0); assertThat(input.getTypeName()).isEqualTo("bytes"); @@ -264,7 +264,7 @@ public void testDecisionOutputInstanceProperties() { HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeOutputs().singleResult(); List outputs = historicDecisionInstance.getOutputs(); assertThat(outputs).isNotNull(); - assertThat(outputs.size()).isEqualTo(1); + assertThat(outputs).hasSize(1); HistoricDecisionOutputInstance output = outputs.get(0); assertThat(output.getDecisionInstanceId()).isEqualTo(historicDecisionInstance.getId()); @@ -285,7 +285,7 @@ public void testMultipleDecisionOutputInstances() { HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeOutputs().singleResult(); List outputs = historicDecisionInstance.getOutputs(); - assertThat(outputs.size()).isEqualTo(2); + assertThat(outputs).hasSize(2); HistoricDecisionOutputInstance firstOutput = outputs.get(0); assertThat(firstOutput.getClauseId()).isEqualTo("out1"); @@ -310,7 +310,7 @@ public void testCompoundDecisionOutputInstances() { HistoricDecisionInstance historicDecisionInstance = historyService.createHistoricDecisionInstanceQuery().includeOutputs().singleResult(); List outputs = historicDecisionInstance.getOutputs(); - assertThat(outputs.size()).isEqualTo(2); + assertThat(outputs).hasSize(2); HistoricDecisionOutputInstance firstOutput = outputs.get(0); assertThat(firstOutput.getClauseId()).isEqualTo("out1"); @@ -358,10 +358,10 @@ public void testDecisionInstancePropertiesOfDecisionLiteralExpression() { assertThat(historicDecisionInstance.getDecisionDefinitionName()).isEqualTo("Decision with Literal Expression"); assertThat(historicDecisionInstance.getEvaluationTime()).isNotNull(); - assertThat(historicDecisionInstance.getInputs().size()).isEqualTo(0); + assertThat(historicDecisionInstance.getInputs()).isEmpty(); List outputs = historicDecisionInstance.getOutputs(); - assertThat(outputs.size()).isEqualTo(1); + assertThat(outputs).hasSize(1); HistoricDecisionOutputInstance output = outputs.get(0); assertThat(output.getVariableName()).isEqualTo("result"); @@ -416,7 +416,7 @@ public void testDeleteHistoricDecisionInstances() { DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); historyService.deleteHistoricDecisionInstanceByDefinitionId(decisionDefinition.getId()); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Deployment(resources = { DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN }) @@ -435,7 +435,7 @@ public void testDeleteHistoricDecisionInstanceByInstanceId() { historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId()); // then - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Test @@ -459,7 +459,7 @@ public void testDeleteHistoricDecisionInstanceByUndeployment() { assertThat(query.count()).isEqualTo(1L); repositoryService.deleteDeployment(firstDeploymentId, true); - assertThat(query.count()).isEqualTo(0L); + assertThat(query.count()).isZero(); } @Deployment(resources = { DECISION_SINGLE_OUTPUT_DMN }) diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/history/useroperationlog/UserOperationLogAnnotationTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/history/useroperationlog/UserOperationLogAnnotationTest.java index 27736e3e10f..896897769f2 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/history/useroperationlog/UserOperationLogAnnotationTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/history/useroperationlog/UserOperationLogAnnotationTest.java @@ -152,7 +152,7 @@ public void shouldSetAnnotationForAllEntries() { .list(); // assume - assertThat(userOperationLogEntries.size()).isEqualTo(2); + assertThat(userOperationLogEntries).hasSize(2); String operationId = userOperationLogEntries.get(0) .getOperationId(); @@ -211,7 +211,7 @@ public void shouldClearAnnotationForAllEntries() { .list(); // assume - assertThat(userOperationLogEntries.size()).isEqualTo(2); + assertThat(userOperationLogEntries).hasSize(2); String operationId = userOperationLogEntries.get(0) .getOperationId(); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/AcquireJobCmdUnitTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/AcquireJobCmdUnitTest.java index 4eee0132c6b..93af1b510da 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/AcquireJobCmdUnitTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/AcquireJobCmdUnitTest.java @@ -104,8 +104,8 @@ public void exclusiveJobsSameInstance() { AcquiredJobs acquiredJobs = acquireJobsCmd.execute(commandContext); List> jobIdBatches = acquiredJobs.getJobIdBatches(); - assertThat(jobIdBatches.size()).isEqualTo(1); - assertThat(jobIdBatches.get(0).size()).isEqualTo(2); + assertThat(jobIdBatches).hasSize(1); + assertThat(jobIdBatches.get(0)).hasSize(2); assertThat(jobIdBatches.get(0)).containsExactlyInAnyOrder(JOB_ID_1, JOB_ID_2); } @@ -139,9 +139,9 @@ protected void checkThatAcquiredJobsInDifferentBatches() { AcquiredJobs acquiredJobs = acquireJobsCmd.execute(commandContext); List> jobIdBatches = acquiredJobs.getJobIdBatches(); - assertThat(jobIdBatches.size()).isEqualTo(2); - assertThat(jobIdBatches.get(0).size()).isEqualTo(1); - assertThat(jobIdBatches.get(1).size()).isEqualTo(1); + assertThat(jobIdBatches).hasSize(2); + assertThat(jobIdBatches.get(0)).hasSize(1); + assertThat(jobIdBatches.get(1)).hasSize(1); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/BatchJobPriorityRangeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/BatchJobPriorityRangeTest.java index f47d4a1e3be..3738dc4db56 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/BatchJobPriorityRangeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/BatchJobPriorityRangeTest.java @@ -124,7 +124,7 @@ public void shouldNotAcquireBatchJobOutsidePriorityRange() { // then List acquirableJobs = findAcquirableJobs(); - assertThat(acquirableJobs).hasSize(0); + assertThat(acquirableJobs).isEmpty(); Job seedJob = helper.getSeedJob(batch); assertThat(seedJob.getPriority()).isEqualTo(20L); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/HistoryCleanupJobPriorityRangeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/HistoryCleanupJobPriorityRangeTest.java index a74365197dc..26f6deba24b 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/HistoryCleanupJobPriorityRangeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/HistoryCleanupJobPriorityRangeTest.java @@ -109,7 +109,7 @@ public void shouldNotAcquireHistoryCleanupJobOutsidePriorityRange() { // then List acquirableJobs = findAcquirableJobs(); - assertThat(acquirableJobs).hasSize(0); + assertThat(acquirableJobs).isEmpty(); List historyCleanupJobs = historyService.findHistoryCleanupJobs(); assertThat(historyCleanupJobs).hasSize(1); assertThat(historyCleanupJobs.get(0).getPriority()).isEqualTo(20L); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExceptionLoggingTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExceptionLoggingTest.java index 6948d712c2a..5b5a6351d2c 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExceptionLoggingTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExceptionLoggingTest.java @@ -16,12 +16,13 @@ */ package org.operaton.bpm.engine.test.jobexecutor; -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; - import ch.qos.logback.classic.Level; import ch.qos.logback.classic.spi.ILoggingEvent; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.RuleChain; import org.operaton.bpm.engine.ManagementService; import org.operaton.bpm.engine.RuntimeService; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; @@ -34,11 +35,10 @@ import org.operaton.bpm.model.bpmn.Bpmn; import org.operaton.bpm.model.bpmn.BpmnModelInstance; import org.operaton.commons.testing.ProcessEngineLoggingRule; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.RuleChain; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; public class JobExceptionLoggingTest { @@ -91,8 +91,8 @@ public void shouldLogFailingJobOnlyOnceReducedLogging() { List ctxLog = loggingRule.getFilteredLog(CONTEXT_LOGGER, "Exception while closing command context"); // then - assertThat(jobLog.size()).isEqualTo(1); - assertThat(ctxLog.size()).isEqualTo(0); + assertThat(jobLog).hasSize(1); + assertThat(ctxLog).isEmpty(); } @Test @@ -112,8 +112,8 @@ public void shouldLogFailingJobTwiceDefaultLogging() { List ctxLog = loggingRule.getFilteredLog(CONTEXT_LOGGER, "Exception while closing command context"); // then - assertThat(jobLog.size()).isEqualTo(1); - assertThat(ctxLog.size()).isEqualTo(1); + assertThat(jobLog).hasSize(1); + assertThat(ctxLog).hasSize(1); } @Test @@ -146,8 +146,8 @@ public void shouldNotLogExceptionWhenApiCallReducedLogging() { assertThat(expectedException).isNotNull(); assertThat(expectedException.getMessage()).contains("Expected Exception"); // ...but not logged - assertThat(jobLog.size()).isEqualTo(0); - assertThat(ctxLog.size()).isEqualTo(0); + assertThat(jobLog).isEmpty(); + assertThat(ctxLog).isEmpty(); } @Test @@ -176,7 +176,7 @@ public void shouldNotLogExceptionWhenUserApiCallReducedLogging() { assertThat(expectedException).isNotNull(); assertThat(expectedException.getMessage()).contains("Expected Exception"); // ...but not logged - assertThat(jobLog.size()).isEqualTo(0); - assertThat(ctxLog.size()).isEqualTo(0); + assertThat(jobLog).isEmpty(); + assertThat(ctxLog).isEmpty(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExecutorAcquireJobsForPriorityRangeTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExecutorAcquireJobsForPriorityRangeTest.java index bcb71c3cf95..3c610c5b1dd 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExecutorAcquireJobsForPriorityRangeTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/JobExecutorAcquireJobsForPriorityRangeTest.java @@ -121,7 +121,7 @@ public void shouldAcquireOnlyJobsInBoundWithUpperAndLowerBoundNoJobsFound() { List acquirableJobs = findAcquirableJobs(); // then - assertThat(acquirableJobs).hasSize(0); + assertThat(acquirableJobs).isEmpty(); } @Test @@ -172,7 +172,7 @@ public void shouldDisableRangeCheckInQueryWhenDefaultConfig() { // then List log = loggingRule.getFilteredLog("RES.PRIORITY_ >= ? and RES.PRIORITY_ <= ?"); - assertThat(log).hasSize(0); + assertThat(log).isEmpty(); } @Test @@ -188,7 +188,7 @@ public void shouldEnableRangeCheckInQueryWhenUsingCustomMinBoundaryConfig() { List logRangeMinCheck = loggingRule.getFilteredLog("RES.PRIORITY_ >= ?"); assertThat(logRangeMinCheck).hasSize(1); List logRangeMaxCheck = loggingRule.getFilteredLog("RES.PRIORITY_ <= ?"); - assertThat(logRangeMaxCheck).hasSize(0); + assertThat(logRangeMaxCheck).isEmpty(); } @Test @@ -202,7 +202,7 @@ public void shouldEnableRangeCheckInQueryWhenUsingCustomMaxBoundaryConfig() { // then List logRangeMinCheck = loggingRule.getFilteredLog("RES.PRIORITY_ >= ?"); - assertThat(logRangeMinCheck).hasSize(0); + assertThat(logRangeMinCheck).isEmpty(); List logRangeMaxCheck = loggingRule.getFilteredLog("RES.PRIORITY_ <= ?"); assertThat(logRangeMaxCheck).hasSize(1); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/ReducedJobExceptionLoggingTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/ReducedJobExceptionLoggingTest.java index 13cc6d39f41..f2649fe58b1 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/ReducedJobExceptionLoggingTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/jobexecutor/ReducedJobExceptionLoggingTest.java @@ -80,7 +80,7 @@ public void shouldLogAllFailingJobExceptions() { List filteredLogList = loggingRule.getFilteredLog("Exception while executing job"); // then - assertThat(filteredLogList.size()).isEqualTo(3); + assertThat(filteredLogList).hasSize(3); } @Test @@ -98,6 +98,6 @@ public void shouldLogOnlyOneFailingJobException() { List filteredLogList = loggingRule.getFilteredLog("Exception while executing job"); // then - assertThat(filteredLogList.size()).isEqualTo(1); + assertThat(filteredLogList).hasSize(1); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/logging/ProcessDataLoggingContextTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/logging/ProcessDataLoggingContextTest.java index bb11ac6f816..e8606b87c53 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/logging/ProcessDataLoggingContextTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/logging/ProcessDataLoggingContextTest.java @@ -891,7 +891,7 @@ protected void assertLogs(ProcessInstance instance, String filter, List if (expectedActivities != null) { assertThat(activityIdMdc).isNotNull(); - assertThat(expectedActivities.contains(activityIdMdc)).isTrue(); + assertThat(expectedActivities).contains(activityIdMdc); passedActivities.add(activityIdMdc); } else { assertThat(activityIdMdc).isNull(); @@ -929,7 +929,7 @@ protected void assertLogs(ProcessInstance instance, String filter, List } else { - assertThat(mdcPropertyMap.isEmpty()).isTrue(); + assertThat(mdcPropertyMap).isEmpty(); } foundLogEntries = true; } @@ -941,25 +941,25 @@ protected void assertLogs(ProcessInstance instance, String filter, List protected void assertBpmnStacktraceLogPresent(ProcessInstance instance) { List bpmnStacktraceLog = loggingRule.getFilteredLog("ENGINE-16006"); - assertThat(bpmnStacktraceLog.size()).isEqualTo(2); + assertThat(bpmnStacktraceLog).hasSize(2); for (int i = 0; i < bpmnStacktraceLog.size(); i++) { ILoggingEvent logEvent = bpmnStacktraceLog.get(i); Map mdcPropertyMap = logEvent.getMDCPropertyMap(); - assertThat(mdcPropertyMap.containsKey("activityId")).isTrue(); + assertThat(mdcPropertyMap).containsKey("activityId"); assertThat(mdcPropertyMap.containsKey("applicationName")).isFalse(); - assertThat(mdcPropertyMap.containsKey("processDefinitionId")).isTrue(); - assertThat(mdcPropertyMap.containsKey("processInstanceId")).isTrue(); - assertThat(mdcPropertyMap.containsKey("tenantId")).isTrue(); + assertThat(mdcPropertyMap).containsKey("processDefinitionId"); + assertThat(mdcPropertyMap).containsKey("processInstanceId"); + assertThat(mdcPropertyMap).containsKey("tenantId"); if (i == 0) { // first BPMN stack trace log corresponds to nested service task assertThat(mdcPropertyMap.containsKey("businessKey")).isFalse(); - assertThat(mdcPropertyMap.get("activityId")).isEqualTo("failing_task"); + assertThat(mdcPropertyMap).containsEntry("activityId", "failing_task"); assertThat(mdcPropertyMap.get("processDefinitionId")).isNotEqualTo(instance.getProcessDefinitionId()); assertThat(mdcPropertyMap.get("processInstanceId")).isNotEqualTo(instance.getId()); assertThat(instance.getTenantId()).isEqualTo(mdcPropertyMap.get("tenantId")); } else { // second BPMN stack trace log corresponds to outer service task - assertThat(mdcPropertyMap.containsKey("businessKey")).isTrue(); + assertThat(mdcPropertyMap).containsKey("businessKey"); assertThat("startProcess").isEqualTo(mdcPropertyMap.get("activityId")); assertThat(instance.getBusinessKey()).isEqualTo(mdcPropertyMap.get("businessKey")); assertThat(instance.getProcessDefinitionId()).isEqualTo(mdcPropertyMap.get("processDefinitionId")); diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/authentication/LoginAttemptsTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/authentication/LoginAttemptsTest.java index 2befa3db3c3..c7724b8d2f8 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/authentication/LoginAttemptsTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/authentication/LoginAttemptsTest.java @@ -94,6 +94,6 @@ public void testUsuccessfulAttemptsResultInLockedUser() throws ParseException { } // then - assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The user with id 'johndoe' is permanently locked.").size()).isEqualTo(1); + assertThat(loggingRule.getFilteredLog(INDENTITY_LOGGER, "The user with id 'johndoe' is permanently locked.")).hasSize(1); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/db/SchemaLogTestCase.java b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/db/SchemaLogTestCase.java index 0488fe1dddb..83e86aedb27 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/db/SchemaLogTestCase.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/db/SchemaLogTestCase.java @@ -16,25 +16,21 @@ */ package org.operaton.bpm.engine.test.standalone.db; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import org.junit.Before; +import org.junit.Rule; import org.operaton.bpm.engine.ProcessEngine; import org.operaton.bpm.engine.impl.db.sql.DbSqlSessionFactory; import org.operaton.bpm.engine.test.ProcessEngineRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; -import org.junit.Before; -import org.junit.Rule; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import java.io.IOException; +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.Assert.fail; + /** * @author Miklas Boskamp * @@ -70,7 +66,7 @@ private List readFolderContent(String path) { try { PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); Resource[] resources = resolver.getResources("classpath:" + path + "/*"); - assertThat(resources.length).isGreaterThan(0); + assertThat(resources).isNotEmpty(); for (Resource res : resources) { files.add(res.getFilename()); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/deploy/DeploymentTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/deploy/DeploymentTest.java index ef91916f389..8ff1899993f 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/deploy/DeploymentTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/deploy/DeploymentTest.java @@ -58,7 +58,7 @@ public void shouldDeleteDeployment() { engineRule.getRepositoryService().deleteDeployment(deployment.getId(), true); long count = engineRule.getRepositoryService().createDeploymentQuery().count(); - assertThat(count).isEqualTo(0L); + assertThat(count).isZero(); } @Test @@ -80,6 +80,6 @@ public void shouldDeleteDeploymentWithRunningInstance() { engineRule.getRepositoryService().deleteDeployment(deployment.getId(), true); long count = engineRule.getRepositoryService().createDeploymentQuery().count(); - assertThat(count).isEqualTo(0L); + assertThat(count).isZero(); } } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/AbstractHistoryLevelTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/AbstractHistoryLevelTest.java index fa38c807012..530488e7217 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/AbstractHistoryLevelTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/AbstractHistoryLevelTest.java @@ -16,11 +16,11 @@ */ package org.operaton.bpm.engine.test.standalone.history; -import static org.assertj.core.api.Assertions.assertThat; - +import org.junit.Test; import org.operaton.bpm.engine.impl.history.AbstractHistoryLevel; import org.operaton.bpm.engine.impl.history.event.HistoryEventType; -import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; public class AbstractHistoryLevelTest { @@ -45,6 +45,6 @@ public boolean isHistoryEventProduced(HistoryEventType eventType, Object entity) @Test public void ensureCorrectToString() { - assertThat(new MyHistoryLevel().toString()).isEqualTo("MyHistoryLevel(name=myName, id=4711)"); + assertThat(new MyHistoryLevel()).hasToString("MyHistoryLevel(name=myName, id=4711)"); } } \ No newline at end of file diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryOrTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryOrTest.java index 97b4a53e509..6db29d081ce 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryOrTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryOrTest.java @@ -799,7 +799,7 @@ public void shouldQueryStartedBeforeOrAfter() { .list(); // then - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); } @Test @@ -820,7 +820,7 @@ public void shouldQueryStandaloneOrEmbeddedTaskByProcessDefinitionKey() { .list(); // then - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); } @Test @@ -841,7 +841,7 @@ public void shouldQueryStandaloneOrEmbeddedTaskByProcessInstanceId() { .list(); // then - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); } @Test @@ -862,7 +862,7 @@ public void shouldQueryStandaloneOrEmbeddedTaskByCaseDefinitionId() { .list(); // then - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); } @Test @@ -891,7 +891,7 @@ public void shouldQueryFinishedBeforeOrAfter() { .list(); // then - assertThat(tasks.size()).isEqualTo(2); + assertThat(tasks).hasSize(2); } @Test diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryTest.java index c65f7d1ecd6..b78e42e7909 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/history/HistoricTaskInstanceQueryTest.java @@ -764,7 +764,7 @@ public void shouldQueryForTasksWithoutDueDate() { } private void assertThatListContainsOnlyExpectedElement(List instances, ProcessInstance instance) { - assertThat(instances.size()).isEqualTo(1); + assertThat(instances).hasSize(1); assertThat(instances.get(0).getProcessInstanceId()).isEqualTo(instance.getId()); } diff --git a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/identity/DefaultPasswordPolicyTest.java b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/identity/DefaultPasswordPolicyTest.java index 4648b01d0ad..781cb36d7ba 100644 --- a/engine/src/test/java/org/operaton/bpm/engine/test/standalone/identity/DefaultPasswordPolicyTest.java +++ b/engine/src/test/java/org/operaton/bpm/engine/test/standalone/identity/DefaultPasswordPolicyTest.java @@ -16,29 +16,23 @@ */ package org.operaton.bpm.engine.test.standalone.identity; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; - import org.assertj.core.api.Assertions; +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; import org.operaton.bpm.engine.IdentityService; import org.operaton.bpm.engine.exception.NullValueException; import org.operaton.bpm.engine.identity.PasswordPolicy; import org.operaton.bpm.engine.identity.PasswordPolicyResult; import org.operaton.bpm.engine.identity.PasswordPolicyRule; import org.operaton.bpm.engine.identity.User; -import org.operaton.bpm.engine.impl.identity.DefaultPasswordPolicyImpl; -import org.operaton.bpm.engine.impl.identity.PasswordPolicyDigitRuleImpl; -import org.operaton.bpm.engine.impl.identity.PasswordPolicyLengthRuleImpl; -import org.operaton.bpm.engine.impl.identity.PasswordPolicyLowerCaseRuleImpl; -import org.operaton.bpm.engine.impl.identity.PasswordPolicySpecialCharacterRuleImpl; -import org.operaton.bpm.engine.impl.identity.PasswordPolicyUpperCaseRuleImpl; -import org.operaton.bpm.engine.impl.identity.PasswordPolicyUserDataRuleImpl; +import org.operaton.bpm.engine.impl.identity.*; import org.operaton.bpm.engine.test.ProcessEngineRule; import org.operaton.bpm.engine.test.util.ProvidedProcessEngineRule; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; /** * @author Miklas Boskamp @@ -73,9 +67,9 @@ public void resetProcessEngineConfig() { @Test public void testGoodPassword() { PasswordPolicyResult result = identityService.checkPasswordAgainstPolicy(policy, "LongPas$w0rd"); - assertThat(result.getViolatedRules().size()).isEqualTo(0); - assertThat(result.getFulfilledRules().size()).isEqualTo(6); - assertThat(result.isValid()).isEqualTo(true); + assertThat(result.getViolatedRules()).isEmpty(); + assertThat(result.getFulfilledRules()).hasSize(6); + assertThat(result.isValid()).isTrue(); } @Test @@ -194,7 +188,7 @@ public void shouldUpdateUserDetailsWithoutPolicyCheck() { assertThat(user.getFirstName()).isEqualTo("Jane"); assertThat(user.getLastName()).isEqualTo("Donnel"); assertThat(user.getEmail()).isEqualTo("jane@donnel.com"); - assertThat(identityService.checkPassword("johndoe", "Passw0rds!")).isEqualTo(true); + assertThat(identityService.checkPassword("johndoe", "Passw0rds!")).isTrue(); identityService.deleteUser(user.getId()); } @@ -259,8 +253,8 @@ public void shouldCheckUserNull() { } private void checkThatPasswordWasInvalid(PasswordPolicyResult result) { - assertThat(result.getViolatedRules().size()).isEqualTo(1); - assertThat(result.getFulfilledRules().size()).isEqualTo(5); - assertThat(result.isValid()).isEqualTo(false); + assertThat(result.getViolatedRules()).hasSize(1); + assertThat(result.getFulfilledRules()).hasSize(5); + assertThat(result.isValid()).isFalse(); } } \ No newline at end of file diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/BpmnDiTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/BpmnDiTest.java index 3603098b979..7d751623dd8 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/BpmnDiTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/BpmnDiTest.java @@ -15,11 +15,12 @@ * limitations under the License. */ package org.operaton.bpm.model.bpmn; + import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.operaton.bpm.model.bpmn.instance.*; import org.operaton.bpm.model.bpmn.instance.Process; +import org.operaton.bpm.model.bpmn.instance.*; import org.operaton.bpm.model.bpmn.instance.bpmndi.*; import org.operaton.bpm.model.bpmn.instance.dc.Bounds; import org.operaton.bpm.model.bpmn.instance.dc.Font; diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/DataObjectsTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/DataObjectsTest.java index 64237633cc2..627534622e3 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/DataObjectsTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/DataObjectsTest.java @@ -60,7 +60,7 @@ void testDataObjectReferenceAsDataAssociationSource() { DataObjectReference dataObjectReference = modelInstance.getModelElementById("_dataRef_11"); DataInputAssociation dataInputAssociation = scriptTask.getDataInputAssociations().iterator().next(); Collection sources = dataInputAssociation.getSources(); - assertThat(sources.size()).isEqualTo(1); + assertThat(sources).hasSize(1); assertThat(sources.iterator().next()).isEqualTo(dataObjectReference); } diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ModelTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ModelTest.java index df1c8dbd37e..d84e78a8da2 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ModelTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ModelTest.java @@ -55,7 +55,7 @@ void testBaseTypeCalculation() { assertThat(allBaseTypes).hasSize(3); allBaseTypes = ModelUtil.calculateAllBaseTypes(model.getType(BaseElement.class)); - assertThat(allBaseTypes).hasSize(0); + assertThat(allBaseTypes).isEmpty(); } @Test diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/OperatonExtensionsTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/OperatonExtensionsTest.java index dc8bb754bfa..87dbb66dc66 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/OperatonExtensionsTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/OperatonExtensionsTest.java @@ -16,104 +16,19 @@ */ package org.operaton.bpm.model.bpmn; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.BUSINESS_RULE_TASK; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.CALL_ACTIVITY_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.END_EVENT_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.PROCESS_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.SCRIPT_TASK_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.SEND_TASK_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.SEQUENCE_FLOW_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.SERVICE_TASK_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.START_EVENT_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_CLASS_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_CLASS_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_DELEGATE_EXPRESSION_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_DELEGATE_EXPRESSION_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_DUE_DATE_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_DUE_DATE_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_EXECUTION_EVENT_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_EXECUTION_EVENT_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_EXPRESSION_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_EXPRESSION_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_FLOW_NODE_JOB_PRIORITY; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_GROUPS_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_GROUPS_LIST_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_GROUPS_LIST_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_GROUPS_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_HISTORY_TIME_TO_LIVE; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_PRIORITY_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_PRIORITY_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_PROCESS_JOB_PRIORITY; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_PROCESS_TASK_PRIORITY; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_SERVICE_TASK_PRIORITY; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_STRING_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_STRING_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_TASK_EVENT_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_TASK_EVENT_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_TYPE_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_TYPE_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_USERS_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_USERS_LIST_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_USERS_LIST_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_USERS_XML; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.USER_TASK_ID; -import static org.operaton.bpm.model.bpmn.impl.BpmnModelConstants.CAMUNDA_NS; -import static org.operaton.bpm.model.bpmn.impl.BpmnModelConstants.CAMUNDA_ATTRIBUTE_ERROR_CODE_VARIABLE; -import static org.operaton.bpm.model.bpmn.impl.BpmnModelConstants.CAMUNDA_ATTRIBUTE_ERROR_MESSAGE_VARIABLE; -import static org.operaton.bpm.model.bpmn.impl.BpmnModelConstants.OPERATON_NS; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; -import org.operaton.bpm.model.bpmn.instance.BaseElement; -import org.operaton.bpm.model.bpmn.instance.BpmnModelElementInstance; -import org.operaton.bpm.model.bpmn.instance.BusinessRuleTask; -import org.operaton.bpm.model.bpmn.instance.CallActivity; -import org.operaton.bpm.model.bpmn.instance.EndEvent; import org.operaton.bpm.model.bpmn.instance.Error; -import org.operaton.bpm.model.bpmn.instance.ErrorEventDefinition; -import org.operaton.bpm.model.bpmn.instance.Expression; -import org.operaton.bpm.model.bpmn.instance.MessageEventDefinition; -import org.operaton.bpm.model.bpmn.instance.ParallelGateway; import org.operaton.bpm.model.bpmn.instance.Process; -import org.operaton.bpm.model.bpmn.instance.ScriptTask; -import org.operaton.bpm.model.bpmn.instance.SendTask; -import org.operaton.bpm.model.bpmn.instance.SequenceFlow; -import org.operaton.bpm.model.bpmn.instance.ServiceTask; -import org.operaton.bpm.model.bpmn.instance.StartEvent; -import org.operaton.bpm.model.bpmn.instance.TimerEventDefinition; -import org.operaton.bpm.model.bpmn.instance.UserTask; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonConnector; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonConnectorId; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonConstraint; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonEntry; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonExecutionListener; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonFailedJobRetryTimeCycle; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonField; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonFormData; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonFormField; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonFormProperty; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonIn; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonInputOutput; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonInputParameter; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonList; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonMap; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonOut; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonOutputParameter; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonPotentialStarter; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonProperties; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonProperty; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonScript; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonTaskListener; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonValue; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; +import org.operaton.bpm.model.bpmn.instance.*; +import org.operaton.bpm.model.bpmn.instance.operaton.*; + +import java.util.*; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.bpm.model.bpmn.BpmnTestConstants.*; +import static org.operaton.bpm.model.bpmn.impl.BpmnModelConstants.*; /** * @author Sebastian Menski @@ -270,7 +185,7 @@ void testHistoryTimeToLive(String namespace, BpmnModelInstance modelInstance) { @ParameterizedTest(name = "Namespace: {0}") void testIsStartableInTasklist(String namespace, BpmnModelInstance modelInstance) { initOperatonExtensionsTest(namespace, modelInstance); - assertThat(process.isOperatonStartableInTasklist()).isEqualTo(false); + assertThat(process.isOperatonStartableInTasklist()).isFalse(); } @MethodSource("parameters") @@ -913,7 +828,7 @@ void testTaskListener(String namespace, BpmnModelInstance modelInstance) { assertThat(field.getOperatonString().getTextContent()).isEqualTo(TEST_STRING_XML); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/QueryTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/QueryTest.java index 9405fbb5b4b..8fdff05eed7 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/QueryTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/QueryTest.java @@ -87,13 +87,13 @@ void testFilterByType() { ModelElementType gatewayType = modelInstance.getModel().getType(Gateway.class); assertThat(startSucceeding.filterByType(taskType).list()).hasSize(1); - assertThat(startSucceeding.filterByType(gatewayType).list()).hasSize(0); + assertThat(startSucceeding.filterByType(gatewayType).list()).isEmpty(); assertThat(gateway1Succeeding.filterByType(taskType).list()).hasSize(1); assertThat(gateway1Succeeding.filterByType(gatewayType).list()).hasSize(1); assertThat(gateway2Succeeding.filterByType(taskType).list()).hasSize(3); - assertThat(gateway2Succeeding.filterByType(gatewayType).list()).hasSize(0); + assertThat(gateway2Succeeding.filterByType(gatewayType).list()).isEmpty(); } @Test diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ResourceRolesTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ResourceRolesTest.java index f711580a906..16484273de1 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ResourceRolesTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/ResourceRolesTest.java @@ -43,7 +43,7 @@ static void parseModel() { void testGetPerformer() { UserTask userTask = modelInstance.getModelElementById("_3"); Collection resourceRoles = userTask.getResourceRoles(); - assertThat(resourceRoles.size()).isEqualTo(1); + assertThat(resourceRoles).hasSize(1); ResourceRole resourceRole = resourceRoles.iterator().next(); assertThat(resourceRole instanceof Performer).isTrue(); assertThat(resourceRole.getName()).isEqualTo("Task performer"); @@ -53,7 +53,7 @@ void testGetPerformer() { void testGetHumanPerformer() { UserTask userTask = modelInstance.getModelElementById("_7"); Collection resourceRoles = userTask.getResourceRoles(); - assertThat(resourceRoles.size()).isEqualTo(1); + assertThat(resourceRoles).hasSize(1); ResourceRole resourceRole = resourceRoles.iterator().next(); assertThat(resourceRole instanceof HumanPerformer).isTrue(); assertThat(resourceRole.getName()).isEqualTo("Task human performer"); @@ -63,7 +63,7 @@ void testGetHumanPerformer() { void testGetPotentialOwner() { UserTask userTask = modelInstance.getModelElementById("_9"); Collection resourceRoles = userTask.getResourceRoles(); - assertThat(resourceRoles.size()).isEqualTo(1); + assertThat(resourceRoles).hasSize(1); ResourceRole resourceRole = resourceRoles.iterator().next(); assertThat(resourceRole instanceof PotentialOwner).isTrue(); assertThat(resourceRole.getName()).isEqualTo("Task potential owner"); diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/builder/ProcessBuilderTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/builder/ProcessBuilderTest.java index ce02ffeb818..e0585c9e32e 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/builder/ProcessBuilderTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/builder/ProcessBuilderTest.java @@ -16,121 +16,29 @@ */ package org.operaton.bpm.model.bpmn.builder; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.assertj.core.api.Fail.fail; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.BOUNDARY_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.CALL_ACTIVITY_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.CATCH_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.CONDITION_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.EXTERNAL_TASK_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.FORM_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.PROCESS_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.SERVICE_TASK_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.START_EVENT_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.SUB_PROCESS_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TASK_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_CLASS_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_CONDITION; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_CONDITIONAL_VARIABLE_EVENTS; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_CONDITIONAL_VARIABLE_EVENTS_LIST; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_CONDITIONAL_VARIABLE_NAME; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_DELEGATE_EXPRESSION_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_DUE_DATE_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_EXPRESSION_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_EXTERNAL_TASK_TOPIC; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_FOLLOW_UP_DATE_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_GROUPS_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_GROUPS_LIST_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_HISTORY_TIME_TO_LIVE; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_PRIORITY_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_PROCESS_TASK_PRIORITY; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_SERVICE_TASK_PRIORITY; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_STARTABLE_IN_TASKLIST; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_STRING_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_STRING_FORM_REF_BINDING; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_STRING_FORM_REF_VERSION; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_USERS_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_USERS_LIST_API; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TEST_VERSION_TAG; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.TRANSACTION_ID; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.USER_TASK_ID; -import static org.operaton.bpm.model.bpmn.impl.BpmnModelConstants.BPMN20_NS; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.operaton.bpm.model.bpmn.*; +import org.operaton.bpm.model.bpmn.instance.Error; +import org.operaton.bpm.model.bpmn.instance.Process; +import org.operaton.bpm.model.bpmn.instance.*; +import org.operaton.bpm.model.bpmn.instance.operaton.*; +import org.operaton.bpm.model.xml.Model; +import org.operaton.bpm.model.xml.instance.ModelElementInstance; +import org.operaton.bpm.model.xml.type.ModelElementType; import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.assertj.core.api.Assertions; -import org.operaton.bpm.model.bpmn.AssociationDirection; -import org.operaton.bpm.model.bpmn.Bpmn; -import org.operaton.bpm.model.bpmn.BpmnModelException; -import org.operaton.bpm.model.bpmn.BpmnModelInstance; -import org.operaton.bpm.model.bpmn.GatewayDirection; -import org.operaton.bpm.model.bpmn.TransactionMethod; -import org.operaton.bpm.model.bpmn.instance.Activity; -import org.operaton.bpm.model.bpmn.instance.Association; -import org.operaton.bpm.model.bpmn.instance.BaseElement; -import org.operaton.bpm.model.bpmn.instance.BoundaryEvent; -import org.operaton.bpm.model.bpmn.instance.BpmnModelElementInstance; -import org.operaton.bpm.model.bpmn.instance.BusinessRuleTask; -import org.operaton.bpm.model.bpmn.instance.CallActivity; -import org.operaton.bpm.model.bpmn.instance.CompensateEventDefinition; -import org.operaton.bpm.model.bpmn.instance.ConditionalEventDefinition; -import org.operaton.bpm.model.bpmn.instance.Definitions; -import org.operaton.bpm.model.bpmn.instance.Documentation; -import org.operaton.bpm.model.bpmn.instance.EndEvent; -import org.operaton.bpm.model.bpmn.instance.Error; -import org.operaton.bpm.model.bpmn.instance.ErrorEventDefinition; -import org.operaton.bpm.model.bpmn.instance.Escalation; -import org.operaton.bpm.model.bpmn.instance.EscalationEventDefinition; -import org.operaton.bpm.model.bpmn.instance.Event; -import org.operaton.bpm.model.bpmn.instance.EventDefinition; -import org.operaton.bpm.model.bpmn.instance.ExtensionElements; -import org.operaton.bpm.model.bpmn.instance.FlowElement; -import org.operaton.bpm.model.bpmn.instance.FlowNode; -import org.operaton.bpm.model.bpmn.instance.Gateway; -import org.operaton.bpm.model.bpmn.instance.InclusiveGateway; -import org.operaton.bpm.model.bpmn.instance.Message; -import org.operaton.bpm.model.bpmn.instance.MessageEventDefinition; -import org.operaton.bpm.model.bpmn.instance.MultiInstanceLoopCharacteristics; -import org.operaton.bpm.model.bpmn.instance.Process; -import org.operaton.bpm.model.bpmn.instance.ReceiveTask; -import org.operaton.bpm.model.bpmn.instance.ScriptTask; -import org.operaton.bpm.model.bpmn.instance.SendTask; -import org.operaton.bpm.model.bpmn.instance.SequenceFlow; -import org.operaton.bpm.model.bpmn.instance.ServiceTask; -import org.operaton.bpm.model.bpmn.instance.Signal; -import org.operaton.bpm.model.bpmn.instance.SignalEventDefinition; -import org.operaton.bpm.model.bpmn.instance.StartEvent; -import org.operaton.bpm.model.bpmn.instance.SubProcess; -import org.operaton.bpm.model.bpmn.instance.Task; -import org.operaton.bpm.model.bpmn.instance.TimeCycle; -import org.operaton.bpm.model.bpmn.instance.TimeDate; -import org.operaton.bpm.model.bpmn.instance.TimeDuration; -import org.operaton.bpm.model.bpmn.instance.TimerEventDefinition; -import org.operaton.bpm.model.bpmn.instance.Transaction; -import org.operaton.bpm.model.bpmn.instance.UserTask; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonErrorEventDefinition; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonExecutionListener; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonFailedJobRetryTimeCycle; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonFormData; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonFormField; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonIn; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonInputOutput; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonInputParameter; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonOut; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonOutputParameter; -import org.operaton.bpm.model.bpmn.instance.operaton.OperatonTaskListener; -import org.operaton.bpm.model.xml.Model; -import org.operaton.bpm.model.xml.instance.ModelElementInstance; -import org.operaton.bpm.model.xml.type.ModelElementType; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.assertj.core.api.Fail.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.operaton.bpm.model.bpmn.BpmnTestConstants.*; +import static org.operaton.bpm.model.bpmn.impl.BpmnModelConstants.BPMN20_NS; /** @@ -618,7 +526,7 @@ void testProcessStartableInTasklist() { .done(); Process process = modelInstance.getModelElementById(PROCESS_ID); - assertThat(process.isOperatonStartableInTasklist()).isEqualTo(true); + assertThat(process.isOperatonStartableInTasklist()).isTrue(); } @Test @@ -1668,7 +1576,7 @@ void testIntermediateSignalThrowEventWithPayloadLocalVar() { assertThat(signalEventDefinition.getSignal().getName()).isEqualTo("signal"); List operatonInParams = signalEventDefinition.getExtensionElements().getElementsQuery().filterByType(OperatonIn.class).list(); - assertThat(operatonInParams.size()).isEqualTo(4); + assertThat(operatonInParams).hasSize(4); int paramCounter = 0; for (OperatonIn inParam : operatonInParams) { @@ -1707,7 +1615,7 @@ void testIntermediateSignalThrowEventWithPayload() { SignalEventDefinition signalEventDefinition = assertAndGetSingleEventDefinition("throw", SignalEventDefinition.class); List operatonInParams = signalEventDefinition.getExtensionElements().getElementsQuery().filterByType(OperatonIn.class).list(); - assertThat(operatonInParams.size()).isEqualTo(1); + assertThat(operatonInParams).hasSize(1); assertThat(operatonInParams.get(0).getOperatonVariables()).isEqualTo("all"); } @@ -1873,7 +1781,7 @@ void testOperatonTimeoutCycleTaskListenerByClassName() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNotNull(); @@ -1901,7 +1809,7 @@ void testOperatonTimeoutDateTaskListenerByClassName() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -1929,7 +1837,7 @@ void testOperatonTimeoutDurationTaskListenerByClassName() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -1957,7 +1865,7 @@ void testOperatonTimeoutDurationTaskListenerByClass() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -1985,7 +1893,7 @@ void testOperatonTimeoutCycleTaskListenerByClass() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNotNull(); @@ -2013,7 +1921,7 @@ void testOperatonTimeoutDateTaskListenerByClass() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -2041,7 +1949,7 @@ void testOperatonTimeoutCycleTaskListenerByExpression() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNotNull(); @@ -2069,7 +1977,7 @@ void testOperatonTimeoutDateTaskListenerByExpression() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -2097,7 +2005,7 @@ void testOperatonTimeoutDurationTaskListenerByExpression() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -2125,7 +2033,7 @@ void testOperatonTimeoutCycleTaskListenerByDelegateExpression() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNotNull(); @@ -2153,7 +2061,7 @@ void testOperatonTimeoutDateTaskListenerByDelegateExpression() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -2181,7 +2089,7 @@ void testOperatonTimeoutDurationTaskListenerByDelegateExpression() { assertThat(taskListener.getOperatonEvent()).isEqualTo("timeout"); Collection timeouts = taskListener.getTimeouts(); - assertThat(timeouts.size()).isEqualTo(1); + assertThat(timeouts).hasSize(1); TimerEventDefinition timeout = timeouts.iterator().next(); assertThat(timeout.getTimeCycle()).isNull(); @@ -3566,11 +3474,11 @@ void testCreateEventSubProcess() { SubProcess subProcess = eventSubProcess.getElement(); // no input or output from the sub process - assertThat(subProcess.getIncoming().isEmpty()); - assertThat(subProcess.getOutgoing().isEmpty()); + assertThat(subProcess.getIncoming()).isEmpty(); + assertThat(subProcess.getOutgoing()).isEmpty(); // subProcess was triggered by event - assertThat(eventSubProcess.getElement().triggeredByEvent()); + assertThat(eventSubProcess.getElement().triggeredByEvent()).isTrue(); // subProcess contains startEvent, sendTask and endEvent assertThat(subProcess.getChildElementsByType(StartEvent.class)).isNotNull(); @@ -3607,11 +3515,11 @@ void testCreateEventSubProcessInSubProcess() { SubProcess eventSubProcess = modelInstance.getModelElementById("myeventsubprocess"); // no input or output from the sub process - assertThat(eventSubProcess.getIncoming().isEmpty()); - assertThat(eventSubProcess.getOutgoing().isEmpty()); + assertThat(eventSubProcess.getIncoming()).isEmpty(); + assertThat(eventSubProcess.getOutgoing()).isEmpty(); // subProcess was triggered by event - assertThat(eventSubProcess.triggeredByEvent()); + assertThat(eventSubProcess.triggeredByEvent()).isTrue(); // subProcess contains startEvent, sendTask and endEvent assertThat(eventSubProcess.getChildElementsByType(StartEvent.class)).isNotNull(); diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/instance/operaton/CompatabilityTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/instance/operaton/CompatabilityTest.java index b83cce9a3e2..180f7068bd5 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/instance/operaton/CompatabilityTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/instance/operaton/CompatabilityTest.java @@ -15,11 +15,6 @@ * limitations under the License. */ package org.operaton.bpm.model.bpmn.instance.operaton; -import static org.operaton.bpm.model.bpmn.BpmnTestConstants.PROCESS_ID; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.Collection; import org.junit.jupiter.api.Test; import org.operaton.bpm.model.bpmn.Bpmn; @@ -29,6 +24,11 @@ import org.operaton.bpm.model.bpmn.impl.instance.ProcessImpl; import org.operaton.bpm.model.bpmn.instance.ExtensionElements; +import java.util.Collection; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.bpm.model.bpmn.BpmnTestConstants.PROCESS_ID; + /** * Test to check the interoperability when changing elements and attributes with * the {@link BpmnModelConstants#CAMUNDA_NS}. In contrast to @@ -69,7 +69,7 @@ void modifyingAttributeWithActivitiNsKeepsIt() { assertThat(process.getAttributeValueNs(BpmnModelConstants.CAMUNDA_NS, "jobPriority")).isEqualTo(priority); assertThat(process.getAttributeValueNs(BpmnModelConstants.CAMUNDA_NS, "taskPriority")).isEqualTo(priority); assertThat(process.getAttributeValueNs(BpmnModelConstants.CAMUNDA_NS, "historyTimeToLive")).isEqualTo(historyTimeToLive.toString()); - assertThat(process.isOperatonStartableInTasklist()).isEqualTo(false); + assertThat(process.isOperatonStartableInTasklist()).isFalse(); assertThat(process.getOperatonVersionTag()).isEqualTo("v1.0.0"); } diff --git a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/validation/ValidateProcessTest.java b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/validation/ValidateProcessTest.java index 5e7a2931c6b..74e3b38cb98 100644 --- a/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/validation/ValidateProcessTest.java +++ b/model-api/bpmn-model/src/test/java/org/operaton/bpm/model/bpmn/validation/ValidateProcessTest.java @@ -51,13 +51,13 @@ void validationFailsIfNoStartEventFound() { assertThat(validationResults.hasErrors()).isTrue(); Map> results = validationResults.getResults(); - assertThat(results.size()).isEqualTo(1); + assertThat(results).hasSize(1); Process process = bpmnModelInstance.getDefinitions().getChildElementsByType(Process.class).iterator().next(); assertThat(results.containsKey(process)).isTrue(); List resultsForProcess = results.get(process); - assertThat(resultsForProcess.size()).isEqualTo(1); + assertThat(resultsForProcess).hasSize(1); ValidationResult validationResult = resultsForProcess.get(0); assertThat(validationResult.getElement()).isEqualTo(process); diff --git a/model-api/xml-model/src/main/java/org/operaton/bpm/model/xml/test/AbstractModelElementInstanceTest.java b/model-api/xml-model/src/main/java/org/operaton/bpm/model/xml/test/AbstractModelElementInstanceTest.java index 51a0f64b148..69ee799aa19 100644 --- a/model-api/xml-model/src/main/java/org/operaton/bpm/model/xml/test/AbstractModelElementInstanceTest.java +++ b/model-api/xml-model/src/main/java/org/operaton/bpm/model/xml/test/AbstractModelElementInstanceTest.java @@ -226,7 +226,7 @@ public void testChildElements() { assertThatType().hasNoChildElements(); } else { - assertThat(modelElementType.getChildElementTypes().size()).isEqualTo(childElementAssumptions.size()); + assertThat(modelElementType.getChildElementTypes()).hasSize(childElementAssumptions.size()); for (ChildElementAssumption assumption : childElementAssumptions) { assertThatType().hasChildElements(assumption.childElementType); if (assumption.namespaceUri != null) { diff --git a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/AlternativeNsTest.java b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/AlternativeNsTest.java index ae18ce8120a..e48f549673d 100644 --- a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/AlternativeNsTest.java +++ b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/AlternativeNsTest.java @@ -17,7 +17,6 @@ package org.operaton.bpm.model.xml.testmodel.instance; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -25,7 +24,6 @@ import org.operaton.bpm.model.xml.impl.ModelImpl; import org.operaton.bpm.model.xml.instance.DomElement; import org.operaton.bpm.model.xml.instance.ModelElementInstance; -import org.operaton.bpm.model.xml.instance.ModelElementInstanceTest; import org.operaton.bpm.model.xml.testmodel.Gender; import org.operaton.bpm.model.xml.testmodel.TestModelConstants; import org.operaton.bpm.model.xml.testmodel.TestModelTest; @@ -102,7 +100,7 @@ void getChildElementsByTypeForAlternativeNs(TestModelArgs args) { ModelElementInstance birdo = modelInstance.getModelElementById("birdo"); assertThat(birdo).isNotNull(); Collection elements = birdo.getChildElementsByType(Wings.class); - assertThat(elements.size()).isEqualTo(1); + assertThat(elements).hasSize(1); assertThat(elements.iterator().next().getTextContent()).isEqualTo("zisch"); } @@ -117,7 +115,7 @@ void getChildElementsByTypeForSecondAlternativeNs(TestModelArgs args) { Collection elements = donald.getChildElementsByType(Wings.class); // then - assertThat(elements.size()).isEqualTo(1); + assertThat(elements).hasSize(1); assertThat(elements.iterator().next().getTextContent()).isEqualTo("flappy"); } @@ -128,7 +126,7 @@ void getAttributeValueNsForAlternativeNs(TestModelArgs args) { Bird plucky = modelInstance.getModelElementById("plucky"); assertThat(plucky).isNotNull(); Boolean extendedWings = plucky.canHazExtendedWings(); - assertThat(extendedWings).isEqualTo(false); + assertThat(extendedWings).isFalse(); } @ParameterizedTest @@ -142,7 +140,7 @@ void getAttributeValueNsForSecondAlternativeNs(TestModelArgs args) { Boolean extendedWings = donald.canHazExtendedWings(); // then - assertThat(extendedWings).isEqualTo(true); + assertThat(extendedWings).isTrue(); } @ParameterizedTest @@ -153,7 +151,7 @@ void modifyingAttributeWithAlternativeNamespaceKeepsAlternativeNamespace(TestMod assertThat(plucky).isNotNull(); //validate old value Boolean extendedWings = plucky.canHazExtendedWings(); - assertThat(extendedWings).isEqualTo(false); + assertThat(extendedWings).isFalse(); //change it plucky.setCanHazExtendedWings(true); String attributeValueNs = plucky.getAttributeValueNs(MECHANICAL_NS, "canHazExtendedWings"); @@ -196,7 +194,7 @@ void modifyingElementWithAlternativeNamespaceKeepsAlternativeNamespace(TestModel wings.setTextContent("kawusch"); List childElementsByNameNs = birdo.getDomElement().getChildElementsByNameNs(MECHANICAL_NS, "wings"); - assertThat(childElementsByNameNs.size()).isEqualTo(1); + assertThat(childElementsByNameNs).hasSize(1); assertThat(childElementsByNameNs.get(0).getTextContent()).isEqualTo("kawusch"); } @@ -213,7 +211,7 @@ void modifyingElementWithSecondAlternativeNamespaceKeepsSecondAlternativeNamespa // then List childElementsByNameNs = donald.getDomElement().getChildElementsByNameNs(YET_ANOTHER_NS, "wings"); - assertThat(childElementsByNameNs.size()).isEqualTo(1); + assertThat(childElementsByNameNs).hasSize(1); assertThat(childElementsByNameNs.get(0).getTextContent()).isEqualTo("kawusch"); } @@ -225,7 +223,7 @@ void modifyingElementWithNewNamespaceKeepsNewNamespace(TestModelArgs args) { bird.setWings(modelInstance.newInstance(Wings.class)); List childElementsByNameNs = bird.getDomElement().getChildElementsByNameNs(TestModelConstants.NEWER_NAMESPACE, "wings"); - assertThat(childElementsByNameNs.size()).isEqualTo(1); + assertThat(childElementsByNameNs).hasSize(1); } @ParameterizedTest diff --git a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/UnknownAnimalTest.java b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/UnknownAnimalTest.java index dd873d2356b..046fed49d68 100644 --- a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/UnknownAnimalTest.java +++ b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/testmodel/instance/UnknownAnimalTest.java @@ -146,7 +146,7 @@ void testAddRelationshipDefinitionToUnknownAnimal() { @Test void testAddChildToUnknownAnimal() { - assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(0); + assertThat(wanda.getChildElementsByType(flipper.getElementType())).isEmpty(); wanda.insertElementAfter(flipper, null); assertThat(wanda.getChildElementsByType(flipper.getElementType())).hasSize(1); } diff --git a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/child/ChildElementCollectionTest.java b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/child/ChildElementCollectionTest.java index 395c145d143..4ae9df15e20 100644 --- a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/child/ChildElementCollectionTest.java +++ b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/child/ChildElementCollectionTest.java @@ -186,7 +186,7 @@ void testChildElementsCollection(TestModelArgs args) { Collection flightPartners = Arrays.asList(birdoRef, daisyRef, pluckyRef); // directly test collection methods and not use the appropriate assertion methods - assertThat(flightPartnerRefs.size()).isEqualTo(2); + assertThat(flightPartnerRefs).hasSize(2); assertThat(flightPartnerRefs.isEmpty()).isFalse(); assertThat(flightPartnerRefs.contains(daisyRef)); assertThat(flightPartnerRefs.toArray()).isEqualTo(new Object[]{daisyRef, pluckyRef}); diff --git a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/reference/ReferenceTest.java b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/reference/ReferenceTest.java index 17e3eef7d81..e3a86642caf 100644 --- a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/reference/ReferenceTest.java +++ b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/type/reference/ReferenceTest.java @@ -173,7 +173,7 @@ void testTargetElementsCollection(TestModelArgs args) { Collection flightPartners = Arrays.asList(new FlyingAnimal[]{birdo, daffy, daisy, plucky}); // directly test collection methods and not use the appropriate assertion methods - assertThat(referenceTargetElements.size()).isEqualTo(1); + assertThat(referenceTargetElements).hasSize(1); assertThat(referenceTargetElements.isEmpty()).isFalse(); assertThat(referenceTargetElements.contains(daffy)).isTrue(); assertThat(referenceTargetElements.toArray()).isEqualTo(new Object[]{daffy}); diff --git a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/validation/ModelValidationTest.java b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/validation/ModelValidationTest.java index 6f95c438ac3..fe608f4e37f 100644 --- a/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/validation/ModelValidationTest.java +++ b/model-api/xml-model/src/test/java/org/operaton/bpm/model/xml/validation/ModelValidationTest.java @@ -16,11 +16,6 @@ */ package org.operaton.bpm.model.xml.validation; -import static org.assertj.core.api.Assertions.*; - -import java.io.InputStream; -import java.io.StringWriter; -import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.operaton.bpm.model.xml.ModelInstance; @@ -28,6 +23,12 @@ import org.operaton.bpm.model.xml.testmodel.TestModelParser; import org.operaton.bpm.model.xml.testmodel.instance.Bird; +import java.io.InputStream; +import java.io.StringWriter; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + /** * @author Daniel Meyer */ @@ -60,7 +61,7 @@ void shouldCollectWarnings() { assertThat(results).isNotNull(); assertThat(results.hasErrors()).isFalse(); - assertThat(results.getErrorCount()).isEqualTo(0); + assertThat(results.getErrorCount()).isZero(); assertThat(results.getWarinigCount()).isEqualTo(7); } @@ -73,7 +74,7 @@ void shouldCollectErrors() { assertThat(results).isNotNull(); assertThat(results.hasErrors()).isTrue(); assertThat(results.getErrorCount()).isEqualTo(1); - assertThat(results.getWarinigCount()).isEqualTo(0); + assertThat(results.getWarinigCount()).isZero(); } @Test @@ -85,7 +86,7 @@ void shouldWriteResults() { StringWriter stringWriter = new StringWriter(); results.write(stringWriter, new TestResultFormatter()); - assertThat(stringWriter.toString()).isEqualTo("tweety\n\tERROR (20): Bird tweety is illegal\n"); + assertThat(stringWriter).hasToString("tweety\n\tERROR (20): Bird tweety is illegal\n"); } @Test @@ -149,7 +150,7 @@ void shouldReturnResults() { assertThat(results.getWarinigCount()).isEqualTo(7); var resultsByElement = results.getResults(); - assertThat(resultsByElement.size()).isEqualTo(7); + assertThat(resultsByElement).hasSize(7); for (var resultEntry : resultsByElement.entrySet()) { Bird element = (Bird) resultEntry.getKey(); @@ -158,14 +159,14 @@ void shouldReturnResults() { assertThat(validationResults).isNotNull(); if (element.getId().equals("tweety")) { - assertThat(validationResults.size()).isEqualTo(2); + assertThat(validationResults).hasSize(2); ValidationResult error = validationResults.remove(0); assertThat(error.getType()).isEqualTo(ValidationResultType.ERROR); assertThat(error.getCode()).isEqualTo(20); assertThat(error.getMessage()).isEqualTo("Bird tweety is illegal"); assertThat(error.getElement()).isEqualTo(element); } else { - assertThat(validationResults.size()).isEqualTo(1); + assertThat(validationResults).hasSize(1); } ValidationResult warning = validationResults.get(0); diff --git a/qa/integration-tests-engine/src/test/java/org/operaton/bpm/integrationtest/functional/spin/FeelEngineIT.java b/qa/integration-tests-engine/src/test/java/org/operaton/bpm/integrationtest/functional/spin/FeelEngineIT.java index e969238334d..20df5fbe4b5 100644 --- a/qa/integration-tests-engine/src/test/java/org/operaton/bpm/integrationtest/functional/spin/FeelEngineIT.java +++ b/qa/integration-tests-engine/src/test/java/org/operaton/bpm/integrationtest/functional/spin/FeelEngineIT.java @@ -16,16 +16,16 @@ */ package org.operaton.bpm.integrationtest.functional.spin; -import org.operaton.bpm.engine.history.HistoricDecisionInstance; -import org.operaton.bpm.engine.variable.VariableMap; -import org.operaton.bpm.engine.variable.Variables; -import org.operaton.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; -import org.operaton.spin.Spin; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Test; import org.junit.runner.RunWith; +import org.operaton.bpm.engine.history.HistoricDecisionInstance; +import org.operaton.bpm.engine.variable.VariableMap; +import org.operaton.bpm.engine.variable.Variables; +import org.operaton.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest; +import org.operaton.spin.Spin; import java.util.Arrays; import java.util.List; @@ -71,7 +71,7 @@ public void shouldExecuteProcessWithJSONVariableCorrectly() { .includeOutputs() .singleResult(); - assertThat(hdi.getOutputs().size()).isEqualTo(1); + assertThat(hdi.getOutputs()).hasSize(1); assertThat(hdi.getOutputs().get(0).getValue()).isEqualTo(true); } @@ -89,7 +89,7 @@ public void shouldExecuteProcessWithXMLVariableCorrectly() { .includeOutputs() .singleResult(); - assertThat(hdi.getOutputs().size()).isEqualTo(1); + assertThat(hdi.getOutputs()).hasSize(1); assertThat(hdi.getOutputs().get(0).getValue()).isEqualTo(true); } diff --git a/qa/large-data-tests/src/test/java/org/operaton/bpm/qa/largedata/optimize/OptimizeApiPageSizeTest.java b/qa/large-data-tests/src/test/java/org/operaton/bpm/qa/largedata/optimize/OptimizeApiPageSizeTest.java index c06d6c1176a..1cbc1ceafa4 100644 --- a/qa/large-data-tests/src/test/java/org/operaton/bpm/qa/largedata/optimize/OptimizeApiPageSizeTest.java +++ b/qa/large-data-tests/src/test/java/org/operaton/bpm/qa/largedata/optimize/OptimizeApiPageSizeTest.java @@ -57,7 +57,7 @@ public void databaseCanCopeWithPageSize(TestScenario scenario) { final List pageOfEntries = scenario.getOptimizeServiceFunction().apply(OPTIMIZE_PAGE_SIZE); // then - assertThat(pageOfEntries.size()).isEqualTo(OPTIMIZE_PAGE_SIZE); + assertThat(pageOfEntries).hasSize(OPTIMIZE_PAGE_SIZE); } private Object[] optimizeServiceFunctions() { diff --git a/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7170/pvm/AsyncJoinTest.java b/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7170/pvm/AsyncJoinTest.java index 7548a20edee..aa5a1f6b13d 100644 --- a/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7170/pvm/AsyncJoinTest.java +++ b/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7170/pvm/AsyncJoinTest.java @@ -64,7 +64,7 @@ public void shouldCompleteWithConcurrentExecution_ParallelGateway() { managementService.executeJob(jobIdNotifyListener.get()); // then - Assertions.assertThat(jobQuery.count()).isEqualTo(0); + Assertions.assertThat(jobQuery.count()).isZero(); Assertions.assertThat(engineRule.historicProcessInstance().getState()) .isEqualTo("COMPLETED"); } @@ -90,7 +90,7 @@ public void shouldCompleteWithConcurrentExecution_InclusiveGateway() { managementService.executeJob(jobIdNotifyListener.get()); // then - Assertions.assertThat(jobQuery.count()).isEqualTo(0); + Assertions.assertThat(jobQuery.count()).isZero(); Assertions.assertThat(engineRule.historicProcessInstance().getState()) .isEqualTo("COMPLETED"); } diff --git a/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7200/batch/SetRemovalTimeToProcessInstanceTest.java b/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7200/batch/SetRemovalTimeToProcessInstanceTest.java index 8ceceb94e01..1fdca442201 100644 --- a/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7200/batch/SetRemovalTimeToProcessInstanceTest.java +++ b/qa/test-db-instance-migration/test-migration/src/test/java/org/operaton/bpm/qa/upgrade/scenarios7200/batch/SetRemovalTimeToProcessInstanceTest.java @@ -84,7 +84,7 @@ public void shouldRunBatchJobOnce() { .singleResult(); assertThat(historicActivityInstance.getRemovalTime()).isEqualTo(removalTime); - assertThat(managementService.createJobQuery().jobDefinitionId(batch.getBatchJobDefinitionId()).count()).isEqualTo(0); + assertThat(managementService.createJobQuery().jobDefinitionId(batch.getBatchJobDefinitionId()).count()).isZero(); } } diff --git a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigFileTest.java b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigFileTest.java index 14cc0c57733..01894d512a9 100644 --- a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigFileTest.java +++ b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigFileTest.java @@ -16,21 +16,21 @@ */ package org.operaton.bpm.quarkus.engine.test.config; -import static org.assertj.core.api.Assertions.assertThat; - -import jakarta.inject.Inject; -import java.sql.SQLException; - import io.quarkus.test.QuarkusUnitTest; +import jakarta.inject.Inject; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import org.operaton.bpm.engine.ProcessEngine; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.operaton.bpm.engine.impl.jobexecutor.JobExecutor; import org.operaton.bpm.quarkus.engine.extension.OperatonEngineConfig; import org.operaton.bpm.quarkus.engine.test.helper.ProcessEngineAwareExtension; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; + +import java.sql.SQLException; + +import static org.assertj.core.api.Assertions.assertThat; public class OperatonEngineConfigFileTest { diff --git a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigurationConfigTest.java b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigurationConfigTest.java index 806775351b7..1f67fe58f64 100644 --- a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigurationConfigTest.java +++ b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineConfigurationConfigTest.java @@ -16,19 +16,18 @@ */ package org.operaton.bpm.quarkus.engine.test.config; -import static org.assertj.core.api.Assertions.assertThat; - -import jakarta.inject.Inject; - import io.quarkus.test.QuarkusUnitTest; -import org.operaton.bpm.engine.ProcessEngine; -import org.operaton.bpm.quarkus.engine.extension.OperatonEngineConfig; -import org.operaton.bpm.quarkus.engine.extension.QuarkusProcessEngineConfiguration; -import org.operaton.bpm.quarkus.engine.test.helper.ProcessEngineAwareExtension; +import jakarta.inject.Inject; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import org.operaton.bpm.engine.ProcessEngine; +import org.operaton.bpm.quarkus.engine.extension.OperatonEngineConfig; +import org.operaton.bpm.quarkus.engine.extension.QuarkusProcessEngineConfiguration; +import org.operaton.bpm.quarkus.engine.test.helper.ProcessEngineAwareExtension; + +import static org.assertj.core.api.Assertions.assertThat; public class OperatonEngineConfigurationConfigTest { @@ -62,8 +61,8 @@ public void shouldApplyProcessEngineConfigurationProperties() { = (QuarkusProcessEngineConfiguration) processEngine.getProcessEngineConfiguration(); // then - assertThat(configuration.isCmmnEnabled()).isEqualTo(false); - assertThat(configuration.isDmnEnabled()).isEqualTo(false); + assertThat(configuration.isCmmnEnabled()).isFalse(); + assertThat(configuration.isDmnEnabled()).isFalse(); assertThat(configuration.getHistory()).isEqualTo("none"); } diff --git a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineJobExecutorConfigTest.java b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineJobExecutorConfigTest.java index 6b44ab75cb2..865c0c1d5ab 100644 --- a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineJobExecutorConfigTest.java +++ b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineJobExecutorConfigTest.java @@ -16,17 +16,16 @@ */ package org.operaton.bpm.quarkus.engine.test.config; -import static org.assertj.core.api.Assertions.assertThat; - -import jakarta.inject.Inject; - import io.quarkus.test.QuarkusUnitTest; -import org.operaton.bpm.quarkus.engine.extension.OperatonEngineConfig; -import org.operaton.bpm.quarkus.engine.test.helper.ProcessEngineAwareExtension; +import jakarta.inject.Inject; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; +import org.operaton.bpm.quarkus.engine.extension.OperatonEngineConfig; +import org.operaton.bpm.quarkus.engine.test.helper.ProcessEngineAwareExtension; + +import static org.assertj.core.api.Assertions.assertThat; public class OperatonEngineJobExecutorConfigTest { diff --git a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineProgrammaticAndConfigFileTest.java b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineProgrammaticAndConfigFileTest.java index ab0a29dd672..3d819a20b92 100644 --- a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineProgrammaticAndConfigFileTest.java +++ b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/config/OperatonEngineProgrammaticAndConfigFileTest.java @@ -16,24 +16,24 @@ */ package org.operaton.bpm.quarkus.engine.test.config; -import static org.assertj.core.api.Assertions.assertThat; - +import io.quarkus.test.QuarkusUnitTest; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Produces; import jakarta.inject.Inject; -import java.sql.SQLException; - -import io.quarkus.test.QuarkusUnitTest; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import org.operaton.bpm.engine.ProcessEngine; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; import org.operaton.bpm.engine.impl.jobexecutor.JobExecutor; import org.operaton.bpm.quarkus.engine.extension.OperatonEngineConfig; import org.operaton.bpm.quarkus.engine.extension.QuarkusProcessEngineConfiguration; import org.operaton.bpm.quarkus.engine.test.helper.ProcessEngineAwareExtension; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; + +import java.sql.SQLException; + +import static org.assertj.core.api.Assertions.assertThat; public class OperatonEngineProgrammaticAndConfigFileTest { diff --git a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/id/ConfigureDbIdGeneratorTest.java b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/id/ConfigureDbIdGeneratorTest.java index 980341da8ff..76e61f061ec 100644 --- a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/id/ConfigureDbIdGeneratorTest.java +++ b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/id/ConfigureDbIdGeneratorTest.java @@ -17,6 +17,13 @@ package org.operaton.bpm.quarkus.engine.test.id; import io.quarkus.test.QuarkusUnitTest; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Inject; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; import org.operaton.bpm.engine.ProcessEngine; import org.operaton.bpm.engine.TaskService; import org.operaton.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl; @@ -24,18 +31,10 @@ import org.operaton.bpm.engine.task.Task; import org.operaton.bpm.quarkus.engine.extension.QuarkusProcessEngineConfiguration; import org.operaton.bpm.quarkus.engine.test.helper.ProcessEngineAwareExtension; -import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.spec.JavaArchive; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.inject.Produces; -import jakarta.inject.Inject; import static org.assertj.core.api.Assertions.assertThat; -public class ConfigureDbIdGeneratorTest { +class ConfigureDbIdGeneratorTest { @RegisterExtension static final QuarkusUnitTest unitTest = new ProcessEngineAwareExtension() @@ -59,12 +58,12 @@ public QuarkusProcessEngineConfiguration engineConfiguration() { } @Test - public void shouldConfigureDbIdGenerator() { + void shouldConfigureDbIdGenerator() { Task task = taskService.newTask(); taskService.saveTask(task); String id = taskService.createTaskQuery().singleResult().getId(); - assertThat(Long.parseLong(id)).isGreaterThan(0); + assertThat(Long.parseLong(id)).isPositive(); ProcessEngineConfigurationImpl engineConfig = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration(); diff --git a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/persistence/TransactionIntegrationTest.java b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/persistence/TransactionIntegrationTest.java index 4b6f5f2cf5d..c9272e5f908 100644 --- a/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/persistence/TransactionIntegrationTest.java +++ b/quarkus-extension/engine/deployment/src/test/java/org/operaton/bpm/quarkus/engine/test/persistence/TransactionIntegrationTest.java @@ -186,7 +186,7 @@ public void shouldRollbackInServiceTask() { // then Job job = managementService.createJobQuery().singleResult(); - assertThat(job.getRetries()).isEqualTo(0); + assertThat(job.getRetries()).isZero(); assertThat(job.getExceptionMessage()).isEqualTo("Unable to commit transaction"); String stacktrace = managementService.getJobExceptionStacktrace(job.getId()); @@ -205,7 +205,7 @@ public void shouldRollbackInServiceTaskWithCustomRetryCycle() { // then Job job = managementService.createJobQuery().singleResult(); - assertThat(job.getRetries()).isEqualTo(0); + assertThat(job.getRetries()).isZero(); assertThat(job.getExceptionMessage()).isEqualTo("Unable to commit transaction"); String stacktrace = managementService.getJobExceptionStacktrace(job.getId()); @@ -224,7 +224,7 @@ public void shouldRollbackOnExceptionInTransactionListener() { // then Job job = managementService.createJobQuery().singleResult(); - assertThat(job.getRetries()).isEqualTo(0); + assertThat(job.getRetries()).isZero(); assertThat(job.getExceptionMessage()).isEqualTo("Unable to commit transaction"); String stacktrace = managementService.getJobExceptionStacktrace(job.getId()); diff --git a/spin/core/src/test/java/org/operaton/spin/impl/util/RewindableReaderTest.java b/spin/core/src/test/java/org/operaton/spin/impl/util/RewindableReaderTest.java index db79417741d..39de9219ad4 100644 --- a/spin/core/src/test/java/org/operaton/spin/impl/util/RewindableReaderTest.java +++ b/spin/core/src/test/java/org/operaton/spin/impl/util/RewindableReaderTest.java @@ -16,16 +16,16 @@ */ package org.operaton.spin.impl.util; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; +import org.junit.After; +import org.junit.Test; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.util.Arrays; -import org.junit.After; -import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; public class RewindableReaderTest { diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/JsonTestConstants.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/JsonTestConstants.java index 385f21225ca..4fe473fec76 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/JsonTestConstants.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/JsonTestConstants.java @@ -98,7 +98,7 @@ public static void assertIsExampleOrder(Order order) { List customers = order.getCustomers(); assertThat(customers).isNotNull(); - assertThat(customers.size()).isEqualTo(3); + assertThat(customers).hasSize(3); assertThat(customers).extracting("name", "contractStartDate") .contains( diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeEditListPropertyTest.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeEditListPropertyTest.java index a99332f5d94..e579c879a22 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeEditListPropertyTest.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeEditListPropertyTest.java @@ -93,7 +93,7 @@ public void readIndexOfNonExistentValue() { public void readIndexOfExistentValue() { Integer i = currencies.indexOf("euro"); - assertThat(i).isEqualTo(0); + assertThat(i).isZero(); } // ----------------- 2) lastIndexOf ---------------------- diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathScriptTest.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathScriptTest.java index 2df988b52d6..b5a6a114d46 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathScriptTest.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathScriptTest.java @@ -16,9 +16,7 @@ */ package org.operaton.spin.json.tree; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; - +import org.junit.Test; import org.operaton.spin.SpinList; import org.operaton.spin.impl.test.Script; import org.operaton.spin.impl.test.ScriptTest; @@ -26,7 +24,9 @@ import org.operaton.spin.json.SpinJsonDataFormatException; import org.operaton.spin.json.SpinJsonNode; import org.operaton.spin.json.SpinJsonPathException; -import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.spin.json.JsonTestConstants.EXAMPLE_JSON_FILE_NAME; /** * @author Thorben Lindhauer @@ -110,11 +110,11 @@ public void shouldGetMultipleArrayEntries() { public void shouldGetFilteredResult() { SpinList nodeList = script.getVariable("emptyList"); - assertThat(nodeList.size()).isEqualTo(0); + assertThat(nodeList).isEmpty(); SpinList nodeList2 = script.getVariable("nodeList"); - assertThat(nodeList2.size()).isEqualTo(1); + assertThat(nodeList2).hasSize(1); assertThat(nodeList2.get(0).prop("name").stringValue()).isEqualTo("Waldo"); } diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathTest.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathTest.java index beb11a5e1ed..1acdeb8ab27 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathTest.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeJsonPathTest.java @@ -16,17 +16,17 @@ */ package org.operaton.spin.json.tree; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.operaton.spin.Spin.JSON; -import static org.operaton.spin.json.JsonTestConstants.EXAMPLE_JSON; - +import org.junit.Before; +import org.junit.Test; import org.operaton.spin.SpinList; import org.operaton.spin.json.SpinJsonDataFormatException; import org.operaton.spin.json.SpinJsonNode; import org.operaton.spin.json.SpinJsonPathException; -import org.junit.Before; -import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.operaton.spin.Spin.JSON; +import static org.operaton.spin.json.JsonTestConstants.EXAMPLE_JSON; /** * @author Stefan Hentschel @@ -88,8 +88,8 @@ public void shouldGetNullNode() { public void shouldGetSingleArrayEntry() { SpinJsonNode node = jsonNode.jsonPath("$.customers[0]").element(); - assertThat(node.isObject()); - assertThat(node.prop("name").isString()); + assertThat(node.isObject()).isTrue(); + assertThat(node.prop("name").isString()).isTrue(); assertThat(node.prop("name").stringValue()).isEqualTo("Kermit"); } @@ -106,11 +106,11 @@ public void shouldGetMultipleArrayEntries() { public void shouldGetFilteredResult() { SpinList nodeList = jsonNode.jsonPath("$.customers[?(@.name == 'Klo')]").elementList(); - assertThat(nodeList.size()).isEqualTo(0); + assertThat(nodeList).isEmpty(); nodeList = jsonNode.jsonPath("$.customers[?(@.name == 'Waldo')]").elementList(); - assertThat(nodeList.size()).isEqualTo(1); + assertThat(nodeList).hasSize(1); assertThat(nodeList.get(0).prop("name").stringValue()).isEqualTo("Waldo"); } diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaScriptTest.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaScriptTest.java index 98efd453cea..87bf1c3a9b3 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaScriptTest.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaScriptTest.java @@ -85,7 +85,7 @@ public void shouldMapListByCanonicalString() throws Throwable { List orders = script.execute(variables).getVariable("result"); - assertThat(orders.size()).isEqualTo(1); + assertThat(orders).hasSize(1); assertIsExampleOrder(orders.get(0)); } diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaTest.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaTest.java index 9a8ed51b84f..ff746fc86e5 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaTest.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeMapJsonToJavaTest.java @@ -69,7 +69,7 @@ public void shouldMapListByCanonicalString() throws JsonProcessingException { List orders = JSON(EXAMPLE_JSON_COLLECTION).mapTo(desiredType.toCanonical()); - assertThat(orders.size()).isEqualTo(1); + assertThat(orders).hasSize(1); assertIsExampleOrder(orders.get(0)); } diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyScriptTest.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyScriptTest.java index 3532a0461a4..9487314d94c 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyScriptTest.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyScriptTest.java @@ -232,7 +232,7 @@ public void shouldFailToReadStringValue() throws Throwable { public void shouldReadBooleanValue() { Boolean value1 = script.getVariable("value1"); - assertThat(value1).isEqualTo(true); + assertThat(value1).isTrue(); } @Test diff --git a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyTest.java b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyTest.java index 036a2c48d95..08e8638f058 100644 --- a/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyTest.java +++ b/spin/dataformat-json-jackson/src/test/java/org/operaton/spin/json/tree/JsonTreeReadPropertyTest.java @@ -16,19 +16,19 @@ */ package org.operaton.spin.json.tree; -import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.fail; -import static org.operaton.spin.Spin.JSON; -import static org.operaton.spin.json.JsonTestConstants.EXAMPLE_JSON; - +import org.junit.Before; +import org.junit.Test; import org.operaton.spin.SpinList; import org.operaton.spin.impl.util.SpinIoUtil; import org.operaton.spin.json.SpinJsonDataFormatException; import org.operaton.spin.json.SpinJsonNode; import org.operaton.spin.json.SpinJsonPropertyException; import org.operaton.spin.spi.SpinDataFormatException; -import org.junit.Before; -import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.operaton.spin.Spin.JSON; +import static org.operaton.spin.json.JsonTestConstants.EXAMPLE_JSON; /** * @author Stefan Hentschel diff --git a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/impl/xml/dom/format/DomXmlDataFormatWriterTest.java b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/impl/xml/dom/format/DomXmlDataFormatWriterTest.java index d2e78230569..d4e8561fe6a 100644 --- a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/impl/xml/dom/format/DomXmlDataFormatWriterTest.java +++ b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/impl/xml/dom/format/DomXmlDataFormatWriterTest.java @@ -16,22 +16,16 @@ */ package org.operaton.spin.impl.xml.dom.format; -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; +import org.junit.Test; import org.operaton.spin.DataFormats; import org.operaton.spin.SpinFactory; import org.operaton.spin.spi.DataFormat; import org.operaton.spin.xml.JdkUtil; import org.operaton.spin.xml.SpinXmlElement; -import org.junit.Test; + +import java.io.*; + +import static org.assertj.core.api.Assertions.assertThat; /** * Test xml transformation in DomXmlDataFormatWriter @@ -117,7 +111,7 @@ public void testStandardFormatter() throws Exception { SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); // then - assertThat(spinXmlElement.toString()).isEqualTo(getExpectedFormattedXML()); + assertThat(spinXmlElement).hasToString(getExpectedFormattedXML()); } /** @@ -143,7 +137,7 @@ public void testAlreadyFormattedXml() throws Exception { SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); // then - assertThat(spinXmlElement.toString()).isEqualTo(getExpectedFormattedXML()); + assertThat(spinXmlElement).hasToString(getExpectedFormattedXML()); } /** @@ -169,7 +163,7 @@ public void testDisabledPrettyPrintUnformatted() throws Exception { SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); // then - assertThat(spinXmlElement.toString()).isEqualTo(xml); + assertThat(spinXmlElement).hasToString(xml); } /** @@ -202,7 +196,7 @@ public void testDisabledPrettyPrintFormatted() throws Exception { SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); // then - assertThat(spinXmlElement.toString()).isEqualTo(expectedXml); + assertThat(spinXmlElement).hasToString(expectedXml); } /** @@ -232,6 +226,6 @@ public void testCustomStripSpaceXSL() throws Exception { final SpinXmlElement spinXmlElement = deserializeValue(serializedValue, dataFormat); // then - assertThat(spinXmlElement.toString()).isEqualTo(getExpectedFormattedXML(true)); + assertThat(spinXmlElement).hasToString(getExpectedFormattedXML(true)); } } diff --git a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/XmlTestConstants.java b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/XmlTestConstants.java index 8f25947c4d2..bf8e8e9077e 100644 --- a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/XmlTestConstants.java +++ b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/XmlTestConstants.java @@ -102,7 +102,7 @@ public static void assertIsExampleOrder(Order order) { List customers = order.getCustomer(); assertThat(customers).isNotNull(); - assertThat(customers.size()).isEqualTo(3); + assertThat(customers).hasSize(3); assertThat(customers).extracting("name", "contractStartDate") .contains( diff --git a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomAttributeTest.java b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomAttributeTest.java index 86a6266700e..eff56667ebe 100644 --- a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomAttributeTest.java +++ b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomAttributeTest.java @@ -16,17 +16,17 @@ */ package org.operaton.spin.xml.dom; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.spin.Spin.XML; - -import java.io.StringWriter; - +import org.junit.Before; +import org.junit.Test; import org.operaton.spin.xml.SpinXmlAttribute; import org.operaton.spin.xml.SpinXmlAttributeException; import org.operaton.spin.xml.SpinXmlElement; import org.operaton.spin.xml.XmlTestConstants; -import org.junit.Before; -import org.junit.Test; + +import java.io.StringWriter; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.spin.Spin.XML; /** * @author Sebastian Menski @@ -83,7 +83,7 @@ public void remove() { @Test public void canWriteToString() { - assertThat(attribute.toString()).isEqualTo("order1"); + assertThat(attribute).hasToString("order1"); } @Test diff --git a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathScriptTest.java b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathScriptTest.java index c93591ae89f..b3e991093a0 100644 --- a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathScriptTest.java +++ b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathScriptTest.java @@ -330,7 +330,7 @@ public void canQueryNumber() { public void canQueryNonExistingNumber() { SpinXPathQuery query = script.getVariable("query"); Double count = query.number(); - assertThat(count).isEqualTo(0); + assertThat(count).isZero(); } @Test diff --git a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathTest.java b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathTest.java index db2f59536cb..04ef35c7693 100644 --- a/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathTest.java +++ b/spin/dataformat-xml-dom/src/test/java/org/operaton/spin/xml/dom/XmlDomXPathTest.java @@ -160,7 +160,7 @@ public void canQueryNumber() { // can query not existing number count = element.xPath("count(/root/child/nonExisting)").number(); - assertThat(count).isEqualTo(0); + assertThat(count).isZero(); // can query number as document count = element.xPath("count(/)").number(); diff --git a/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/BasicAuthAndInterceptorConfigurationTest.java b/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/BasicAuthAndInterceptorConfigurationTest.java index 65021f94d59..9ec94dd4994 100644 --- a/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/BasicAuthAndInterceptorConfigurationTest.java +++ b/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/BasicAuthAndInterceptorConfigurationTest.java @@ -83,7 +83,7 @@ public void shouldVerifyBasicAuthAndInterceptors() { verify(clientBuilder, times(3)) .addInterceptor(interceptorCaptor.capture()); - assertThat(interceptorCaptor.getAllValues().size()).isEqualTo(3); + assertThat(interceptorCaptor.getAllValues()).hasSize(3); assertThat(interceptorCaptor.getAllValues()) .containsOnlyOnce(interceptorOne, interceptorTwo); assertThat(interceptorCaptor.getAllValues()) diff --git a/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/ClientConfigurationTest.java b/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/ClientConfigurationTest.java index cce67bd01d2..261d74a4ef3 100644 --- a/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/ClientConfigurationTest.java +++ b/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/client/ClientConfigurationTest.java @@ -43,13 +43,13 @@ public void shouldCheckProperties() { assertThat(properties.getBaseUrl()).isEqualTo("base-url"); assertThat(properties.getWorkerId()).isEqualTo("worker-id"); assertThat(properties.getMaxTasks()).isEqualTo(111); - assertThat(properties.getUsePriority()).isEqualTo(false); + assertThat(properties.getUsePriority()).isFalse(); assertThat(properties.getDefaultSerializationFormat()).isEqualTo("serialization-format"); assertThat(properties.getDateFormat()).isEqualTo("date-format"); assertThat(properties.getAsyncResponseTimeout()).isEqualTo(555); assertThat(properties.getLockDuration()).isEqualTo(777); - assertThat(properties.getDisableAutoFetching()).isEqualTo(true); - assertThat(properties.getDisableBackoffStrategy()).isEqualTo(true); + assertThat(properties.getDisableAutoFetching()).isTrue(); + assertThat(properties.getDisableBackoffStrategy()).isTrue(); assertThat(basicAuth.getUsername()).isEqualTo("username"); assertThat(basicAuth.getPassword()).isEqualTo("password"); assertThat(subscriptions).isEmpty(); diff --git a/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/it/ClientAutoConfigurationIT.java b/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/it/ClientAutoConfigurationIT.java index ed381eaea24..bc0a1e86a4a 100644 --- a/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/it/ClientAutoConfigurationIT.java +++ b/spring-boot-starter/starter-client/spring-boot/src/test/java/org/operaton/bpm/client/spring/boot/starter/it/ClientAutoConfigurationIT.java @@ -43,7 +43,7 @@ public class ClientAutoConfigurationIT { @Test public void startup() { - assertThat(topicSubscriptions.size()).isEqualTo(2); + assertThat(topicSubscriptions).hasSize(2); assertThat(topicSubscriptions) .extracting("topicName", "autoOpen", "businessKey", "lockDuration", "processDefinitionKey") .containsExactlyInAnyOrder( diff --git a/spring-boot-starter/starter-client/spring/src/test/java/org/operaton/bpm/client/spring/client/CustomClientTest.java b/spring-boot-starter/starter-client/spring/src/test/java/org/operaton/bpm/client/spring/client/CustomClientTest.java index e7a301b5049..3d5807992e5 100644 --- a/spring-boot-starter/starter-client/spring/src/test/java/org/operaton/bpm/client/spring/client/CustomClientTest.java +++ b/spring-boot-starter/starter-client/spring/src/test/java/org/operaton/bpm/client/spring/client/CustomClientTest.java @@ -46,7 +46,7 @@ public void shouldVerifyCustomClientPresent() { verify(clientBuilder).build(); verifyNoMoreInteractions(clientBuilder); - assertThat(clients.size()).isEqualTo(1); + assertThat(clients).hasSize(1); } } \ No newline at end of file diff --git a/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonIndexRedirectTest.java b/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonIndexRedirectTest.java index da6d0bb7bd6..e3fd976d58a 100644 --- a/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonIndexRedirectTest.java +++ b/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonIndexRedirectTest.java @@ -16,19 +16,20 @@ */ package org.operaton.bpm.spring.boot.starter.webapp.filter.redirect; -import static org.assertj.core.api.Assertions.assertThat; - -import java.net.HttpURLConnection; -import org.operaton.bpm.spring.boot.starter.webapp.filter.util.HttpClientRule; -import org.operaton.bpm.spring.boot.starter.webapp.filter.util.FilterTestApp; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.operaton.bpm.spring.boot.starter.webapp.filter.util.FilterTestApp; +import org.operaton.bpm.spring.boot.starter.webapp.filter.util.HttpClientRule; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; +import java.net.HttpURLConnection; + +import static org.assertj.core.api.Assertions.assertThat; + @RunWith(SpringRunner.class) @SpringBootTest(classes = { FilterTestApp.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, @@ -53,6 +54,6 @@ public void shouldRedirectRequestToTasklist_contextRoot() { // then // the request should have been redirected to Tasklist - assertThat(con.getURL().toString()).isEqualTo("http://localhost:" + port + "/operaton/app/tasklist/default/"); + assertThat(con.getURL()).hasToString("http://localhost:" + port + "/operaton/app/tasklist/default/"); } } diff --git a/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonTest.java b/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonTest.java index 617064a1bd7..d98100c8d8d 100644 --- a/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonTest.java +++ b/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathOperatonTest.java @@ -16,19 +16,20 @@ */ package org.operaton.bpm.spring.boot.starter.webapp.filter.redirect; -import static org.assertj.core.api.Assertions.assertThat; - -import java.net.HttpURLConnection; -import org.operaton.bpm.spring.boot.starter.webapp.filter.util.HttpClientRule; -import org.operaton.bpm.spring.boot.starter.webapp.filter.util.FilterTestApp; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.operaton.bpm.spring.boot.starter.webapp.filter.util.FilterTestApp; +import org.operaton.bpm.spring.boot.starter.webapp.filter.util.HttpClientRule; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; +import java.net.HttpURLConnection; + +import static org.assertj.core.api.Assertions.assertThat; + @RunWith(SpringRunner.class) @SpringBootTest(classes = { FilterTestApp.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, @@ -53,6 +54,6 @@ public void shouldRedirectRequestToTasklist_contextRoot() { // then // the request should have been redirected to Tasklist - assertThat(con.getURL().toString()).isEqualTo("http://localhost:" + port + "/operaton/app/tasklist/default/"); + assertThat(con.getURL()).hasToString("http://localhost:" + port + "/operaton/app/tasklist/default/"); } } diff --git a/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathRootIndexRedirectTest.java b/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathRootIndexRedirectTest.java index 3cc043b0e0f..6c9dd851ddd 100644 --- a/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathRootIndexRedirectTest.java +++ b/spring-boot-starter/starter-webapp-core/src/test/java/org/operaton/bpm/spring/boot/starter/webapp/filter/redirect/ResourceLoadingProcessEnginesAppPathRootIndexRedirectTest.java @@ -16,21 +16,21 @@ */ package org.operaton.bpm.spring.boot.starter.webapp.filter.redirect; -import static org.assertj.core.api.Assertions.assertThat; - -import java.io.IOException; -import java.net.HttpURLConnection; - -import org.operaton.bpm.spring.boot.starter.webapp.filter.util.HttpClientRule; -import org.operaton.bpm.spring.boot.starter.webapp.filter.util.FilterTestApp; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; +import org.operaton.bpm.spring.boot.starter.webapp.filter.util.FilterTestApp; +import org.operaton.bpm.spring.boot.starter.webapp.filter.util.HttpClientRule; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.server.LocalServerPort; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.junit4.SpringRunner; +import java.io.IOException; +import java.net.HttpURLConnection; + +import static org.assertj.core.api.Assertions.assertThat; + @RunWith(SpringRunner.class) @SpringBootTest(classes = { FilterTestApp.class}, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT, @@ -55,6 +55,6 @@ public void shouldRedirectToTasklist() throws IOException { // then // the request should have been redirected to Tasklist - assertThat(con.getURL().toString()).isEqualTo("http://localhost:" + port + "/app/tasklist/default/"); + assertThat(con.getURL()).hasToString("http://localhost:" + port + "/app/tasklist/default/"); } } diff --git a/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/configuration/impl/DefaultProcessEngineConfigurationTest.java b/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/configuration/impl/DefaultProcessEngineConfigurationTest.java index 919d325c069..ca286da4169 100644 --- a/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/configuration/impl/DefaultProcessEngineConfigurationTest.java +++ b/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/configuration/impl/DefaultProcessEngineConfigurationTest.java @@ -16,18 +16,18 @@ */ package org.operaton.bpm.spring.boot.starter.configuration.impl; -import static org.assertj.core.api.Assertions.assertThat; - +import org.junit.Before; +import org.junit.Test; import org.operaton.bpm.engine.ProcessEngines; import org.operaton.bpm.engine.impl.cfg.IdGenerator; import org.operaton.bpm.engine.spring.SpringProcessEngineConfiguration; import org.operaton.bpm.spring.boot.starter.property.OperatonBpmProperties; -import org.junit.Before; -import org.junit.Test; import org.springframework.test.util.ReflectionTestUtils; import java.util.Optional; +import static org.assertj.core.api.Assertions.assertThat; + public class DefaultProcessEngineConfigurationTest { private final DefaultProcessEngineConfiguration instance = new DefaultProcessEngineConfiguration(); @@ -93,11 +93,11 @@ public void setDefaultSerializationFormat_ignore_empty() { public void setJobExecutorAcquireByPriority() { properties.setJobExecutorAcquireByPriority(null); instance.preInit(configuration); - assertThat(configuration.isJobExecutorAcquireByPriority()).isEqualTo(false); + assertThat(configuration.isJobExecutorAcquireByPriority()).isFalse(); properties.setJobExecutorAcquireByPriority(true); instance.preInit(configuration); - assertThat(configuration.isJobExecutorAcquireByPriority()).isEqualTo(true); + assertThat(configuration.isJobExecutorAcquireByPriority()).isTrue(); } @Test diff --git a/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/JobExecutorPropertiesTest.java b/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/JobExecutorPropertiesTest.java index 956808f7041..7e4540e1681 100644 --- a/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/JobExecutorPropertiesTest.java +++ b/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/JobExecutorPropertiesTest.java @@ -16,10 +16,10 @@ */ package org.operaton.bpm.spring.boot.starter.property; -import static org.assertj.core.api.Assertions.assertThat; - import org.junit.Test; +import static org.assertj.core.api.Assertions.assertThat; + public class JobExecutorPropertiesTest extends ParsePropertiesHelper { @Test diff --git a/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/WebappPropertyTest.java b/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/WebappPropertyTest.java index df67b7d6ad7..a9ed6d44ee7 100644 --- a/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/WebappPropertyTest.java +++ b/spring-boot-starter/starter/src/test/java/org/operaton/bpm/spring/boot/starter/property/WebappPropertyTest.java @@ -82,7 +82,7 @@ public void testCsrfEntryPointsProperty() { assertThat(webapp.getCsrf().getEntryPoints()).isNotNull(); assertThat(webapp.getCsrf().getEntryPoints()).isNotEmpty(); assertThat(webapp.getCsrf().getEntryPoints()).isInstanceOf(List.class); - assertThat(webapp.getCsrf().getEntryPoints().size()).isEqualTo(2); + assertThat(webapp.getCsrf().getEntryPoints()).hasSize(2); assertThat(webapp.getCsrf().getEntryPoints().get(0)).isEqualTo("/api/engine/engine/default/history/task/count"); assertThat(webapp.getCsrf().getEntryPoints().get(1)).isEqualTo("/api/engine/engine/default/history/variable/count"); } diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/PluginQueryTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/PluginQueryTest.java index bf96cc53726..1199bbb2b1b 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/PluginQueryTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/PluginQueryTest.java @@ -36,6 +36,6 @@ public void testCustomQuery() { List result = getQueryService().executeQuery("cockpit.base.selectProcessDefinitionWithFailedJobs", new QueryParameters()); - assertThat(result).hasSize(0); + assertThat(result).isEmpty(); } } diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessDefinitionResourceTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessDefinitionResourceTest.java index 17d21ed9ada..90066efe98b 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessDefinitionResourceTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessDefinitionResourceTest.java @@ -486,7 +486,7 @@ public void testCalledProcessDefinitionQueryByInvalidBusinessKey() { List result1 = resource.queryCalledProcessDefinitions(queryParameter1); assertThat(result1).isEmpty(); - assertThat(result1).hasSize(0); + assertThat(result1).isEmpty(); } @@ -509,7 +509,7 @@ public void testQueryWithBooleanVariable() { List results = resource.queryCalledProcessDefinitions(queryParameter); // then - assertThat(results).hasSize(0); + assertThat(results).isEmpty(); } @Test @@ -574,7 +574,7 @@ public void testQueryWithStringVariable() { List results = resource.queryCalledProcessDefinitions(queryParameter); // then - assertThat(results).hasSize(0); + assertThat(results).isEmpty(); } @Test @@ -596,7 +596,7 @@ public void testQueryWithFloatVariable() { List results = resource.queryCalledProcessDefinitions(queryParameter); // then - assertThat(results).hasSize(0); + assertThat(results).isEmpty(); } @Test @@ -618,7 +618,7 @@ public void testQueryWithIntegerVariable() { List results = resource.queryCalledProcessDefinitions(queryParameter); // then - assertThat(results).hasSize(0); + assertThat(results).isEmpty(); } @Test diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessInstanceRestServiceTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessInstanceRestServiceTest.java index b1424daad72..5498268d43d 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessInstanceRestServiceTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/ProcessInstanceRestServiceTest.java @@ -436,7 +436,7 @@ public void testQueryWithBooleanVariable() { List results = resource.queryProcessInstances(parameter, 0, Integer.MAX_VALUE); // then - assertThat(results).hasSize(0); + assertThat(results).isEmpty(); } @Test @@ -456,7 +456,7 @@ public void testQueryWithStringVariable() { List results = resource.queryProcessInstances(parameter, 0, Integer.MAX_VALUE); // then - assertThat(results).hasSize(0); + assertThat(results).isEmpty(); } @Test @@ -476,7 +476,7 @@ public void testQueryWithFloatVariable() { List results = resource.queryProcessInstances(parameter, 0, Integer.MAX_VALUE); // then - assertThat(results).hasSize(0); + assertThat(results).isEmpty(); } @Test @@ -496,7 +496,7 @@ public void testQueryWithIntegerVariable() { List result = resource.queryProcessInstances(parameter, 0, Integer.MAX_VALUE); // then - assertThat(result).hasSize(0); + assertThat(result).isEmpty(); } @Test diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionResourceAuthorizationTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionResourceAuthorizationTest.java index db2483f835a..f3b69d769a0 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionResourceAuthorizationTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionResourceAuthorizationTest.java @@ -140,7 +140,7 @@ public void testCalledProcessDefinitionQueryWithMultipleReadPermissions() { List calledDefinitions = resource.queryCalledProcessDefinitions(queryParameter); // then - assertThat(calledDefinitions.size()).isEqualTo(1); + assertThat(calledDefinitions).hasSize(1); ProcessDefinitionDto calledProcessDefinition = calledDefinitions.get(0); assertThat(calledProcessDefinition.getKey()).isEqualTo(USER_TASK_PROCESS_KEY); diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionRestServiceAuthorizationTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionRestServiceAuthorizationTest.java index 731b1891b3b..a9b971885a8 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionRestServiceAuthorizationTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/authorization/ProcessDefinitionRestServiceAuthorizationTest.java @@ -132,7 +132,7 @@ public void getStatisticsCountWithoutAuthorization() { CountResultDto actual = resource.getStatisticsCount(uriInfo); // then - assertThat(actual.getCount()).isEqualTo(0); + assertThat(actual.getCount()).isZero(); } @Test diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/tenantcheck/ProcessInstanceRestServiceTenantCheckTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/tenantcheck/ProcessInstanceRestServiceTenantCheckTest.java index ad33ff8cfb4..1af89ea035b 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/tenantcheck/ProcessInstanceRestServiceTenantCheckTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/cockpit/plugin/base/tenantcheck/ProcessInstanceRestServiceTenantCheckTest.java @@ -89,7 +89,7 @@ public void queryCountNoAuthenticatedTenants() { CountResultDto result = resource.queryProcessInstancesCount(queryParameter); assertThat(result).isNotNull(); - assertThat(result.getCount()).isEqualTo(0); + assertThat(result.getCount()).isZero(); } @Test diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/auth/UserAuthenticationResourceLoggingTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/auth/UserAuthenticationResourceLoggingTest.java index 75470309380..764f2fb1586 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/auth/UserAuthenticationResourceLoggingTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/auth/UserAuthenticationResourceLoggingTest.java @@ -119,7 +119,7 @@ public void shouldNotProduceLogStatementOnValidLoginWhenDisabled() { // then List filteredLog = loggingRule.getFilteredLog("jonny"); - assertThat(filteredLog).hasSize(0); + assertThat(filteredLog).isEmpty(); } @Test @@ -160,7 +160,7 @@ public void shouldNotProduceLogStatementOnInvalidLoginWhenDisabled() { // then List filteredLog = loggingRule.getFilteredLog("jonny"); - assertThat(filteredLog).hasSize(0); + assertThat(filteredLog).isEmpty(); } @Test @@ -203,7 +203,7 @@ public void shouldNotProduceLogStatementOnLogoutWhenDisabled() { // then List filteredLog = loggingRule.getFilteredLog("jonny"); - assertThat(filteredLog).hasSize(0); + assertThat(filteredLog).isEmpty(); } @Test @@ -219,7 +219,7 @@ public void shouldNotProduceLogStatementOnLogoutWhenNoAuthentication() { // then List filteredLog = loggingRule.getFilteredLog("jonny"); - assertThat(filteredLog).hasSize(0); + assertThat(filteredLog).isEmpty(); } @Test @@ -291,7 +291,7 @@ public void shouldNotProduceLogStatementOnLoginWhenNotAuthorizedAndWebappsLoggin // then List filteredLog = loggingRule.getFilteredLog("jonny"); - assertThat(filteredLog).hasSize(0); + assertThat(filteredLog).isEmpty(); } protected void setAuthentication(String user, String engineName) { diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/filter/headersec/XssProtectionTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/filter/headersec/XssProtectionTest.java index 11cbd14795b..56fc3936647 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/filter/headersec/XssProtectionTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/webapp/impl/security/filter/headersec/XssProtectionTest.java @@ -16,16 +16,16 @@ */ package org.operaton.bpm.webapp.impl.security.filter.headersec; -import static org.assertj.core.api.Assertions.assertThat; -import static org.operaton.bpm.webapp.impl.security.filter.headersec.provider.impl.XssProtectionOption.BLOCK; -import static org.operaton.bpm.webapp.impl.security.filter.headersec.provider.impl.XssProtectionOption.SANITIZE; -import static org.operaton.bpm.webapp.impl.security.filter.headersec.provider.impl.XssProtectionProvider.HEADER_NAME; - import org.junit.Rule; import org.junit.Test; import org.operaton.bpm.engine.ProcessEngineException; import org.operaton.bpm.webapp.impl.util.HeaderRule; +import static org.assertj.core.api.Assertions.assertThat; +import static org.operaton.bpm.webapp.impl.security.filter.headersec.provider.impl.XssProtectionOption.BLOCK; +import static org.operaton.bpm.webapp.impl.security.filter.headersec.provider.impl.XssProtectionOption.SANITIZE; +import static org.operaton.bpm.webapp.impl.security.filter.headersec.provider.impl.XssProtectionProvider.HEADER_NAME; + /** * @author Tassilo Weidner */ @@ -55,7 +55,7 @@ public void shouldConfigureDisabled() { headerRule.performRequest(); // then - assertThat(headerRule.headerExists(HEADER_NAME)).isEqualTo(false); + assertThat(headerRule.headerExists(HEADER_NAME)).isFalse(); } @Test @@ -67,7 +67,7 @@ public void shouldConfigureDisabledIgnoreCase() { headerRule.performRequest(); // then - assertThat(headerRule.headerExists(HEADER_NAME)).isEqualTo(false); + assertThat(headerRule.headerExists(HEADER_NAME)).isFalse(); } @Test diff --git a/webapps/assembly/src/test/java/org/operaton/bpm/webapp/plugin/resource/AbstractAppPluginRootResourceTest.java b/webapps/assembly/src/test/java/org/operaton/bpm/webapp/plugin/resource/AbstractAppPluginRootResourceTest.java index ff06931f2d8..4d463214684 100644 --- a/webapps/assembly/src/test/java/org/operaton/bpm/webapp/plugin/resource/AbstractAppPluginRootResourceTest.java +++ b/webapps/assembly/src/test/java/org/operaton/bpm/webapp/plugin/resource/AbstractAppPluginRootResourceTest.java @@ -16,16 +16,16 @@ */ package org.operaton.bpm.webapp.plugin.resource; -import org.operaton.bpm.engine.rest.exception.RestException; -import org.operaton.bpm.webapp.AppRuntimeDelegate; -import org.operaton.bpm.webapp.plugin.AppPluginRegistry; -import org.operaton.bpm.webapp.plugin.spi.AppPlugin; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import org.mockito.Mockito; +import org.operaton.bpm.engine.rest.exception.RestException; +import org.operaton.bpm.webapp.AppRuntimeDelegate; +import org.operaton.bpm.webapp.plugin.AppPluginRegistry; +import org.operaton.bpm.webapp.plugin.spi.AppPlugin; import javax.servlet.ServletContext; import javax.servlet.ServletException; @@ -112,11 +112,11 @@ public void shouldGetAssetIfAllowed() throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); ((StreamingOutput) actual.getEntity()).write(output); - assertThat(output.toString()).isEqualTo(ASSET_CONTENT); + assertThat(output).hasToString(ASSET_CONTENT); assertThat(actual.getHeaders()).containsKey(HttpHeaders.CONTENT_TYPE).hasSize(1); assertThat(actual.getHeaders().get(HttpHeaders.CONTENT_TYPE)).hasSize(1); // In IDE it's String, with maven it's MediaType class - assertThat(actual.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0).toString()).isEqualTo(assetMediaType); + assertThat(actual.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)).hasToString(assetMediaType); Mockito.verify(runtimeDelegate).getAppPluginRegistry(); Mockito.verify(pluginRegistry).getPlugin(PLUGIN_NAME);