Bläddra i källkod

DiffFormatterTest: Add a test to confirm the default rename detection settings

Add a test that confirms:

- No rename detector is initialized by default

- Rename detector is initialized after calling setDetectRenames(true)

- Rename limit and rename score have the default values 400 and
  60, respectively. Note that there are no constants for these values
  so the test hard codes them.

Change-Id: I327e2b348a40ef67d8a184e5ab09f4e9ab573e1c
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
tags/v5.9.0.202008260805-m3
David Pursehouse 3 år sedan
förälder
incheckning
14509f4cbb

+ 13
- 0
org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java Visa fil

package org.eclipse.jgit.diff; package org.eclipse.jgit.diff;


import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;


import java.io.BufferedOutputStream; import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
super.tearDown(); super.tearDown();
} }


@Test
public void testDefaultRenameDetectorSettings() throws Exception {
RenameDetector rd = df.getRenameDetector();
assertNull(rd);
df.setDetectRenames(true);
rd = df.getRenameDetector();
assertNotNull(rd);
assertEquals(400, rd.getRenameLimit());
assertEquals(60, rd.getRenameScore());
}

@Test @Test
public void testCreateFileHeader_Add() throws Exception { public void testCreateFileHeader_Add() throws Exception {
ObjectId adId = blob("a\nd\n"); ObjectId adId = blob("a\nd\n");

Laddar…
Avbryt
Spara