Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:45:48+00:00 2026-05-30T09:45:48+00:00

I got a view (GWT MVP pattern) that contains a listbox. I created a

  • 0

I got a view (GWT MVP pattern) that contains a listbox.
I created a testcase using @Mock MyView viewThen in one test I want to be able to have a hand on the list box object using :

ListBox listBox = GwtReflectionUtils.getPrivateFieldValue(view, "tableListBox");

This returns null.

I followed this tutorial : http://code.google.com/p/gwt-test-utils/wiki/SimpleUnitTest which using the same way.

The only difference I see is I’m using UIBinder, however it should be supported from what I’ve read.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:45:49+00:00Added an answer on May 30, 2026 at 9:45 am

    You are using a mock, of course fields aren’t set. When working with mocks you have to think about interactions, not state. (Actually this statement is true with generated mocks like those of mockito, powermock, easymock, etc.)

    The wiki links examples don’t use mocks, they show real objects!

    I think you will be more interested by a spy. You can use @Spy.
    In mockito 1.9.0 you can write :

    @Spy MyView view = new MyView(paramA, paramB);
    

    or if MyView has default constructor

    @Spy MyView view = new MyView();
    @Spy MyView view; // equivalent, mockito will call the default constructor
    

    For more information take a look at the javadoc.

    Hope that helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're using gwt-presenter, but not really a question specific to that... I've got a
I got a view controller class (MyViewController) that deals with a UIView subclass (MyView).
I've got a view which shows a listbox that is bound to GetAll() :
I'm building my first GWT app, designed in MVP pattern. Now I've got a
I've got a view that contains a UIWebView (With text images, etc) that is
I've got a View that contains code that allows the user to upload images.
I got a view that inherits : System.Web.Mvc.ViewPage<IEnumerable<MyProjects.Models.MyAccountWrapper>> In this view I list data
I've got a view in my app that does pretty much everything, and I
I've got a view function that has to decide which form to use depending
I've got a tree view that can be anywhere from 1 level deep to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.