View Javadoc
1   /*
2    * Copyright (C) 2010, Marc Strapetz <marc.strapetz@syntevo.com>
3    * Copyright (C) 2013, Gunnar Wagenknecht and others
4    *
5    * This program and the accompanying materials are made available under the
6    * terms of the Eclipse Distribution License v. 1.0 which is available at
7    * https://www.eclipse.org/org/documents/edl-v10.php.
8    *
9    * SPDX-License-Identifier: BSD-3-Clause
10   */
11  package org.eclipse.jgit.attributes;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNull;
15  
16  import org.eclipse.jgit.attributes.Attribute.State;
17  import org.junit.Test;
18  
19  /**
20   * Tests {@link Attribute}
21   */
22  public class AttributeTest {
23  
24  	@Test
25  	public void testBasic() {
26  		Attribute a = new Attribute("delta", State.SET);
27  		assertEquals(a.getKey(), "delta");
28  		assertEquals(a.getState(), State.SET);
29  		assertNull(a.getValue());
30  		assertEquals(a.toString(), "delta");
31  
32  		a = new Attribute("delta", State.UNSET);
33  		assertEquals(a.getKey(), "delta");
34  		assertEquals(a.getState(), State.UNSET);
35  		assertNull(a.getValue());
36  		assertEquals(a.toString(), "-delta");
37  
38  		a = new Attribute("delta", "value");
39  		assertEquals(a.getKey(), "delta");
40  		assertEquals(a.getState(), State.CUSTOM);
41  		assertEquals(a.getValue(), "value");
42  		assertEquals(a.toString(), "delta=value");
43  	}
44  }