16470: Fixes deprecation warning.
[arvados.git] / sdk / java-v2 / src / test / java / org / arvados / client / utils / FileMergeTest.java
1 /*
2  * Copyright (C) The Arvados Authors. All rights reserved.
3  *
4  * SPDX-License-Identifier: AGPL-3.0 OR Apache-2.0
5  *
6  */
7
8 package org.arvados.client.utils;
9
10 import org.arvados.client.test.utils.FileTestUtils;
11 import org.junit.After;
12 import org.junit.Before;
13 import org.junit.Test;
14
15 import java.io.File;
16 import java.util.List;
17
18 import static org.arvados.client.test.utils.FileTestUtils.*;
19 import static org.assertj.core.api.Assertions.assertThat;
20
21 public class FileMergeTest {
22
23     @Before
24     public void setUp() throws Exception {
25         FileTestUtils.createDirectory(FILE_SPLIT_TEST_DIR);
26     }
27
28     @Test
29     public void fileChunksAreMergedIntoOneFile() throws Exception {
30
31         // given
32         FileTestUtils.generateFile(TEST_FILE, FileTestUtils.ONE_EIGTH_GB);
33
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);
36
37         // when
38         FileMerge.merge(files, targetFile);
39
40         // then
41         assertThat(targetFile.length()).isEqualTo(FileTestUtils.ONE_EIGTH_GB);
42     }
43
44     @After
45     public void tearDown() throws Exception {
46         FileTestUtils.cleanDirectory(FILE_SPLIT_TEST_DIR);
47     }
48 }