/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* See LICENSE.txt included in this distribution for the specific
* language governing permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at LICENSE.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/**
* Tests for MercurialRepository.
*/
public class MercurialRepositoryTest {
/**
* Revision numbers present in the Mercurial test repository, in the
* order they are supposed to be returned from getHistory().
*/
"2:585a1b3f2efb", "1:f24a5fd7a85d", "0:816b6279ae9c"
};
/**
* Set up a test repository. Should be called by the tests that need it.
* The test repository will be destroyed automatically when the test
* finishes.
*/
repository = new TestRepository();
}
public void tearDown() {
if (repository != null) {
repository = null;
}
}
@Test
assertNotNull(e.getAuthor());
assertNotNull(e.getDate());
assertNotNull(e.getFiles());
assertNotNull(e.getMessage());
}
}
@Test
// Get all but the oldest revision
assertNotNull(e.getAuthor());
assertNotNull(e.getDate());
assertNotNull(e.getFiles());
assertNotNull(e.getMessage());
}
}
/**
* Test that {@code getHistory()} throws an exception if the revision
* argument doesn't match any of the revisions in the history.
*/
@Test
// Get the sequence number and the hash from one of the revisions.
// Construct a revision identifier that doesn't exist.
try {
fail("getHistory() should have failed");
} catch (HistoryException he) {
// expected exception, do nothing
} else {
// unexpected exception, rethrow it
throw he;
}
}
}
}