2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2022-2023 Nordix Foundation
4 * Modifications Copyright (C) 2023 TechMahindra Ltd.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
22 package org.onap.cps.spi
24 import spock.lang.Specification
26 class PaginationOptionSpec extends Specification {
28 def 'Pagination validation with: #scenario'() {
29 given: 'pagination option with pageIndex and pageSize'
30 def paginationOption = new PaginationOption(pageIndex, pageSize)
31 expect: 'validation returns expected result'
32 assert paginationOption.isValidPaginationOption() == expectedIsValidPaginationOption
33 where: 'following parameters are used'
34 scenario | pageIndex | pageSize || expectedIsValidPaginationOption
35 'valid pagination' | 1 | 1 || true
36 'negative index' | -1 | 1 || false
37 'negative size' | 1 | -1 || false
38 'zero index' | 0 | 1 || false
39 'zero size' | 1 | 0 || false