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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:05:45+00:00 2026-06-16T00:05:45+00:00

Running assertThat(collection, allOf(hasItems(i1, i2, i3), hasSize(3))); from Eclipse (Run as -> Junit) everything works

  • 0

Running

assertThat(collection, allOf(hasItems(i1, i2, i3), hasSize(3)));

from Eclipse (Run as -> Junit) everything works fine, but when I execute Maven test (mvn clean test) it fails during test-compile phase with the following explanation

[ERROR] The method allOf(Matcher<? super T>, Matcher<? super T>) in the type AllOf<T> is not applicable for the arguments (Matcher<Iterable<Song>>, Matcher<Collection<? extends Object>>)

The dependencies are

<dependency>
  <groupId>org.hamcrest</groupId>
  <artifactId>hamcrest-all</artifactId>
  <version>1.3</version>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit-dep</artifactId>
  <version>4.10</version>
  <scope>test</scope>
  <exclusions>
    <exclusion>
      <artifactId>hamcrest-core</artifactId>
      <groupId>org.hamcrest</groupId>
    </exclusion>
  </exclusions>
</dependency>

What am i doing wrong?

Thanks

Stefano

  • 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-16T00:05:46+00:00Added an answer on June 16, 2026 at 12:05 am

    You must specify type arguments for the methods hasItems and hasSize. Automatic type inference by the compiler doesn’t work in your case. To specify the type arguments, you must not use the static imported methods, but qualify them with their declaring class – Matchers.<Song>hasItems(i1,i2,i3) for example.

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

Sidebar

Related Questions

Running Safari 5.05. This CSS is looks fine in Chrome and Firefox, but when
I'm currently running Hamcrest 1.3RC on top of JUnit 4 on top of Eclipse
running(fakeApplication(), new Runnable() { public void run() { Content html = views.html.index.render(loginForm); assertThat(contentType(html)).isEqualTo(text/html); assertThat(contentAsString(html)).contains(log
Running this query takes a long time: SELECT host,ip FROM arecords WHERE ip IN
Running the following code in Delphi XE2 Win32 platform works. However, the same code
Running valgrind or purify would be the next steps But while while writing the
Running Python 2.5 on Windows XP SP2. When I run a Python script that
Running VS2003, nHB 3.0.0.3001, trying to run a unit test through Gallio 3.2. The
Running this works as expected: (defn long-seq [n] (lazy-seq (cons (list n {:somekey (*
In JUnit 3, I could get the name of the currently running test like

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.