반응형

 

## 공백으로 input 값 받는 방법
data = list(map(int, input().split()))

# 결과
1 2 3
[1, 2, 3]

파이썬으로 입력값을 받을때 위와 같이 코드를 작성하면 간편하다. (주로 코딩테스트의 입력값 받을때 사용하면 된다.)

입력값이 공백이 아닌 콤마(,) 로 구분될 경우 split(",") 으로 변경해서 코드를 작성하면 된다.

 

728x90
반응형
반응형

배열을 초기화 시에 아래와 같이 사용하면 유용하게 사용가능 하다. 

# index가 필요 없는 반복문일 경우 _ 사용, 배열 초기화시 사용
array = [[0] * 3 for _ in range(10)]
print(array)

# 결과값
[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]

_ 는 for 문 반복시 index 가 필요없는 단순 반복을 할 경우에 사용한다.

 

728x90
반응형
반응형
nohup은 HUP(hangup) 신호를 무시하도록 만드는 POSIX 명령어이다. HUP 신호는 전통적으로 터미널이 의존 프로세스들에게 로그아웃을 알리는 방식이다. 일반적으로 터미널로 향하는 출력은 별도로 넘겨주기 처리를 하지 않았을 경우 nohup.out이라는 이름의 파일로 출력된다.

(출처 : https://ko.wikipedia.org/wiki/Nohup)

다시 말해 nohup 명령어는 터미널을 종료해서 세션이 끊어지더라도 계속 동작을 할수 있게 해준다. 

사용방법

nohup 프로세스 &

nohup.out 파일 생성하지 않으려면 

nohup 프로세스 1>/dev/null 2>&1 &

1>dev/null 은 표준출력 사용하지 않는다는 의미
2>&1 표준 에러를 표준 출력과 같게 한다는 의미

참고사항

표준입력 = 0
표준 출력 = 1
표준 에러 = 2

> :  파일이 없으면 새로 만들고 있으면 덮어쓴다.
>> : 파일이 없으면 새로 만들고 있으면 끝에 덧붙인다. 

 

728x90
반응형

'Development > Linux' 카테고리의 다른 글

xargs 명령어  (0) 2024.01.17
[리눅스 명령어] arp  (0) 2021.11.16
[리눅스 명령어] 디스크 관련 명령어  (0) 2021.06.04
파일 찾기, 파일 날짜별 삭제  (0) 2021.05.21
[리눅스 명령어] IP 관련 명령어  (0) 2021.03.08
반응형
du 디렉토리명

디렉토리와 모든 하위 디렉토리 용량을 표시해준다.

옵션
-s : 선택한 디렉토리의 용량을 보여준다.
-h : 용량 단위를 알기 쉽게 보여준다.
-d : 숫자 숫자만큼의 하위디렉토리까지 출력한다.
-a : 파일 용량도 출력한다.

df -h

디스크의 사용량을 알 수 있다.

 

728x90
반응형

'Development > Linux' 카테고리의 다른 글

[리눅스 명령어] arp  (0) 2021.11.16
[리눅스 명령어] nohup  (0) 2021.06.09
파일 찾기, 파일 날짜별 삭제  (0) 2021.05.21
[리눅스 명령어] IP 관련 명령어  (0) 2021.03.08
dpkg lock 에러  (0) 2020.09.17
반응형

특정 기간이 지난 파일을 삭제할때

 

find -mtime 옵션 사용

find -mtime n(일수)
-> n 일전 * 24시간 (시간 기준이다)

find -mtime -3 : 3일전부터 현재까지

find -mtime 3 : 4일전에서 3일전까지

find -mtim +3 : 3일 이전

ex) find -name "*.log" -mtime +3 -delete

이렇게 하면 3일 이전 생성된 파일들이 삭제됨

find -name "*.log" -mtime -1 -exec ls -lrt {} \;  ->> 파일 목록들 확인할때.

 

728x90
반응형

'Development > Linux' 카테고리의 다른 글

