2 * Copyright (C) The Arvados Authors. All rights reserved.
4 * SPDX-License-Identifier: AGPL-3.0 OR Apache-2.0
8 package org.arvados.client.utils;
10 import org.arvados.client.test.utils.FileTestUtils;
11 import org.junit.After;
12 import org.junit.Before;
13 import org.junit.Test;
16 import java.util.List;
18 import static org.arvados.client.test.utils.FileTestUtils.*;
19 import static org.assertj.core.api.Assertions.assertThat;
21 public class FileMergeTest {
24 public void setUp() throws Exception {
25 FileTestUtils.createDirectory(FILE_SPLIT_TEST_DIR);
29 public void fileChunksAreMergedIntoOneFile() throws Exception {
32 FileTestUtils.generateFile(TEST_FILE, FileTestUtils.ONE_EIGTH_GB);
34 List<File> files = FileSplit.split(new File(TEST_FILE), new File(FILE_SPLIT_TEST_DIR), FILE_SPLIT_SIZE);
35 File targetFile = new File(TEST_FILE);
38 FileMerge.merge(files, targetFile);
41 assertThat(targetFile.length()).isEqualTo(FileTestUtils.ONE_EIGTH_GB);
45 public void tearDown() throws Exception {
46 FileTestUtils.cleanDirectory(FILE_SPLIT_TEST_DIR);