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 FileSplitTest {
24 public void setUp() throws Exception {
25 FileTestUtils.createDirectory(FILE_SPLIT_TEST_DIR);
29 public void fileIsDividedIntoSmallerChunks() throws Exception {
33 int expectedFileSizeInBytes = 67108864;
34 FileTestUtils.generateFile(TEST_FILE, FileTestUtils.ONE_EIGTH_GB);
37 List<File> actual = FileSplit.split(new File(TEST_FILE), new File(FILE_SPLIT_TEST_DIR), FILE_SPLIT_SIZE);
40 assertThat(actual).hasSize(expectedSize);
41 assertThat(actual).allMatch(a -> a.length() == expectedFileSizeInBytes);
45 public void tearDown() throws Exception {
46 FileTestUtils.cleanDirectory(FILE_SPLIT_TEST_DIR);