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 7868261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:56:46+00:00 2026-06-03T00:56:46+00:00

In Vaadin as you may know overrided generateCell method is only called when Table

  • 0

In Vaadin as you may know overrided generateCell method is only called when Table needs to build its visible content. So When I write a JUnit Test for this class i couldnt trigger the generateCell method and test it. How can I test this any ideas? Or do I have to use a GUI test tool forthis (which I dont want to because it has quite expensive license)

public class AttributeColumnGenerator implements Table.ColumnGenerator {    
@Override
public Object generateCell(Table source, Object itemId, Object columnId) {
    //lots of code here to be tested
}
}
  • 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-06-03T00:56:48+00:00Added an answer on June 3, 2026 at 12:56 am

    From my understanding of the question, I don’t think you need to have a GUI test tool here.

    There’s my idea for simple testing :

    1. Create an instance AttributeColumnGenerator.
    2. Create an table.
    3. Add an Item to the table
    4. call generateCell with an columnId and itemId.
    5. Do the appropriate assert on the Component returned by the method.

    Here’s a snippet of my idea

    First my ColumnGenerator who only create a Label with the value of the cell.

    public class AttributeColumnGenerator implements Table.ColumnGenerator {
    
    public Object generateCell(Table source, Object itemId, Object columnId) {
    
        String textToDisplay  = (String)source.getItem(itemId).getItemProperty(columnId).getValue();
        return new Label(textToDisplay);
    }    
    

    }

    And the test method

        @Test
        public void attributeColumnGenratortest()
        {
    
            AttributeColumnGenerator columnGenerator = new AttributeColumnGenerator();
    
            Table table = new Table();
            String columnId = "test";
            table.addContainerProperty(columnId, String.class, "");
    
            String itemId = "item1";
            Item item = table.addItem(itemId);
            item.getItemProperty(columnId).setValue("Value of item1");
    
    
            Label generateObject = (Label)columnGenerator.generateCell(table, itemId, columnId);
    
            // Assert any properties of the returned Component.
            // In this snippet, I only printOut the boolean comparaison.
            System.out.println( "Value of item 1".equals(generateObject.getValue()));
        }
    

    Maybe it’s not the best solution, but it’s works.

    Hope it’s help!

    Regards.

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

Sidebar

Related Questions

HI im working with vaadin,I have a table and im using the addItem Method
In Vaadin's website it says that only Eclipse and NetBeans have fully functional (which
I have few Vaadin tabs one of them is displaying an table and some
I have a vaadin table where I use certain filters for filtering, just like
I'm just wondering if its possible to have a Vaadin project working under google
I've made a Vaadin table which contains (apart from Strings) a button (with a
Im trying to create a Table with Vaadin where you have different options in
In Vaadin, is it possible to somehow render a textarea that automatically adjusts its
im tryind to build an Vaadin tree from an XML file(MSDL), im stuck at
My Vaadin application provides a little table, which is editable. If the user -

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.