### Question:
Translator { static RegisterTypeRequest translateToCreateRequest(@NonNull final ResourceModel model) { final RegisterTypeRequest.Builder builder = RegisterTypeRequest.builder() .executionRoleArn(model.getExecutionRoleArn()) .schemaHandlerPackage(model.getSchemaHandlerPackage()) .type(RegistryType.RESOURCE) .typeName(model.getTypeName()); if (model.getLoggingConfig() != null) { builder.loggingConfig(translateToSDK(model.getLoggingConfig())); } return builder.build(); }    }### Answer:
@Test public void translateToCreateRequest_nullResourceModel() { assertThatThrownBy(() -> Translator.translateToCreateRequest(null)) .hasNoCause() .hasMessageStartingWith("model is marked") .isExactlyInstanceOf(NullPointerException.class); }
@Test public void translateToCreateRequest_nullLoggingConfig() { ResourceModel model = ResourceModel.builder() .executionRoleArn("arn:aws:iam::123456789012:role/AppRole") .schemaHandlerPackage("example-bucket/some/path/code.zip") .typeName("AWS::Test::Resource") .build(); RegisterTypeRequest request = Translator.translateToCreateRequest(model); assertThat(request.executionRoleArn()).isEqualTo(model.getExecutionRoleArn()); assertThat(request.loggingConfig()).isNull(); assertThat(request.schemaHandlerPackage()).isEqualTo(model.getSchemaHandlerPackage()); assertThat(request.type()).isEqualTo(RegistryType.RESOURCE); assertThat(request.typeName()).isEqualTo(model.getTypeName()); }
@Test public void translateToCreateRequest_withLoggingConfig() { LoggingConfig loggingConfig = LoggingConfig.builder() .logGroupName("my-group") .logRoleArn("arn:aws:iam::123456789012:role/LoggingRole") .build(); ResourceModel model = ResourceModel.builder() .executionRoleArn("arn:aws:iam::123456789012:role/AppRole") .loggingConfig(loggingConfig) .schemaHandlerPackage("example-bucket/some/path/code.zip") .typeName("AWS::Test::Resource") .build(); RegisterTypeRequest request = Translator.translateToCreateRequest(model); assertThat(request.executionRoleArn()).isEqualTo(model.getExecutionRoleArn()); assertThat(request.loggingConfig().logGroupName()).isEqualTo(loggingConfig.getLogGroupName()); assertThat(request.loggingConfig().logRoleArn()).isEqualTo(loggingConfig.getLogRoleArn()); assertThat(request.schemaHandlerPackage()).isEqualTo(model.getSchemaHandlerPackage()); assertThat(request.type()).isEqualTo(RegistryType.RESOURCE); assertThat(request.typeName()).isEqualTo(model.getTypeName()); }