airframe icon indicating copy to clipboard operation
airframe copied to clipboard

Airframe log issue with MockFactory

Open kali786516 opened this issue 4 years ago • 2 comments
trafficstars

Hi,

I tried to use airframe log which is kind of super cool logging but I am encountering an error in scala flat spec tests using Mockfactory.

Error:-

overriding macro method logAt in trait LoggingMethods of type (logLevel: wvlet.log.LogLevel, message: Any)Unit;
 method logAt cannot be used here - only term macros can override term macros
    val mockProcessDataFlow = mock[ProcessDataFlow] 

Unit Test Code:-

class ProcessDataFlowTest extends MasterUnitSpec with MockFactory {

  behavior of "ProcessDataFlowTest"

  def fixture = new {
    val mockProcessDataFlow = mock[ProcessDataFlow]
  }

  it should "run" in {
    (fixture.mockProcessDataFlow.run _).stubs(workFlow, localConfigFile)
  }

}

Parent Code:-

trait ProcessDataFlow extends LoggerUtils with IngestionWorkFlowException {
}

My Logger Utils:-

import wvlet.log.{LogSupport, Logger}
import wvlet.log.Logger
trait LoggerUtils extends LogSupport {
Logger.init
}

Thanks Sri

kali786516 avatar Mar 02 '21 15:03 kali786516

I think this is the same issue with #788. Mock library implementation should not override macro methods. So I think it's better to file an issue to the mock library side.

xerial avatar Mar 02 '21 17:03 xerial

@kali786516 As long as, MockFactory is generating an invalid code that overwrites macro methods, it looks there is nothing we can do in airframe-log.

xerial avatar Mar 04 '21 06:03 xerial

Closing as wontfix

exoego avatar Dec 17 '22 05:12 exoego