[리눅스 명령어] nohup  (0) 2021.06.09
[리눅스 명령어] 디스크 관련 명령어  (0) 2021.06.04
[리눅스 명령어] IP 관련 명령어  (0) 2021.03.08
dpkg lock 에러  (0) 2020.09.17
netstat 사용 중인 포트 찾기  (0) 2020.07.30
반응형

ip link
- ip link set eth0 up
- eth0 인터페이스활성화

ip addr
- IP 정보 출력

ip addr add
- ip addr add ip/24 dev eth0
- eth0 인턴페이스에 IP 추가

route
- 라우팅 정보 출력

ip route add
- ip route add default via XXX.XXX.X.X
- 게이트웨이 설정
- ip route add XX.XX.XX.X/24 via XXX.XXX.X.X dev eth0
- 정적 라우팅 정보 설정

 

728x90
반응형

'Development > Linux' 카테고리의 다른 글

[리눅스 명령어] 디스크 관련 명령어  (0) 2021.06.04
파일 찾기, 파일 날짜별 삭제  (0) 2021.05.21
dpkg lock 에러  (0) 2020.09.17
netstat 사용 중인 포트 찾기  (0) 2020.07.30
openSSH 서버 활용하기  (0) 2017.04.18
반응형

2021/02/17 - [Development/Java] - Spring Boot Test Case 작성에 대한 생각 - Service Test

2021/02/17 - [Development/Java] - Spring Boot Test Case 작성에 대한 생각 - Repository Test

Repository, Service 에 대한 테스트를 살펴봤으니 이제 Controller 테스트를 확인해보자. Controller Test 에는 @WebMvcTest 를 사용했다. Controller 는 확인해야 할 부분이 다음과 같다. 

1. request 를 요청한 url 과 파라메터가 정확한지 여부.
2. 정상 처리 되었을데 요구한 응답을 보내주는지.
3. 비정상일때에 response 에 상태 코드가 정확히 전달 되는지. 

@RunWith(SpringRunner.class)
@WebMvcTest(UserRestController.class)
public class UserRestControllerTest {

    @Autowired
    private MockMvc mockMvc;

    @MockBean
    private UserService userService;

    @Test
    public void getUsers() throws Exception {

        when(userService.findAll())
                .thenReturn(Arrays.asList(
                        Users.builder()
                                .email("test@test.com")
                                .name("test")
                                .status(UserStatus.APPLIED)
                                .build()
                ));

        this.mockMvc.perform(get("/users"))
                .andDo(print())
                .andExpect(status().isOk())
                .andExpect(jsonPath("@[0].email").value("test@test.com"));

    }
}

테스트케이스를 통해서 response 로 받는 내용과 상태 코드, 그리고 body 에 있는 내용들을 확인 해 볼 수 있다. 

MockHttpServletResponse:
           Status = 200
    Error message = null
          Headers = [Content-Type:"application/json"]
     Content type = application/json
             Body = [{"email":"test@test.com","name":"test","userStatus":"APPLIED"}]
    Forwarded URL = null
   Redirected URL = null
          Cookies = []

그리고 print() 를 했기 때문에 콘솔 창에 위와 같은 결과도 같이 확인 해 볼 수 있다. 

그리고 잘못된 결과값이 나올 경우에도 response 가 잘 리턴 되는지 확인해 봐야 한다.

@Test
public void getUserNotFoundException() throws Exception {

  when(userService.findUserById("test11@test.com"))
    .thenThrow(
      new RuntimeException("User not found")
  );

  this.mockMvc.perform(get("/users/test11@test.com"))
    .andDo(print())
    .andExpect(status().isBadRequest());
}


위 테스트는 파라메터로 "test11@test.com" 을 보냈으나 사용자가 존재하지 않을때 400 error 와 메세지를 보내는 경우이다. 

MockHttpServletResponse:
           Status = 400
    Error message = null
          Headers = [Content-Type:"text/plain;charset=UTF-8", Content-Length:"14"]
     Content type = text/plain;charset=UTF-8
             Body = User not found
    Forwarded URL = null
   Redirected URL = null

