ATS-531 : Reformat code

This commit is contained in:
Cezar.Leahu
2019-08-14 22:21:06 +03:00
committed by CezarLeahu
parent 70ab0241dd
commit 485347729b
58 changed files with 1310 additions and 1074 deletions

View File

@@ -94,15 +94,19 @@ public class LibreOfficeControllerTest extends AbstractTransformerControllerTest
// The following is based on super.mockTransformCommand(...)
// This is because LibreOffice used JodConverter rather than a RuntimeExec
expectedSourceFileBytes = Files.readAllBytes(getTestFile("quick." + sourceExtension, true).toPath());
expectedTargetFileBytes = Files.readAllBytes(getTestFile("quick." + targetExtension, true).toPath());
sourceFile = new MockMultipartFile("file", "quick." + sourceExtension, sourceMimetype, expectedSourceFileBytes);
expectedSourceFileBytes = Files.readAllBytes(
getTestFile("quick." + sourceExtension, true).toPath());
expectedTargetFileBytes = Files.readAllBytes(
getTestFile("quick." + targetExtension, true).toPath());
sourceFile = new MockMultipartFile("file", "quick." + sourceExtension, sourceMimetype,
expectedSourceFileBytes);
doAnswer(invocation ->
{
File sourceFile = invocation.getArgument(0);
File targetFile = invocation.getArgument(1);
String actualTargetExtension = StringUtils.getFilenameExtension(targetFile.getAbsolutePath());
String actualTargetExtension = StringUtils.getFilenameExtension(
targetFile.getAbsolutePath());
assertNotNull(sourceFile);
assertNotNull(targetFile);
@@ -119,7 +123,8 @@ public class LibreOfficeControllerTest extends AbstractTransformerControllerTest
// Check the supplied source file has not been changed.
byte[] actualSourceFileBytes = Files.readAllBytes(sourceFile.toPath());
assertTrue("Source file is not the same", Arrays.equals(expectedSourceFileBytes, actualSourceFileBytes));
assertTrue("Source file is not the same",
Arrays.equals(expectedSourceFileBytes, actualSourceFileBytes));
return null;
}).when(javaExecutor).convert(any(), any());
@@ -143,11 +148,14 @@ public class LibreOfficeControllerTest extends AbstractTransformerControllerTest
{
doThrow(OfficeException.class).when(javaExecutor).convert(any(), any());
mockMvc.perform(MockMvcRequestBuilders.multipart("/transform")
.file(sourceFile)
.param("targetExtension", "xxx"))
.andExpect(status().is(400))
.andExpect(status().reason(containsString("LibreOffice - LibreOffice server conversion failed:")));
mockMvc
.perform(MockMvcRequestBuilders
.multipart("/transform")
.file(sourceFile)
.param("targetExtension", "xxx"))
.andExpect(status().is(400))
.andExpect(status().reason(
containsString("LibreOffice - LibreOffice server conversion failed:")));
}
@Override

View File

@@ -47,7 +47,8 @@ public class LibreOfficeQueueTransformServiceIT extends AbstractQueueTransformSe
@Override
protected TransformRequest buildRequest()
{
return TransformRequest.builder()
return TransformRequest
.builder()
.withRequestId(UUID.randomUUID().toString())
.withSourceMediaType(MIMETYPE_OPENXML_WORDPROCESSING)
.withTargetMediaType(MIMETYPE_OPENXML_WORDPROCESSING)