Skip to content

Class literals are not properly rendered (or rendered at all) #909

@Vampire

Description

@Vampire

Issue description

If you test classes with class literals, they are not rendered correctly, neither in the normal failure output, nor if you click on Click to see differences in IntelliJ IDEA.

How to reproduce

import spock.lang.Specification

class Test extends Specification {
    def 'both are rendered'() {
        expect:
            new SocketTimeoutException().getClass() == new ClassNotFoundException().getClass()
    }

    def 'only expected is rendered'() {
        expect:
            SocketTimeoutException == new ClassNotFoundException().getClass()
    }

    def 'only actual is rendered'() {
        expect:
            new SocketTimeoutException().getClass() == ClassNotFoundException
    }

    def 'none is rendered'() {
        expect:
            SocketTimeoutException == ClassNotFoundException
    }
}

Expected behavior

All works like in both are rendered.

Actual behavior

both are rendered

Condition not satisfied:

new SocketTimeoutException().getClass() == new ClassNotFoundException().getClass()
|                            |          |  |                            |
|                            |          |  |                            class java.lang.ClassNotFoundException
|                            |          |  java.lang.ClassNotFoundException
|                            |          false
|                            class java.net.SocketTimeoutException
java.net.SocketTimeoutException
 <Click to see difference>


	at Test.both are rendered(Test.groovy:6)

grafik

only expected is rendered

Condition not satisfied:

SocketTimeoutException == new ClassNotFoundException().getClass()
                       |  |                            |
                       |  |                            class java.lang.ClassNotFoundException
                       |  java.lang.ClassNotFoundException
                       false
 <Click to see difference>


	at Test.only expected is rendered(Test.groovy:11)

grafik

only actual is rendered

Condition not satisfied:

new SocketTimeoutException().getClass() == ClassNotFoundException
|                            |          |
|                            |          false
|                            class java.net.SocketTimeoutException
java.net.SocketTimeoutException
 <Click to see difference>


	at Test.only actual is rendered(Test.groovy:16)

grafik

none is rendered

Condition not satisfied:

SocketTimeoutException == ClassNotFoundException
                       |
                       false

Expected :
Actual   :
 <Click to see difference>


	at Test.none is rendered(Test.groovy:21)

grafik

Additional Environment information

Java/JDK

1.8.0_131

Groovy version

2.4.9

Build tool version

Gradle 4.8.1

Operating System

Windows 10

IDE

IntelliJ IDEA 2018.1.6

Build-tool dependencies used

testImplementation 'org.spockframework:spock-core:1.2-RC2-groovy-2.4'

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions