google / gwtmockito

Better GWT unit testing
https://google.github.io/gwtmockito
Apache License 2.0
157 stars 50 forks source link

java.lang.ClassCastException: com.google.gwt.user.client.Element$$EnhancerByMockitoWithCGLIB$$4fca3809 cannot be cast to com.google.gwt.dom.client.TableElement #32

Closed manstis closed 10 years ago

manstis commented 10 years ago

I found https://github.com/google/gwtmockito/issues/4 when Googling for help. I suspect this could be related.

I am trying to run a test that includes a CellTable and hit the following error.

java.lang.ClassCastException: com.google.gwt.user.client.Element$$EnhancerByMockitoWithCGLIB$$4fca3809 cannot be cast to com.google.gwt.dom.client.TableElement
    at com.google.gwt.user.cellview.client.CellTable.<init>(CellTable.java:613)
    at com.google.gwt.user.cellview.client.CellTable.<init>(CellTable.java:581)
    at com.github.gwtbootstrap.client.ui.CellTable.<init>(CellTable.java:110)
    at com.github.gwtbootstrap.client.ui.CellTable.<init>(CellTable.java:117)
    at com.github.gwtbootstrap.client.ui.CellTable.<init>(CellTable.java:121)
    at com.github.gwtbootstrap.client.ui.CellTable.<init>(CellTable.java:133)
    at com.github.gwtbootstrap.client.ui.CellTable.<init>(CellTable.java:105)

The Widget I'm attempt to test looks like this.

public class MyScreen extends Composite  {

    @UiField(provided = true)
    CellTable<String> table = new CellTable<String>();

The test code looks like this.

@RunWith(GwtMockitoTestRunner.class)
public class MyScreenTest {

    @GwtMock
    private CellTable<String> table;

I've tried with 1.1.3 but to no avail.

I could be doing something wrong; to be honest I'm new to GwtMockito, so wouldn't put user error out of the question.

ekuefler commented 10 years ago

I've fixed a few issues lately related to CellTable support, probably after 1.1.3 was released. Can you try running against the latest snapshot to see if you're still having trouble?

manstis commented 10 years ago

Hello,

I can confirm with 1.1.4-SNAPSHOT built from source the problem has gone :)

Do you have a time-frame for releasing 1.1.4 (we can't use SNAPSHOTs in our non-SNAPSHOT releases).

Thanks,

Mike

ekuefler commented 10 years ago

I'll try to push out the next version in another week or so if I don't hear any other feedback before then.

manstis commented 10 years ago

Thank-you Erik. I will keep an eye open for it.

manstis commented 9 years ago

Hello Erik,

Are you able to release the next version yet?

Thanks,

Mike

ekuefler commented 9 years ago

Yep, new version should be coming in the next couple of days.

On Mon Jul 07 2014 at 2:16:09 AM, Michael Anstis notifications@github.com wrote:

Hello Erik,

Are you able to release the next version yet?

Thanks,

Mike

— Reply to this email directly or view it on GitHub https://github.com/google/gwtmockito/issues/32#issuecomment-48156446.

ekuefler commented 9 years ago

I just pushed v1.1.4 to Maven Central - should be available in a few hours. Let me know if you have any issues with it.

manstis commented 9 years ago

Thanks Erik.

Works like a charm.

With kind regards,

Mike

On 11 July 2014 08:16, Erik Kuefler notifications@github.com wrote:

I just pushed v1.1.4 to Maven Central - should be available in a few hours. Let me know if you have any issues with it.

— Reply to this email directly or view it on GitHub https://github.com/google/gwtmockito/issues/32#issuecomment-48701014.