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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:37:57+00:00 2026-06-11T15:37:57+00:00

How do I test parameters inside a method itself. For example class TestClass {

  • 0

How do I test parameters inside a method itself. For example

class TestClass {

public void paraMethod(String para1, String para2) {
         String testPara1 = para1;
         String testPara2 = para2; 
}
}

class TestingClass {

   @Test
   public void testParaMethod () throws Exception {
             String myPara1 = "MyPara1"; 
             String myPara2 = "MyPara2";

             new TestClass().paraMethod(myPara1, myPara2);

   }
}

Ok, so is it possible to test if the testPara1 and testPara2 are properly set to the values that I have passed?

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-06-11T15:37:58+00:00Added an answer on June 11, 2026 at 3:37 pm

    It is neither possible nor desirable to test the values and state changes of local variables of a method. They are private details of the implementation, not something you are expected to test.

    Instead, your tests should judge the correctness of a method by observing something visible from the outside, such as return values, interactions with mocked environment, or externally visible changes of the object’s state.

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

Sidebar

Related Questions

public class a { public event eventhandler test; public void RaiseTest(){//fire test} } Is
I have a stored procedure'test' in Sybase ASA with for example 4 parameters. par1
I have following test [Test] public void aaa() { CallContext.LogicalSetData(aa, 1); Action parallelMethod =
I'm writing a test for a file parser class. The parse method receives a
Say I have the following: [Test] // would like to parameterize the parameters in
I have a Spring JUnit test with configuration files and @ContextConfiguration parameters: package ru.csbi.registry.domain.envers.integration;
In clojure, keywords evaluate to themselves, e.g.: >>:test :test They don't take any parameters,
I have a method that I want to test which expects an IEnumerable<T> as
Inside my html file I call a javascript function that takes two parameters, where
The Test class of my application is extending AbstractSingleSpringContextTests. We are loading all the

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.