Theory test is relatively new feature in JUnit testing. In theory test, we define "theory" for parameter combination and filter them by "assume". Then only tests passed parameters by assume. Let's show you some example theory test code. In Junit test, we put @RunWith(Theories.class) annotation on test class for deining theory test. put @DataPoints for parameter data set. The code below shows how theory test works in JUnit. Actually this is not good example because there is no advantedges compared with parameterized test in this case. package com.dukesoftware.exchangerate.service; import junit.framework.Assert; import org.junit.After; import org.junit.BeforeClass; import org.junit.experimental.theories.DataPoints; import org.junit.experimental.theories.Theories; import org.junit.experimental.theories.Theory; import org.junit.runner.RunWith; import org.mockito.Mockito; import com.dukesoftware.exchangerate.api.ExchangeRateApi; import com.dukesoftware....
IT関連の技術やプログラミングを中心に記事を書いています。ハードウェアも好きなので、日々のちょっとしたお役立ち情報も投稿しています。