mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-07-31 17:38:33 +00:00
REPO-3424 More unit tests and pick up latest alfresco-core (7.2)
This commit is contained in:
@@ -26,13 +26,17 @@
|
||||
package org.alfresco.transformer;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
|
||||
import org.springframework.boot.test.mock.mockito.SpyBean;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
|
||||
|
||||
/**
|
||||
* Test the AlfrescoPdfRendererControllerTest without a server.
|
||||
* Super class includes tests for the AbstractTransformerController.
|
||||
@@ -49,4 +53,44 @@ public class AlfrescoPdfRendererControllerTest extends AbstractTransformerContro
|
||||
{
|
||||
super.mockTransformCommand(controller, "pdf", "png", "application/pdf");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionsTest() throws Exception
|
||||
{
|
||||
expectedOptions = "--width=321 --height=654 --allow-enlargement --maintain-aspect-ratio --page=2";
|
||||
mockMvc.perform(MockMvcRequestBuilders.fileUpload("/transform")
|
||||
.file(sourceFile)
|
||||
.param("targetExtension", targetExtension)
|
||||
|
||||
.param("page", "2")
|
||||
|
||||
.param("width", "321")
|
||||
.param("height", "654")
|
||||
.param("allowEnlargement", "true")
|
||||
.param("maintainAspectRatio", "true"))
|
||||
|
||||
.andExpect(status().is(200))
|
||||
.andExpect(content().bytes(expectedTargetFileBytes))
|
||||
.andExpect(header().string("Content-Disposition", "attachment; filename*= UTF-8''quick."+targetExtension));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionsNegateBooleansTest() throws Exception
|
||||
{
|
||||
expectedOptions = "--width=321 --height=654 --page=2";
|
||||
mockMvc.perform(MockMvcRequestBuilders.fileUpload("/transform")
|
||||
.file(sourceFile)
|
||||
.param("targetExtension", targetExtension)
|
||||
|
||||
.param("page", "2")
|
||||
|
||||
.param("width", "321")
|
||||
.param("height", "654")
|
||||
.param("allowEnlargement", "false")
|
||||
.param("maintainAspectRatio", "false"))
|
||||
|
||||
.andExpect(status().is(200))
|
||||
.andExpect(content().bytes(expectedTargetFileBytes))
|
||||
.andExpect(header().string("Content-Disposition", "attachment; filename*= UTF-8''quick."+targetExtension));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user