Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

MetricUtilsTest.java 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  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. import java.util.List;
  18. import junit.framework.TestCase;
  19. import org.eclipse.jgit.lib.Repository;
  20. import com.gitblit.models.Metric;
  21. import com.gitblit.utils.MetricUtils;
  22. public class MetricUtilsTest extends TestCase {
  23. public void testMetrics() throws Exception {
  24. Repository repository = GitBlitSuite.getHelloworldRepository();
  25. List<Metric> metrics = MetricUtils.getDateMetrics(repository, null, true, null);
  26. repository.close();
  27. assertTrue("No date metrics found!", metrics.size() > 0);
  28. }
  29. public void testAuthorMetrics() throws Exception {
  30. Repository repository = GitBlitSuite.getHelloworldRepository();
  31. List<Metric> byEmail = MetricUtils.getAuthorMetrics(repository, null, true);
  32. List<Metric> byName = MetricUtils.getAuthorMetrics(repository, null, false);
  33. repository.close();
  34. assertTrue("No author metrics found!", byEmail.size() == 9);
  35. assertTrue("No author metrics found!", byName.size() == 8);
  36. }
  37. }