결과로 400 에러가 전달 되며 Body 에는 메세지가 써있다. 

Controller 테스트에서는 고려해야 할 것들이 많은것 같다. request 를 받고 response 를 보내야 하는 곳이기 때문에 파라메터에 대한 검증과 상태코드, response 값과 message 들이 잘 구성되어있어야 한다. Status 코드가 200이 떨어졌을때 보다는 200이 아닌경우의 상황을 더 많이 고려해야 되지 않을까 생각이 된다. 

주의사항) 제 생각을 기준으로 작성하고 만든 소스코드이고 의견이기 때문에 틀린 부분이 있을수 있습니다.

728x90
반응형
반응형

 

2021/02/17 - [Development/Java] - Spring Boot Test Case 작성에 대한 생각 - Repository Test

지난 글에 이어 이번에는 Service 테스트에 대해서 적어보려 한다. 아래는 내가 작성한  UserService  에 대한 테스트케이스 이다.

@RunWith(MockitoJUnitRunner.class)
public class UserServiceTest {


    private UserService userService;

    @Mock
    private UserRepository userRepository;

    private Users user1;

    @Before
    public void setup(){

        userService = new UserService(userRepository);

        user1 = Users.builder()
                .email("test01@test.com")
                .name("test01")
                .status(UserStatus.APPLIED)
                .build();
    }

    @Test
    public void findUserById(){
        when(userRepository.findById("test01@test.com")).thenReturn(Optional.of(user1));
        Users user = userService.findUserById("test01@test.com");

        verify(userRepository).findById("test01@test.com");
        Assert.assertNotNull(user);
        Assert.assertEquals("test01@test.com", user.getEmail());

    }
}

@Before 에서 UserService  를 생성해주고 Users 객체도 만들어 줬다. 그리고  UserRepository 는 Mock 으로 정의해줬다. 

실제 테스트케이스에는 when() 을 이용해서 UserRepository 가 실행됐을 때 미리 정의해둔 user1 객체를 리턴하게 만들었다. 그리고 verify 를 이용해서 실제 실행 여부를 확인했다. 

UserRepository를 Mock 으로 정의해서 테스트 케이스를 만들었다. 이유는 이미 repository 에 관련된 테스트는 repository test 에서 수행했다고 가정을 했기 때문에 굳이 repository를 실제 bean 으로 주입하고 DB 를 연결할 필요가 없다고 생각을 했다. Service 테스트케이스에서 중점적으로 체크해야 할 내용들은 조건문 처리, Exception  처리 등이 있을것 같다. 아래 코드는 Exception 에 대한 테스트 코드이다.

@Test(expected = RuntimeException.class)
public void findUserByIdException(){
  when(userRepository.findById("test011@test.com")).thenThrow(new RuntimeException("User not found"));
  userService.findUserById("test011@test.com");
}

파라메터의 null 체크 같은 경우는 좀 생각을 해봐야 할것 같다. 전에는 null 체크는 무조건 메소드 내에서 한다라고 생각을 했었는데 그렇게 코드를 짜다보니 Controller 에서 이미 null 체크를 한 파라메터를 메소드 내부에서 또 체크하는 경우가 생겼다. 지금 생각하기에는 파라메터를 넘겨주기 전에 null 체크를 해야 할것 같다는 생각이 든다. 

주의사항) 제 생각을 기준으로 작성하고 만든 소스코드이고 의견이기 때문에 틀린 부분이 있을수 있습니다.

 

728x90
반응형
반응형

테스트 케이스를 작성을 할때 내가 어렵게 생각했던것은 2가지 이다.

1. Mock 으로 테스트케이스를 작성할 것인가? 아니면 실제 데이터를 가지고 작성할 것인다.

2. 테스트용 DB를 따로 둬야 할까?

이 2가지가 항상 풀리지 않는 난제 같았다. 그런데 갑자기 뭔가 기준을 정해서 하면 되지 않을까 라는 생각이 들었다. 어떻게 보면 당연한 이야기 이긴 하지만. 테스트케이스를 작성하려는 클래스들의 역할에 생각해 보고 그에 맞는 테스트 케이스를 작성하면 되는 것이다. 

