• 로그인 함 해보끄나?

  • Sarangnamu.net June 17, 2003
    Home Login Profile Study Open Project Q&A Google Code
    mockito (powermock) and logback
    계속 null point exception 때문에 고생하다가 찾은 글 
    
    https://stackoverflow.com/questions/49013260/powermock-mocking-static-final-logger
    
            Logger logger = PowerMockito.mock(Logger.class);
            PowerMockito.mockStatic(LoggerFactory.class);
            PowerMockito.when(LoggerFactory.getLogger(${YourClassName}.class)).thenReturn(logger);
            PowerMockito.mockStatic(${YourClassName}.class);
    
    이렇게 했더니 logger 에 관한 오류는 더 이상 나타나지 않음 

    Comment


    입력하3 1563722336



    Locations of visitors to this page