Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b13de016ff77de828e924b5a3c94d65cd8a26ebb (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
57
/******************************************************************************
 *  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 2.0
 *  which accompanies this distribution, and is available at
 *  https://www.eclipse.org/legal/epl-2.0/
 *
 *  SPDX-License-Identifier: EPL-2.0
 *
 *  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.Contributor;
import org.junit.Test;

/**
 * Unit tests of {@link Contributor}
 */
public class ContributorTest {

	/**
	 * Test default state of contributor
	 */
	@Test
	public void defaultState() {
		Contributor contributor = new Contributor();
		assertNull(contributor.getAvatarUrl());
		assertEquals(0, contributor.getContributions());
		assertEquals(0, contributor.getId());
		assertNull(contributor.getLogin());
		assertNull(contributor.getName());
		assertNull(contributor.getType());
		assertNull(contributor.getUrl());
	}

	/**
	 * Test updating contributor fields
	 */
	@Test
	public void updateFields() {
		Contributor contributor = new Contributor();
		assertEquals("aUrl", contributor.setAvatarUrl("aUrl").getAvatarUrl());
		assertEquals(10, contributor.setContributions(10).getContributions());
		assertEquals(4321, contributor.setId(4321).getId());
		assertEquals("user", contributor.setLogin("user").getLogin());
		assertEquals("U ser", contributor.setName("U ser").getName());
		assertEquals(Contributor.TYPE_ANONYMOUS,
				contributor.setType(Contributor.TYPE_ANONYMOUS).getType());
		assertEquals("url", contributor.setUrl("url").getUrl());
	}

}

Back to the top