### Question:
Translator { static SetTypeDefaultVersionRequest translateToUpdateRequest(@NonNull final ResourceModel model) { if (model.getArn() != null) { return SetTypeDefaultVersionRequest.builder() .arn(model.getArn()) .build(); } else { return SetTypeDefaultVersionRequest.builder() .type(RegistryType.RESOURCE) .typeName(model.getTypeName()) .versionId(model.getVersionId()) .build(); } }    }### Answer:
@Test public void translateToUpdateRequest_nullResourceModel() { assertThatThrownBy(() -> Translator.translateToUpdateRequest(null)) .hasNoCause() .hasMessageStartingWith("model is marked") .isExactlyInstanceOf(NullPointerException.class); }
@Test public void translateToUpdateRequest_typeAndVersion() { ResourceModel model = ResourceModel.builder() .typeName("AWS::Test::Resource") .versionId("00000002") .build(); SetTypeDefaultVersionRequest request = Translator.translateToUpdateRequest(model); assertThat(request.arn()).isNull(); assertThat(request.type()).isEqualTo(RegistryType.RESOURCE); assertThat(request.typeName()).isEqualTo("AWS::Test::Resource"); assertThat(request.versionId()).isEqualTo("00000002"); }
@Test public void translateToUpdateRequest_arn() { ResourceModel model = ResourceModel.builder() .arn("arn:aws:cloudformation:us-west-2:123456789012:type/resource/AWS-Test-Resource/00000002") .versionId("00000002") .build(); SetTypeDefaultVersionRequest request = Translator.translateToUpdateRequest(model); assertThat(request.arn()).isEqualTo("arn:aws:cloudformation:us-west-2:123456789012:type/resource/AWS-Test-Resource/00000002"); assertThat(request.type()).isNull(); assertThat(request.typeName()).isNull(); assertThat(request.versionId()).isNull(); }