Newer
Older
test-sample / src / test / java / com / example / testsample / SampleAppServiceIntegrationTest.java
yhornisse on 9 Oct 2023 677 bytes add test sample
package com.example.testsample;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class SampleAppServiceIntegrationTest {

  @Autowired
  private SampleAppService sampleService;

  @Test
  public void test() {
    // Arrange
    // (DB初期化処理)
    // Act
    final var result = sampleService.hoge();
    // assert
    assertThat(result.id()).isEqualTo(1L);
    assertThat(result.sample1Name()).isEqualTo("Taro");
    assertThat(result.sample2Name()).isEqualTo("Apple");
  }
}