Example usage for org.eclipse.jgit.lib Ref Ref

List of usage examples for org.eclipse.jgit.lib Ref Ref

Introduction

In this page you can find the example usage for org.eclipse.jgit.lib Ref Ref.

Prototype

Ref

Source Link

Usage

From source file:org.gitective.tests.CommitUtilsTest.java

License:Open Source License

/**
 * Get commit for ref with null id/* ww  w. j  ava2s  .  c  om*/
 *
 * @throws Exception
 */
@Test
public void getRefWithNullId() throws Exception {
    Ref ref = new Ref() {

        public boolean isSymbolic() {
            return false;
        }

        public boolean isPeeled() {
            return false;
        }

        public Ref getTarget() {
            return null;
        }

        public Storage getStorage() {
            return null;
        }

        public ObjectId getPeeledObjectId() {
            return null;
        }

        public ObjectId getObjectId() {
            return null;
        }

        public String getName() {
            return null;
        }

        public Ref getLeaf() {
            return null;
        }
    };
    assertNull(CommitUtils.getRef(new FileRepository(testRepo), ref));
}

From source file:org.gitective.tests.CommitUtilsTest.java

License:Open Source License

/**
 * Get commit for ref with zero id//from ww w.ja v  a  2  s.  co  m
 *
 * @throws Exception
 */
@Test(expected = GitException.class)
public void getRefWithZeroId() throws Exception {
    Ref ref = new Ref() {

        public boolean isSymbolic() {
            return false;
        }

        public boolean isPeeled() {
            return false;
        }

        public Ref getTarget() {
            return null;
        }

        public Storage getStorage() {
            return null;
        }

        public ObjectId getPeeledObjectId() {
            return null;
        }

        public ObjectId getObjectId() {
            return ObjectId.zeroId();
        }

        public String getName() {
            return null;
        }

        public Ref getLeaf() {
            return null;
        }
    };
    CommitUtils.getRef(new FileRepository(testRepo), ref);
}