Spring Boot 프로젝트를 보면 테스트케이스를 작성하는 클래스들로 다음과 같은 것들을 꼽을 수 있다.

1. Repository
2. Service
3. Controller
4. RestApiController

그럼 우선 이번 글에서는 Repository 에 대해서만 살펴보려고 한다. Repository 는 실제로 DB 와 연결되어서 CRUD를 할 수 있는 클래스이다. Repository 클래스에 정의되어 있는 메소드를 통해서 내가 원하는 데이터를 가져올 수 있는지, 아니면 수정이 되는지 여부를 확인 하는 테스트를 작성하면 된다. 그리고 이부분은 결국 DB의 데이터가 필요하다.  Mock 으로 하기에는 실제 데이터를 가져오는지 여부가 의심(?) 스럽기 때문이다. 

@DataJpaTest
@RunWith(SpringRunner.class)
public class UserRepositoryTest {

    @Autowired
    private UserRepository userRepository;

    private Users users;
    @Before
    public void setup(){
        users = Users.builder()
                .email("test@test.com")
                .name("test")
                .status(UserStatus.APPLIED)
                .build();

        userRepository.save(users);
    }

    @Test
    public void getUsers(){
        List<Users> all = userRepository.findAll();
        Assert.assertNotNull(all);
        Assert.assertEquals(1, all.size());
    }

    @Test
    public void getUsersById(){
        Optional<Users> byId = userRepository.findById("test@test.com");
        Assert.assertNotNull(byId);
        Assert.assertEquals("test", byId.get().getName());
    }
}

@DataJpaTest 를 사용하면 테스트케이스 실행시에 MemoryDB 를 사용해서 실행을 한다.  테스트케이스를 실행해 보면 다음과 같은 로그를 볼 수 있다. 

