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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:30:16+00:00 2026-05-24T01:30:16+00:00

I am getting list of data from database from my Service Class Method mDataVO.getMarketData()

  • 0

I am getting list of data from database from my Service Class Method mDataVO.getMarketData() where mDataVO is an object of marketDataVO which is an value object for storing different types of data.

Inside my getMarketData(), i am making a Hibernate Query to get data out from the database. Now my goal is to unit test this data in my unit test class and make sure that am getting correct data our and returned data from method call is not stale and is same as latest value from the database.

For this purpose in my unit test class, i have used the same Hibernate Query and so am getting same set of data now this does not solve the purpose of unit testing as am just comparing same data which is obtained by running same query in the database. I am not sure how this case can be unit tested.

Am I missing out point of unit testing or not seeing any values in my
unit test case?

Update
Still question remains unanswered. Any more suggestions?

  • 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-24T01:30:17+00:00Added an answer on May 24, 2026 at 1:30 am

    The problem with testing databases is, as you might guess, the data.

    I think the way to attack this is to have a test database that matches your production schema. Do what you need to do to populate the database, test the data access objects, and then drop the test database.

    Another approach is to create the data set that you know you should get, insert it into the database, do your query and make sure that the query result matches the data set, and then roll the whole thing back as one transaction. That way your test data is always fresh but you don’t do any harm to your database.

    Test the database DAO for unit testing. Once it’s working, you should mock the DAO when you test the service. Unit testing the service means you aren’t worried about the DAO anymore. Just make sure that the service gets the data it needs to prove its proper operation.

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

Sidebar

Related Questions

I am getting data from a database and which is used to populate the
I am getting some list of values from DataBase var priceData = []; data.jobs[i].low
Im getting my data from a web service and loads to a list view.
I need to display the list of names which I am getting from the
The situation occurs when getting some data from the database to compose a report
I have a dropdown list box that displays data from my database. Problem is
I got a Windows Phone project which are getting an list of a object
I'm getting some data from my database and using linq to calculate sums and
Hi i am getting List object that contains pojo class objects of the table.
I'm getting a list of review items from a web service that dictates what

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.