aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackReverseIndexWriterTest.java
blob: 220976471ff5cb8467fcab044e3041c1da9d16a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Copyright (C) 2023, Google LLC and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */
package org.eclipse.jgit.internal.storage.file;

import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayOutputStream;

import org.junit.Test;

public class PackReverseIndexWriterTest {

	@Test
	public void createWriter_defaultVersion() {
		PackReverseIndexWriter version1 = PackReverseIndexWriter
				.createWriter(new ByteArrayOutputStream());

		assertTrue(version1 instanceof PackReverseIndexWriterV1);
	}

	@Test
	public void createWriter_version1() {
		PackReverseIndexWriter version1 = PackReverseIndexWriter
				.createWriter(new ByteArrayOutputStream(), 1);

		assertTrue(version1 instanceof PackReverseIndexWriterV1);
	}

	@Test
	public void createWriter_unsupportedVersion() {
		assertThrows(IllegalArgumentException.class,
				() -> PackReverseIndexWriter
						.createWriter(new ByteArrayOutputStream(), 2));
	}
}