1

期待値と実際の値は同じですが、テスト結果は JUnit テストで失敗します。なぜこれが起こるのかわかりません。コードと結果画像が添付されています。もう 1 つ奇妙なのは、ソース コードにはエラーがないにもかかわらず、パッケージにエラー マークが表示されることです。これに関する画像も添付されています)。2つのことが互いに関連していると思います。どうすればこの問題を解決できますか? ありがとうございます。さらに詳しい情報が必要な場合は、お問い合わせください。

package tests;

import junit.framework.TestCase;
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import net.n3.nanoxml.*;

public class NanoSetAttr3_wy_v1Tests extends TestCase {

    public void test0() throws Exception {
        //setattr3.out
        String result;
        ByteArrayOutputStream byteBuffer;

        byteBuffer = new ByteArrayOutputStream();
        System.setOut(new PrintStream(byteBuffer));
        try{
            SetAttr3_wy_v1.main(new String[] {});
        }catch (Throwable t) {
            t.printStackTrace(System.out);
        }
        result = new String(byteBuffer.toByteArray());
        assertEquals(result, "<FOO Weight=\"80\"/>");
    }

}

junit は結果を比較します パッケージエラーマーク

4

1 に答える 1