IBM Developer is your one-stop location for getting hands-on training and learning in-demand skills on relevant technologies such as generative AI, data science, AI, and open source.
æè¿ã¯å°ããã¤ãã¹ããã¡ã¼ã¹ããªéçºãç®æãã¤ã¤ãããã¾ã ã¾ã å ã¯é·ããã©ã JUnitã使ã£ã¦ãã¹ããè¡ãæã対象ã¡ã½ãããããä¾å¤ãã¹ãã¼ãããã¨ã確èªãããå ´åãã©ãããã°ãããã ããï¼ã¨TestCaseã®APIãæ¢ãã¦ã¿ããã©ããããããã¡ã½ããããªãããããã¼ã«JUnitã§ã°ã°ã£ã¦ã¿ãããfail()ã使ã£ã次ã®ãããªã³ã¼ãã§å®ç¾ã§ãããã¨ãåãã£ãã 次ã®ä¾ã¯ãã¹ãã¡ã½ãããNullPointerExceptionãã¹ãã¼ããã°æåã¨ãªããããªå ´åã public void testMethodThrowsNullPointer() { try { testTargetObject.method(null); fail("ãã®è¡ãå®è¡ããããã¨ã©ã¼"); } catch (NullPointerException e) { //succeed } }
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}