Ich stecke in einer Situation fest, in der ich das Problem von 6 Zweigen nicht beheben kann. Unten ist der kleine Code, den ich versucht habe, < /p>
zu produzieren
package org.example;
public class Testing {
public static final String ONE = "1";
public static boolean condition(String x, boolean y, String z) {
return "ABC".equalsIgnoreCase(x)
&& (y || ONE.equals(z));
}
}
< /code>
Testfall: < /p>
package org.example;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
import org.junit.jupiter.api.Test;
class BranchCoverageTest {
@Test
public void testCondition_xIsABC_yTrue_zNotEqualOne() {
// Testing the case where the first branch is true, but the second branch is false
// "ABC".equalsIgnoreCase("ABC") is true, but (true || "1".equals("1")) is true
assertTrue(Testing.condition("ABC", true, "1"));
}
@Test
public void testCondition_xIsNotABC_yFalse_zEqualsOne() {
// Testing the case where the first branch is false, but the second branch is true
// "ABC".equalsIgnoreCase("DEF") is false, but (false || "1".equals("1")) is true
assertFalse(Testing.condition("DEF", false, "1"));
}
@Test
public void testCondition_xIsNotABC_yFalse_zNotEqualOne() {
// Testing the case where both branches are false
// "ABC".equalsIgnoreCase("DEF") is false, and (false || "1".equals("XYZ")) is false
assertFalse(Testing.condition("DEF", false, "XYZ"));
}
@Test
public void testCondition_xIsABC_yFalse_zNotEqualOne() {
// Testing the case where the first branch is true, but the second branch is false
// "ABC".equalsIgnoreCase("ABC") is true, and (false || "1".equals("XYZ")) is false
assertFalse(Testing.condition("ABC", false, "XYZ"));
}
}
Ich stecke in einer Situation fest, in der ich das [url=viewtopic.php?t=15738]Problem[/url] von 6 Zweigen nicht beheben kann. Unten ist der kleine Code, den ich versucht habe, < /p> zu produzieren[code]package org.example;
@Test public void testCondition_xIsABC_yTrue_zNotEqualOne() { // Testing the case where the first branch is true, but the second branch is false // "ABC".equalsIgnoreCase("ABC") is true, but (true || "1".equals("1")) is true assertTrue(Testing.condition("ABC", true, "1")); }
@Test public void testCondition_xIsNotABC_yFalse_zEqualsOne() { // Testing the case where the first branch is false, but the second branch is true // "ABC".equalsIgnoreCase("DEF") is false, but (false || "1".equals("1")) is true assertFalse(Testing.condition("DEF", false, "1")); }
@Test public void testCondition_xIsNotABC_yFalse_zNotEqualOne() { // Testing the case where both branches are false // "ABC".equalsIgnoreCase("DEF") is false, and (false || "1".equals("XYZ")) is false assertFalse(Testing.condition("DEF", false, "XYZ")); }
@Test public void testCondition_xIsABC_yFalse_zNotEqualOne() { // Testing the case where the first branch is true, but the second branch is false // "ABC".equalsIgnoreCase("ABC") is true, and (false || "1".equals("XYZ")) is false assertFalse(Testing.condition("ABC", false, "XYZ")); } } [/code]
Versuch, einen Jacoco-Bericht zu erhalten, in dem alle Ergebnisse aus mehreren Modulen angezeigt werden. > Nach dem Erstellen des Projekts, aber nicht sicher, wie es einen Bericht ausgeben kann, der...
Ich habe eine Spring-App, die Failsafe verwendet und IT durch Starten des Anwendungs-JAR über benutzerdefinierten Code ausführt, und es besteht kein organisatorischer Wunsch, sie direkt über Maven...
Ich habe meine App erfolgreich auf Xamarin-Formulare hochgeladen, aber nachdem sie hochgeladen wurde, erhielt ich Folgendes in einer E-Mail von Apple:
„Erforderliche Symboldatei fehlt. Das Paket...