Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to create an Unitary Test for this code block?

  1. #1
    Junior Member
    Join Date
    Jul 2020
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to create an Unitary Test for this code block?

    Hi!,

    I really have no idea how to create a simple unitary test.

    It would be just for this code block:
            if(totalReviewsCount > 0) {
                QueryReviewAirlineResult queryReviewAirlineResult = new QueryReviewAirlineResult();
                queryReviewAirlineResult.setAverageScore(SFMCRowToQueryReviewResultTransfer.getRoundedUpValue(String.valueOf(accumulatedReviewRating / totalReviewsCount)));
                queryReviewAirlineResult.setNumberReviews(totalReviewsCount);
                queryReviewAirlineResult.setAirlineIataCode(airlineIataCode);
                return Collections.singletonList(queryReviewAirlineResult);
            }
    Any idea how to create a simple Unitary Test?.

    Thanks
    Last edited by vortex; July 28th, 2020 at 02:32 AM.

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: How to create an Unitary Test for this code block?

    Have you asked this question of Google?
    unitary test java

    Please edit your post and wrap your code with code tags:

    [code]
    **YOUR CODE GOES HERE**
    [/code]

    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. how do I test my code on a tablet?
    By saveyourself1 in forum What's Wrong With My Code?
    Replies: 9
    Last Post: June 12th, 2014, 01:08 PM
  2. help me to create Block Breaker (using OOP method)
    By gelzkie22 in forum Object Oriented Programming
    Replies: 2
    Last Post: September 25th, 2013, 02:21 AM
  3. create a test class (main method) to start(run) the class in Java
    By curious725 in forum Java Theory & Questions
    Replies: 5
    Last Post: August 1st, 2012, 03:21 AM
  4. [SOLVED] New to java, need to know how to incorparate system time into a block of code.
    By lostbit in forum Java Theory & Questions
    Replies: 5
    Last Post: September 29th, 2011, 07:46 AM
  5. Replies: 0
    Last Post: February 3rd, 2009, 01:15 AM

Tags for this Thread