我正在用maven弄湿我的脚,但这是一个陡峭的学习曲线.我正在尝试从单元测试中加载纯文本文件.测试通过,现在我已经将项目转换为maven项目,测试似乎无法解决测试文件的位置.
// I have the following test that I would like to run:
package net.stevenpeterson.base;
import static org.junit.Assert.*;
import net.stevenpeterson.base.LoadStringUtility;
import org.junit.Test;
public class LoadStringUtilityTest {
@Test
public void testSingleLine() {
assertEquals("Loading File", "This is a test." , loadFile("singleLine") );
}
@Test
public void testSeveralLines() {
assertFalse("Compare a string appended with extra lines, should not compare true. ", "This is a test.".equals(loadFile("severalLines")) );
}
@Test
public void loadSherlockHolmes() {
String fileToLoad = "cano.txt";
try{
StringBuilder holmesCanon = LoadStringUtility.LoadString(fileToLoad);
System.out.println("Finished Loading …Run Code Online (Sandbox Code Playgroud)