0
私は以下のようなテスト統合テストを行っています。私は統合テストを実行すると、私はその後サービス "サービス"の名前が統合テストで機能しないのはなぜですか?
BibsService bibsService
テストなどのサービス以外にサービスの名前を変更する場合
package bibs
import static org.junit.Assert.*
import groovy.util.GroovyTestCase;
import org.junit.*
class BibsServiceTests extends GroovyTestCase{
BibsService service
@Before
void setUp() {
// Setup logic here
}
@After
void tearDown() {
// Tear down logic here
}
@Test
void testSomething() {
assertEquals service.convertRangeStringToRangeList("asd"), "asd"
}
}
、私が手にエラーが
Running 1 integration test... 1 of 1
| Failure: testSomething(bibs.BibsServiceTests)
| java.lang.NullPointerException: Cannot invoke method convertRangeStringToRangeList() on null object
at bibs.BibsServiceTests.testSomething(BibsServiceTests.groovy:30)
| Completed 1 integration test, 1 failed in 292ms
| Tests FAILED - view reports in
です渡します。なぜこれが当てはまるのだろうか?ありがとう!