Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 98d961e5f2e6cffbd93b7ec10a20c553e12f1dc6 (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
52
53
54
55
56
/******************************************************************************
 *  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.CommitUser;
import org.eclipse.egit.github.core.Tag;
import org.eclipse.egit.github.core.TypedResource;
import org.junit.Test;

/**
 * Unit tests of {@link Tag}
 */
public class TagTest {

	/**
	 * Test default state of tag
	 */
	@Test
	public void defaultState() {
		Tag tag = new Tag();
		assertNull(tag.getMessage());
		assertNull(tag.getObject());
		assertNull(tag.getSha());
		assertNull(tag.getTag());
		assertNull(tag.getTagger());
		assertNull(tag.getUrl());
	}

	/**
	 * Test updating tag fields
	 */
	@Test
	public void updateFields() {
		Tag tag = new Tag();
		assertEquals("msg", tag.setMessage("msg").getMessage());
		TypedResource obj = new TypedResource();
		obj.setSha("abc");
		assertEquals(obj, tag.setObject(obj).getObject());
		assertEquals("0a0a", tag.setSha("0a0a").getSha());
		assertEquals("v1", tag.setTag("v1").getTag());
		CommitUser tagger = new CommitUser().setName("tag er");
		assertEquals(tagger, tag.setTagger(tagger).getTagger());
		assertEquals("url:", tag.setUrl("url:").getUrl());
	}
}

Back to the top