Created
December 4, 2021 18:06
-
-
Save satob/2b7bdd2cfb09481f5acbc5f3bc8a61c3 to your computer and use it in GitHub Desktop.
Class for code coverage test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example; | |
public class Main { | |
public static void test() { | |
String hoge = getHoge(); | |
String fuga = getFuga(10); | |
String piyo; | |
piyo = getPiyo(9,9); | |
piyo = getPiyo(11,9); | |
piyo = getPiyo(9,11); | |
piyo = getPiyo(11,11); | |
System.out.println("Hello World!:" + hoge + ":" + fuga + ":" + piyo); | |
} | |
public static String getHoge() { | |
return "HogeHoge"; | |
} | |
public static String getFuga(int y) { | |
int x = 13; | |
String fuga = "Fuga"; | |
if (x > 10) { | |
fuga = "Fuga x > 10"; | |
} | |
if (x < 10) { | |
fuga = "x < 10"; | |
} | |
if (x > 10 && y > 20) { | |
fuga = "Fuga x > 10 And y > 20"; | |
} | |
if (x > 10 || y > 20) { | |
fuga = "Fuga x > 10 Or y > 20"; | |
} | |
return fuga; | |
} | |
public static String getPiyo(int x, int y) { | |
String piyo = "Piyo"; | |
if (x < 10 && y < 10) { | |
piyo = "Piyo x > 10 And y > 10"; | |
} else if (x > 10 && y < 10) { | |
piyo = "Piyo x > 10 And y < 10"; | |
} else if (x < 10 && y > 10) { | |
piyo = "Piyo x < 10 And y > 10"; | |
} else if (x >= 10 && y >= 10) { | |
piyo = "Piyo x > 10 And y > 10"; | |
} | |
return piyo; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment