James Moger
2011-07-20 330247866e931d5e5f93999db9947bc2fc1fc9ee
commit | author | age
793f76 1 /*
JM 2  * Copyright 2011 gitblit.com.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.gitblit.tests;
17
18 import java.util.List;
19
20 import junit.framework.TestCase;
21
22 import org.eclipse.jgit.lib.Repository;
23
24 import com.gitblit.models.Metric;
25 import com.gitblit.utils.MetricUtils;
26
27 public class MetricUtilsTest extends TestCase {
28
29     public void testMetrics() throws Exception {
30         Repository repository = GitBlitSuite.getHelloworldRepository();
1fa5e8 31         List<Metric> metrics = MetricUtils.getDateMetrics(repository, null, true, null);
793f76 32         repository.close();
a125cf 33         assertTrue("No date metrics found!", metrics.size() > 0);
JM 34     }
008322 35
a125cf 36     public void testAuthorMetrics() throws Exception {
JM 37         Repository repository = GitBlitSuite.getHelloworldRepository();
1fa5e8 38         List<Metric> byEmail = MetricUtils.getAuthorMetrics(repository, null, true);
JM 39         List<Metric> byName = MetricUtils.getAuthorMetrics(repository, null, false);
a125cf 40         repository.close();
JM 41         assertTrue("No author metrics found!", byEmail.size() == 9);
42         assertTrue("No author metrics found!", byName.size() == 8);
793f76 43     }
JM 44 }