title: Error:(56, 0) Cause: org.gradle.api.tasks.testing.Test_Decorated cannot be cast to java.lang.Class
body: <p>I have this <code>build.gradle</code></p>
  
  <pre><code>apply plugin: 'java'
  
  sourceCompatibility = 1.8
  version = '1.0'
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
  //
  //    configurations.all*.exclude(group: 'com.sun.jersey', module: 'jersey-bundle')
  //    configurations.all*.exclude(group: 'com.fasterxml.jackson.core', module:'jackson-databind')
  
  
      compile 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
  
      compile 'com.google.inject:guice:4.0-beta5'
      compile 'com.sun.jersey:jersey-core:1.18.3'
      compile 'com.sun.jersey:jersey-client:1.18.3'
  
      //testCompile group: 'junit', name: 'junit', version: '4.11'
  }
  
  
  sourceSets {
      main {
          java {
              srcDirs = ['src/main']
          }
      }
  
      test {
          java {
              srcDirs = ['src/main']
          }
      }
  }
  
  
  test {
      testLogging {
  // Show that tests are run in the command-line output
          events 'started', 'passed'
      }
  }
  
  
  task testBaseLineGenerator(type: test) {
      systemProperties['test.single'] = 'BaseLineGenerator'
  }
  
  task testTotalLatency(type: test) {
      systemProperties['test.single'] = 'TotalLatencyTest'
  }
  </code></pre>
  
  <p>I get an Intellij error, once I have added:</p>
  
  <pre><code>task testBaseLineGenerator(type: test) {
      systemProperties['test.single'] = 'BaseLineGenerator'
  }
  
  task testTotalLatency(type: test) {
      systemProperties['test.single'] = 'TotalLatencyTest'
  }
  </code></pre>
  
  <p>and I get this error:</p>
  
  <pre><code>Error:(56, 0) Cause: org.gradle.api.tasks.testing.Test_Decorated cannot be cast to java.lang.Class
  Possible causes for this unexpected error include:&lt;ul&gt;&lt;li&gt;Gradle's dependency cache may be corrupt (this sometimes occurs after a network connection timeout.)
  &lt;a href="syncProject"&gt;Re-download dependencies and sync project (requires network)&lt;/a&gt;&lt;/li&gt;&lt;li&gt;The state of a Gradle build process (daemon) may be corrupt. Stopping all Gradle daemons may solve this problem.
  &lt;a href="stopGradleDaemons"&gt;Stop Gradle build processes (requires restart)&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;In the case of corrupt Gradle processes, you can also try closing the IDE and then killing all Java processes.
  </code></pre>
  
  <p>tried the two options it suggests, but it didn't help.</p>