<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Hamcrest on Micha Kops&#39; Tech Notes</title>
    <link>https://www.hascode.com/tags/hamcrest/</link>
    <description>Recent content in Hamcrest on Micha Kops&#39; Tech Notes</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>Copyright © 2010 - 2025 Micha Kops. #e9d956c0c0154a221ad83c925346a8fa0e72f866</copyright>
    <lastBuildDate>Sun, 18 Nov 2012 00:00:00 +0100</lastBuildDate>
    <atom:link href="https://www.hascode.com/tags/hamcrest/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>New features in JUnit 4.11</title>
      <link>https://www.hascode.com/new-features-in-junit-4.11/</link>
      <pubDate>Sun, 18 Nov 2012 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/new-features-in-junit-4.11/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;JUnit is one of the most popular testing frameworks out there. Version 4.11 has just been released and offers some nice improvements that you shouldn’t miss.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_dependencies&#34;&gt;Dependencies&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In older versions of JUnit there were two dependencies .. &lt;em&gt;junit:junit&lt;/em&gt; contained an old version of hamcrest and could cause some nasty trouble .. &lt;em&gt;junit:junit-dep&lt;/em&gt; just referenced hamcrest the maven way.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Now with version 4.11 there is just &lt;em&gt;junit:junit&lt;/em&gt; with clean references to hamcrest and &lt;em&gt;junit:junit-dep&lt;/em&gt; is relocated to &lt;em&gt;junit:junit&lt;/em&gt;.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Make your Tests more readable with custom Hamcrest Matchers</title>
      <link>https://www.hascode.com/make-your-tests-more-readable-with-custom-hamcrest-matchers/</link>
      <pubDate>Sun, 28 Oct 2012 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/make-your-tests-more-readable-with-custom-hamcrest-matchers/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Everyday we’re writing tests for our software and sometimes we’re in a situation where we’re testing a specific type or object very often.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Luckily Hamcrest allows us to create custom matchers by subclassing from a given variety of available matchers.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_adding_junit_and_hamcrest&#34;&gt;Adding jUnit and Hamcrest&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;First add the dependencies for &lt;em&gt;JUniti&lt;/em&gt; and &lt;em&gt;Hamcrest&lt;/em&gt; to your project’s &lt;em&gt;pom.xml&lt;/em&gt; or alternative build system.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;listingblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;pre class=&#34;highlight&#34;&gt;&lt;code class=&#34;language-xml&#34; data-lang=&#34;xml&#34;&gt;&amp;lt;dependencies&amp;gt;
    &amp;lt;dependency&amp;gt;
        &amp;lt;groupId&amp;gt;junit&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;junit&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;4.10&amp;lt;/version&amp;gt;
        &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
    &amp;lt;/dependency&amp;gt;
    &amp;lt;dependency&amp;gt;
        &amp;lt;groupId&amp;gt;org.hamcrest&amp;lt;/groupId&amp;gt;
        &amp;lt;artifactId&amp;gt;hamcrest-all&amp;lt;/artifactId&amp;gt;
        &amp;lt;version&amp;gt;1.3&amp;lt;/version&amp;gt;
        &amp;lt;scope&amp;gt;test&amp;lt;/scope&amp;gt;
    &amp;lt;/dependency&amp;gt;
&amp;lt;/dependencies&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>REST-assured vs Jersey-Test-Framework: Testing your RESTful Web-Services</title>
      <link>https://www.hascode.com/rest-assured-vs-jersey-test-framework-testing-your-restful-web-services/</link>
      <pubDate>Mon, 05 Sep 2011 00:00:00 +0200</pubDate>
      <guid>https://www.hascode.com/rest-assured-vs-jersey-test-framework-testing-your-restful-web-services/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Today we’re going to take a look at two specific frameworks that enables you to efficiently test your REST-ful services: On the one side there is the framework &lt;strong&gt;REST-assured&lt;/strong&gt; that offers a nice DSL-like syntax to create well readable tests – on the other side there is the &lt;strong&gt;Jersey-Test-Framework&lt;/strong&gt; that offers a nice execution environment and is built upon the JAX-RS reference implementation, Jersey.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;imageblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;rest-service-testing-logo.png&#34; alt=&#34;rest service testing logo&#34;/&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;In the following tutorial we’re going to create a simple REST service first and then implement integration tests for this service using both frameworks.&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
    <item>
      <title>Mocking, Stubbing and Test Spying using the Mockito Framework and PowerMock</title>
      <link>https://www.hascode.com/mocking-stubbing-and-test-spying-using-the-mockito-framework-and-powermock/</link>
      <pubDate>Sun, 27 Mar 2011 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/mocking-stubbing-and-test-spying-using-the-mockito-framework-and-powermock/</guid>
      <description>&lt;div id=&#34;preamble&#34;&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;imageblock&#34;&gt;
&lt;div class=&#34;content&#34;&gt;
&lt;img src=&#34;mockito-tutorial.png&#34; alt=&#34;mockito tutorial&#34;/&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;Today we’re going to take a look at the Mockito framework that not only does sound like my favourite summer cocktail but also offers nice testing, mocking/stubbing, test-spying features and mock injections.&lt;/p&gt;
&lt;/div&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;After that we’re going to take a look on how to mock static or final classes by extending Mockito’s capabilities with PowerMock.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&#34;sect1&#34;&gt;
&lt;h2 id=&#34;_prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;div class=&#34;sectionbody&#34;&gt;
&lt;div class=&#34;paragraph&#34;&gt;
&lt;p&gt;We don’t need much for the following samples .. Java of course, Maven dependency management and that’s all ..&lt;/p&gt;
&lt;/div&gt;</description>
    </item>
  </channel>
</rss>
