|
| 1 | +/* |
| 2 | + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | + * You may not use this file except in compliance with the License. |
| 6 | + * A copy of the License is located at |
| 7 | + * |
| 8 | + * http://aws.amazon.com/apache2.0 |
| 9 | + * |
| 10 | + * or in the "license" file accompanying this file. This file is distributed |
| 11 | + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | + * express or implied. See the License for the specific language governing |
| 13 | + * permissions and limitations under the License. |
| 14 | + */ |
| 15 | + |
| 16 | +package software.amazon.awssdk.codegen.poet.paginators; |
| 17 | + |
| 18 | +import static org.assertj.core.api.Assertions.assertThatThrownBy; |
| 19 | + |
| 20 | +import com.squareup.javapoet.ClassName; |
| 21 | +import com.squareup.javapoet.TypeSpec; |
| 22 | +import org.junit.jupiter.api.Test; |
| 23 | +import software.amazon.awssdk.codegen.model.intermediate.IntermediateModel; |
| 24 | +import software.amazon.awssdk.codegen.model.service.PaginatorDefinition; |
| 25 | +import software.amazon.awssdk.codegen.poet.ClientTestModels; |
| 26 | + |
| 27 | +public class PaginatorsClassSpecTest { |
| 28 | + @Test |
| 29 | + public void constructor_unknownOperationName_throws() { |
| 30 | + assertThatThrownBy(() -> new TestPaginatorSpec(ClientTestModels.awsJsonServiceModels(), |
| 31 | + "~~DoesNotExist", |
| 32 | + new PaginatorDefinition())) |
| 33 | + .isInstanceOf(IllegalArgumentException.class) |
| 34 | + .hasMessageContaining("The service model does not model an operation '~~DoesNotExist'"); |
| 35 | + } |
| 36 | + |
| 37 | + private static class TestPaginatorSpec extends PaginatorsClassSpec { |
| 38 | + TestPaginatorSpec(IntermediateModel model, String c2jOperationName, PaginatorDefinition paginatorDefinition) { |
| 39 | + super(model, c2jOperationName, paginatorDefinition); |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + public TypeSpec poetSpec() { |
| 44 | + throw new UnsupportedOperationException(); |
| 45 | + } |
| 46 | + |
| 47 | + @Override |
| 48 | + public ClassName className() { |
| 49 | + throw new UnsupportedOperationException(); |
| 50 | + } |
| 51 | + } |
| 52 | +} |
0 commit comments