Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 6643fd1ab23a0fc23b14a74fc2b3ca03971ce247 (plain) (blame)
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
44
45
46
47
48
49
50
51
/******************************************************************************
 *  Copyright (c) 2011 GitHub Inc.
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *
 *  Contributors:
 *    Kevin Sawicki (GitHub Inc.) - initial API and implementation
 *****************************************************************************/
package org.eclipse.egit.github.core.tests;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;

import org.eclipse.egit.github.core.TreeEntry;
import org.junit.Test;

/**
 * Unit tests of {@link TreeEntry}
 */
public class TreeEntryTest {

	/**
	 * Test default state of tree entry
	 */
	@Test
	public void defaultState() {
		TreeEntry entry = new TreeEntry();
		assertNull(entry.getMode());
		assertNull(entry.getPath());
		assertNull(entry.getSha());
		assertEquals(0, entry.getSize());
		assertNull(entry.getType());
		assertNull(entry.getUrl());
	}

	/**
	 * Test updating tree entry fields
	 */
	@Test
	public void updateFields() {
		TreeEntry entry = new TreeEntry();
		assertEquals("rw", entry.setMode("rw").getMode());
		assertEquals("file1.txt", entry.setPath("file1.txt").getPath());
		assertEquals("0ab", entry.setSha("0ab").getSha());
		assertEquals(400, entry.setSize(400).getSize());
		assertEquals("blob", entry.setType("blob").getType());
		assertEquals("url", entry.setUrl("url").getUrl());
	}
}

Back to the top