View Javadoc
1   /*
2    * Copyright (C) 2009, Google Inc. and others
3    *
4    * This program and the accompanying materials are made available under the
5    * terms of the Eclipse Distribution License v. 1.0 which is available at
6    * https://www.eclipse.org/org/documents/edl-v10.php.
7    *
8    * SPDX-License-Identifier: BSD-3-Clause
9    */
10  
11  package org.eclipse.jgit.revwalk;
12  
13  import static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertFalse;
15  import static org.junit.Assert.assertNull;
16  import static org.junit.Assert.assertTrue;
17  import static org.junit.Assert.fail;
18  
19  import org.junit.Test;
20  
21  public class AlwaysEmptyRevQueueTest extends RevWalkTestCase {
22  	private final AbstractRevQueue q = AbstractRevQueue.EMPTY_QUEUE;
23  
24  	@Test
25  	public void testEmpty() throws Exception {
26  		assertNull(q.next());
27  		assertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));
28  		assertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));
29  		assertEquals(0, q.outputType());
30  	}
31  
32  	@Test
33  	public void testClear() throws Exception {
34  		q.clear();
35  		testEmpty();
36  	}
37  
38  	@Test
39  	public void testAddFails() throws Exception {
40  		try {
41  			q.add(commit());
42  			fail("Did not throw UnsupportedOperationException");
43  		} catch (UnsupportedOperationException e) {
44  			// expected result
45  		}
46  	}
47  }