0
단위 테스트를 배우고 있습니다. 나는 간단한 테스트를 만들었습니다JUnit 테스트가 실패합니다.
public class ZigZagTest {
@Test
public void testZigZag() {
final int size = 2;
int[][] correctZigZag = new int[][] {
{0, 0},
{0, 1},
{1, 0},
{1, 1}
};
int[][] zigzag = ZigZagMatrix.getZigZagMatrix(size);
for(int i = 0; i < size*size; i++) {
assertEquals(correctZigZag[i][0], zigzag[i][0]);
assertEquals(correctZigZag[i][1], zigzag[i][1]);
}
}
}
을하지만 테스트를 실행하고있을 때, 그것은 실패 : 그는 주장 주석과로 교체하는 것을 시도했다
/usr/lib/jvm/java-7-oracle/bin/java -Dmaven.home=/usr/share/maven -Dclassworlds.conf=/usr/share/maven/bin/m2.conf -Didea.launcher.port=7552 -Didea.launcher.bin.path=/home/victor/bin/IDEA/bin -Dfile.encoding=UTF-8 -classpath /usr/share/maven/boot/plexus-classworlds-2.x.jar:/home/victor/bin/IDEA/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=13.1.1 --offline test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Compressor 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ Compressor ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:compile (default-compile) @ Compressor ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ Compressor ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/victor/Projects/Compressor/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.0.2:testCompile (default-testCompile) @ Compressor ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ Compressor ---
[INFO] Surefire report directory: /home/victor/Projects/Compressor/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running ZigZagTest
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.042 sec <<< FAILURE!
Results :
Failed tests: ZigZagTest.testZigZag(): org/junit/Assert
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.319s
[INFO] Finished at: Sun Apr 20 00:05:02 EEST 2014
[INFO] Final Memory: 8M/78M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project Compressor: There are test failures.
[ERROR]
[ERROR] Please refer to /home/victor/Projects/Compressor/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Process finished with exit code 1
assertEquals (1,1);
여전히 실패합니다.
어디서 잘못 되었나요? 댓글에서 해결 된 감사
'지그재그 메트릭스'는 어떻게 생겼습니까? – Reimeus
'-X' 플래그로 실행하십시오. –
출력은 다음과 같습니다. http://pastebin.com/Wp6bFZVx –