You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AlwaysEmptyRevQueueTest.java 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. package org.eclipse.jgit.revwalk;
  11. import static org.junit.Assert.assertEquals;
  12. import static org.junit.Assert.assertFalse;
  13. import static org.junit.Assert.assertNull;
  14. import static org.junit.Assert.assertTrue;
  15. import static org.junit.Assert.fail;
  16. import org.junit.Test;
  17. public class AlwaysEmptyRevQueueTest extends RevWalkTestCase {
  18. private final AbstractRevQueue q = AbstractRevQueue.EMPTY_QUEUE;
  19. @Test
  20. public void testEmpty() throws Exception {
  21. assertNull(q.next());
  22. assertTrue(q.everbodyHasFlag(RevWalk.UNINTERESTING));
  23. assertFalse(q.anybodyHasFlag(RevWalk.UNINTERESTING));
  24. assertEquals(0, q.outputType());
  25. }
  26. @Test
  27. public void testClear() throws Exception {
  28. q.clear();
  29. testEmpty();
  30. }
  31. @Test
  32. public void testAddFails() throws Exception {
  33. try {
  34. q.add(commit());
  35. fail("Did not throw UnsupportedOperationException");
  36. } catch (UnsupportedOperationException e) {
  37. // expected result
  38. }
  39. }
  40. }