package uk.ac.wellcome.platform.transformer.transformers

import org.scalatest.Matchers
import uk.ac.wellcome.models.transformable.Transformable
import uk.ac.wellcome.models.work.internal.TransformedBaseWork

import scala.util.Try

trait TransformableTestBase[T <: Transformable] extends Matchers {

  val transformer: TransformableTransformer[T]

  def transformToWork(transformable: T): TransformedBaseWork = {
    val triedWork: Try[TransformedBaseWork] = transformer.transform(transformable, version = 1)
    if (triedWork.isFailure) triedWork.failed.get.printStackTrace()
    triedWork.isSuccess shouldBe true
    triedWork.get
  }

  def assertTransformToWorkFails(transformable: T): Unit = {
    transformer
      .transform(transformable, version = 1)
      .isSuccess shouldBe false
  }
}

package uk.ac.wellcome.platform.transformer.transformers

import org.scalatest.Matchers
import uk.ac.wellcome.models.transformable.Transformable
import uk.ac.wellcome.models.work.internal.TransformedBaseWork

trait TransformableTestBase[T <: Transformable] extends Matchers {

  val transformer: TransformableTransformer[T]

  def transformToWork(transformable: T): TransformedBaseWork = {
    val triedMaybeWork = transformer.transform(transformable, version = 1)
    if (triedMaybeWork.isFailure) triedMaybeWork.failed.get.printStackTrace()
    triedMaybeWork.isSuccess shouldBe true
    triedMaybeWork.get.get
  }

  def assertTransformToWorkFails(transformable: T): Unit = {
    transformer
      .transform(transformable, version = 1)
      .isSuccess shouldBe false
  }
}

--- 
+++ 
@@ -4,15 +4,17 @@
 import uk.ac.wellcome.models.transformable.Transformable
 import uk.ac.wellcome.models.work.internal.TransformedBaseWork
 
+import scala.util.Try
+
 trait TransformableTestBase[T <: Transformable] extends Matchers {
 
   val transformer: TransformableTransformer[T]
 
   def transformToWork(transformable: T): TransformedBaseWork = {
-    val triedMaybeWork = transformer.transform(transformable, version = 1)
-    if (triedMaybeWork.isFailure) triedMaybeWork.failed.get.printStackTrace()
-    triedMaybeWork.isSuccess shouldBe true
-    triedMaybeWork.get.get
+    val triedWork: Try[TransformedBaseWork] = transformer.transform(transformable, version = 1)
+    if (triedWork.isFailure) triedWork.failed.get.printStackTrace()
+    triedWork.isSuccess shouldBe true
+    triedWork.get
   }
 
   def assertTransformToWorkFails(transformable: T): Unit = {
Fix the core of the tests that expects an Option
