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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:50:24+00:00 2026-05-14T03:50:24+00:00

I have a class that uses XStream and is used as a transfer format

  • 0

I have a class that uses XStream and is used as a transfer format for my application. I am writing tests for other classes that map this transfer format to and from a different messaging standard. I would like to ensure that all getters on my class are called within a test to ensure that if a new field is added, my test properly checks for it.

A rough outline of the XStream class

@XStreamAlias("thing")
public class Thing implements Serializable {
 private int id;
 private int someField;

 public int getId(){ ... }
 public int someField() { ... }
}

So now if I update that class to be:

@XStreamAlias("thing")
public class Thing implements Serializable {
 private int id;
 private int someField;
 private String newField;

 public int getId(){ ... }
 public int getSomeField() { ... }
 public String getNewField(){ ... }
}

I would want my test to fail because the old tests are not calling getNewField().

The goal is to ensure that if new getters are added, that we have some way of ensuring that the tests check them.

Ideally, this would be contained entirely in the test and not require modifying the underlying Thing class.

Any ideas? Thanks for looking!

  • 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-14T03:50:24+00:00Added an answer on May 14, 2026 at 3:50 am

    May be code coverage tools is what you need. If you have 100% code coverage, all get methods have been called. If you are using eclipse, check EclEmma plugin.

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

Sidebar

Related Questions

I have a class that uses a variety of methods and other classes as
I have a custom class that uses boost mutexes and locks like this (only
I have a class that uses libxml2. It has static members which are used
i have a class that uses a proxy class inside to call a service
I have a class that uses org.apache.ant and the class is very simple, it's
I have a class that uses priority queue to display 5 strings in ascending
I have a UITableView class that uses the following methods to call a loading
I have a model class that uses a custom validator as shown in following
Is it good practice to have a class constructor that uses default parameters, or
I have created a button CSS class that uses background images with different positions

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.