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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:11:04+00:00 2026-06-11T16:11:04+00:00

I have an interesting requirement. I want to have as better test case coverage

  • 0

I have an interesting requirement. I want to have as better test case coverage as possible in my application. I am using Parameterized Junit to run testcases with number of different inputs. My sample test class looks like this:

@Parameters
public static Collection<Object[]> testInputs()
{
    return Arrays.asList({
        {1, CoreMatchers.is(1)},
        {2, CoreMatchers.is(2)}
    });
}
@Test
public test()
{
    myApp.run(); 
    assertThat(myApp.getA(), matcher);
}

This way, I defined the assertion logic with my test parameters. Now I want to run multiple matchers on the test case, some of them can be custom matchers which I wrote.

@Parameters
public static Collection<Object[]> testInputs()
{
    return Arrays.asList({
        {1, Arrays.asList( CoreMatchers.is(1), CustomMatchers.status(1) ) },
        {2, Arrays.asList( CoreMatchers.is(2), CustomMatchers.status(2) ) }
    });
}

And assertion is like:

for(Matcher<MyApp> matcher: matchers)
{
    assertThat(myApp, matcher);
}

But the problem is, both the matchers run on different objects. What is the best way I can define my CustomMatcher ??

Should I categorize the assertion by type of matcher?

I would appreciate any help. Thanks in advance.

  • 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-11T16:11:05+00:00Added an answer on June 11, 2026 at 4:11 pm

    I’m not sure what you mean by “both the matchers run on different objects,” but you can combine the matchers for a single test run using CoreMatchers.allOf. This way you don’t need to loop over a list of matchers and can pass any number of matchers, including one.

    @Parameters
    public static Collection<Object[]> testInputs()
    {
        return Arrays.asList({
            {1, CoreMatchers.allOf( CoreMatchers.is(1), CustomMatchers.status(1) ) },
            {2, CoreMatchers.allOf( CoreMatchers.is(2), CustomMatchers.status(2) ) }
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have what should be a fairly simple requirement. I want to use LINQ
Here is one very interesting problem. I am using SQL Server 2008. I have
Here we have an interesting real-world algorithm requirement involving colors. N Pretty Colors :
I have this kinda interesting requirement. Typically you use XSLT to transform an XML
I have interesting problem with my UiimageViews. I have an application (game with 2
So I have interesting password validation requirements: When a user signs up, I want
I have an interesting project requirement where we must accept a token as a
My requirement is pretty interesting, I want to maintain one cookie between two different
I'm working in WPF and i have an interesting requirement. I need my checkboxes
I have the usual large set of dependent jobs and want to run them

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.