diff --git a/src/test/java/net/masterthought/cucumber/json/EmbeddingTest.java b/src/test/java/net/masterthought/cucumber/json/EmbeddingTest.java index 01c410192..6e491e9bd 100644 --- a/src/test/java/net/masterthought/cucumber/json/EmbeddingTest.java +++ b/src/test/java/net/masterthought/cucumber/json/EmbeddingTest.java @@ -133,6 +133,23 @@ public void getExtension_ReturnsFileExtension() { assertThat(actualExtension).isEqualTo(this.fileName.split("\\.")[1]); } + @Test + public void getExtension_UsesExtensionFromNameWhenMIMETypeIsUnknown() { + // Arrange + String mimeType = "unknown/mimetype"; + String data = "c29tZSBkYXRh"; + String name = "example.docx"; + + // Creating an embedding here with an unknown MIME type and a name containing a file extension + Embedding embedding = new Embedding(mimeType, data, name); + + // Act + String actualExtension = embedding.getExtension(); + + // Assert + assertThat(actualExtension).isEqualTo("docx"); + } + @Test public void getName_ReturnsNull() { // given