Hibernate: drop table if exists users CASCADE 
Hibernate: create table users (email varchar(100) not null, name varchar(100) not null, user_status integer not null, primary key (email))
2021-02-17 10:56:06.114  INFO 2856 --- [    Test worker] o.h.e.t.j.p.i.JtaPlatformInitiator       : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-02-17 10:56:06.120  INFO 2856 --- [    Test worker] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-02-17 10:56:06.224  INFO 2856 --- [    Test worker] c.p.common.user.web.UserRepositoryTest   : Started UserRepositoryTest in 2.808 seconds (JVM running for 3.635)
2021-02-17 10:56:06.293  INFO 2856 --- [    Test worker] o.s.t.c.transaction.TransactionContext   : Began transaction (1) for test context [DefaultTestContext@588bc70b testClass = UserRepositoryTest, testInstance = com.polpid.common.user.web.UserRepositoryTest@4f8e0671, testMethod = getUsers@UserRepositoryTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@34cf76 testClass = UserRepositoryTest, locations = '{}', classes = '{class com.polpid.common.user.SpringCommonUserApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory$DisableAutoConfigurationContextCustomizer@127dfcc0, org.springframework.boot.test.autoconfigure.filter.TypeExcludeFiltersContextCustomizer@351584c0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@d5d4db2d, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@5948c9fa, [ImportsContextCustomizer@efe207e key = [org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration, org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration, org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration, org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration, org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManagerAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@61218ded, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@e767673, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestArgs@1], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]]; transaction manager [org.springframework.orm.jpa.JpaTransactionManager@4bc55dd0]; rollback [true]
Hibernate: select users0_.email as email1_0_0_, users0_.name as name2_0_0_, users0_.user_status as user_sta3_0_0_ from users users0_ where users0_.email=?
Hibernate: insert into users (name, user_status, email) values (?, ?, ?)
Hibernate: select users0_.email as email1_0_, users0_.name as name2_0_, users0_.user_status as user_sta3_0_ from users users0_
2021-02-17 10:56:06.747  INFO 2856 --- [    Test worker] o.s.t.c.transaction.TransactionContext   : Rolled back transaction for test: [DefaultTestContext@588bc70b testClass = UserRepositoryTest, testInstance = com.polpid.common.user.web.UserRepositoryTest@4f8e0671, testMethod = getUsers@UserRepositoryTest, testException = [null], mergedContextConfiguration = [MergedContextConfiguration@34cf76 testClass = UserRepositoryTest, locations = '{}', classes = '{class com.polpid.common.user.SpringCommonUserApplication}', contextInitializerClasses = '[]', activeProfiles = '{}', propertySourceLocations = '{}', propertySourceProperties = '{org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper=true}', contextCustomizers = set[org.springframework.boot.test.autoconfigure.OverrideAutoConfigurationContextCustomizerFactory$DisableAutoConfigurationContextCustomizer@127dfcc0, org.springframework.boot.test.autoconfigure.filter.TypeExcludeFiltersContextCustomizer@351584c0, org.springframework.boot.test.autoconfigure.properties.PropertyMappingContextCustomizer@d5d4db2d, org.springframework.boot.test.autoconfigure.web.servlet.WebDriverContextCustomizerFactory$Customizer@5948c9fa, [ImportsContextCustomizer@efe207e key = [org.springframework.boot.autoconfigure.cache.CacheAutoConfiguration, org.springframework.boot.autoconfigure.data.jpa.JpaRepositoriesAutoConfiguration, org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration, org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration, org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration, org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration, org.springframework.boot.test.autoconfigure.jdbc.TestDatabaseAutoConfiguration, org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManagerAutoConfiguration]], org.springframework.boot.test.context.filter.ExcludeFilterContextCustomizer@61218ded, org.springframework.boot.test.json.DuplicateJsonObjectContextCustomizerFactory$DuplicateJsonObjectContextCustomizer@e767673, org.springframework.boot.test.mock.mockito.MockitoContextCustomizer@0, org.springframework.boot.test.context.SpringBootTestArgs@1], contextLoader = 'org.springframework.boot.test.context.SpringBootContextLoader', parent = [null]], attributes = map[[empty]]]
2021-02-17 10:56:06.755  INFO 2856 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-02-17 10:56:06.755  INFO 2856 --- [extShutdownHook] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
Hibernate: drop table if exists users CASCADE 

 

테이블을 생성하고 Before 에 정의 되어있는 데로 데이터를 insert 한후 테스트 가 종료되면 테이블을 Drop 한다. 이정도면 Repository에 정의 되어있는 메소드가 내가 생각한대로 동작을 하는지 검증하는데는 크게 문제가 없다. 실제 DB에서 가져오도록 설정도 가능하지만 내 기준에서 테스트는 실제 DB와는 분리 되어야 한다고 생각을 하기 때문에 메모리 DB가 적합한것 같다.

한가지 주의할 점은 도메인을 정의할때 필드를 DB의 예약어와 동일하게 작성을 하면 에러가 날 수 있다. 예를 들어 order 라는 필드가 있으면 테이블이 생성될때 에러가 난다. 

org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table users (email varchar(100) not null, name varchar(100) not null, order integer, user_status integer not null, primary key (email))" via JDBC Statement
	at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:439) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:423) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:314) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:166) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:135) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:121) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:156) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:73) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:316) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:469) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1259) [hibernate-core-5.4.18.Final.jar:5.4.18.Final]
	at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58) [spring-orm-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) [spring-orm-5.2.8.RELEASE.jar:5.2.8.RELEASE]
	at org

그렇기 때문에 이런 부분들을 조심하면 된다.

Repository 테스트에 대한 결론은 메모리 DB를 사용해서 실제 CRUD 를 테스트 해보면 된다.

이제 다음 글에서는 Service 테스트에 대해서 살펴볼 예정이다.

주의사항) 제 생각을 기준으로 작성하고 만든 소스코드이고 의견이기 때문에 틀린 부분이 있을수 있습니다.

 

728x90
반응형

+ Recent posts