Permalink
Browse files

Stop generating mocks for constructors - it's pointless at the moment

  • Loading branch information...
1 parent 972ce98 commit e477bfbc8a46d552578e6280e8c57146c160cab5 @paulbutcher committed Jul 30, 2012
Showing with 2 additions and 8 deletions.
  1. +2 −8 core/src/main/scala/org/scalamock/Mock.scala
@@ -194,17 +194,11 @@ object MockImpl {
}
}
- def overrideIfNecessary(m: Symbol) =
- if (isConstructorName(m.name) || m.hasFlag(DEFERRED))
- Modifiers()
- else
- Modifiers(OVERRIDE)
-
// def <|name|>(p1: T1, p2: T2, ...): T = <|mockname|>(p1, p2, ...)
def methodDef(m: Symbol, methodType: Type, body: Tree): DefDef = {
val params = buildParams(methodType)
DefDef(
- overrideIfNecessary(m),
+ Modifiers(OVERRIDE),
m.name,
methodType.typeParams map TypeDef _,
params,
@@ -311,7 +305,7 @@ object MockImpl {
val typeToMock = typeOf[T]
val anon = newTypeName("$anon")
val methodsToMock = membersNotInObject filter { m =>
- m.isMethod && (!(m.isStable || m.isAccessor) || m.hasFlag(DEFERRED))
+ m.isMethod && !isConstructorName(m.name) && (!(m.isStable || m.isAccessor) || m.hasFlag(DEFERRED))
}
val forwarders = methodsToMock map forwarderImpl _
val mocks = methodsToMock map mockMethod _

0 comments on commit e477bfb

Please sign in to comment.