Unit testing of a class with StaticLoggerBinder

前端 未结 2 2025
没有蜡笔的小新
没有蜡笔的小新 2020-12-15 11:09

I do have a simple class like this:

package com.example.howtomocktest

import groovy.util.logging.Slf4j
import java.nio.channels.NotYetBoundException

@Slf4j         


        
2条回答
  •  悲哀的现实
    2020-12-15 12:06

    If you are using Spring, you have acces to OutputCaptureRule

    @Rule
    OutputCaptureRule outputCaptureRule = new OutputCaptureRule()
    
    def test(){
    outputCaptureRule.getAll().contains("")
    }
    

提交回复
热议问题