### Question:
Translator { static DeregisterTypeRequest translateToDeleteRequest(@NonNull final ResourceModel model, @NonNull final Logger logger) { if (model.getIsDefaultVersion()) { logger.log("De-registering default version"); return DeregisterTypeRequest.builder() .type(RegistryType.RESOURCE) .typeName(model.getTypeName()) .build(); } else { logger.log("De-registering version"); return DeregisterTypeRequest.builder() .arn(model.getArn()) .build(); } }    }### Answer:
@Test public void translateToDeleteRequest_nullResourceModel() { assertThatThrownBy(() -> Translator.translateToDeleteRequest(null, logger)) .hasNoCause() .hasMessageStartingWith("model is marked") .isExactlyInstanceOf(NullPointerException.class); }
@Test public void translateToDeleteRequest_defaultVersion() { ResourceModel model = ResourceModel.builder() .isDefaultVersion(true) .typeName("AWS::Test::Resource") .build(); DeregisterTypeRequest request = Translator.translateToDeleteRequest(model, logger); assertThat(request.arn()).isNull(); assertThat(request.type()).isEqualTo(RegistryType.RESOURCE); assertThat(request.typeName()).isEqualTo(model.getTypeName()); }
@Test public void translateToCreateRequest_notDefaultVersion() { ResourceModel model = ResourceModel.builder() .isDefaultVersion(false) .arn("arn:aws:cloudformation:us-west-2:123456789012:type/resource/AWS-Test-Resource") .build(); DeregisterTypeRequest request = Translator.translateToDeleteRequest(model, logger); assertThat(request.arn()).isEqualTo(model.getArn()); assertThat(request.type()).isNull(); assertThat(request.typeName()).isNull(); }