@@ -0,0 +1,1813 @@
+package com.levelup.java.junit;%0A%0Aimport static org.junit.Assert.assertThat;%0Aimport static org.junit.matchers.JUnitMatchers.*;%0A%0Aimport java.util.List;%0A%0Aimport org.junit.Test;%0A%0Aimport com.google.common.collect.Lists;%0A%0A/**%0A * This java example will demonstrate Junit matchers%0A * %0A * @author Justin Musgrove%0A * @see %3Ca href='http://www.leveluplunch.com/java/examples/junit-matchers/'%3EJunit matchers%3C/a%3E%0A * %0A */%0Apublic class JunitMatchers %7B%0A%0A//%09Per release notes https://github.com/junit-team/junit/blob/master/doc/ReleaseNotes4.11.md%0A//%09Most of the matchers in JUnitMatchers have been deprecated. Please use org.hamcrest.CoreMatchers directly.%0A//%09http://junit-team.github.io/junit/javadoc/latest/org/junit/matchers/JUnitMatchers.html%0A%09%0A%09@SuppressWarnings(%22deprecation%22)%0A%09@Test%0A%09public void test_string_contains_two_elements () %7B%0A%09%09%0A%09%09assertThat(%22B-double E double R U-N beer run%22, %0A%09%09%09%09both(containsString(%22beer%22))%0A%09%09%09%09.and(containsString(%22run%22)));%0A%09%7D%0A%09%0A%09@SuppressWarnings(%22deprecation%22)%0A%09@Test%0A%09public void test_string_contains () %7B%0A%09%09%0A%09%09assertThat(%22Meet the press%22,%0A%09%09%09%09containsString(%22press%22));%0A%09%7D%0A%09%0A%09@SuppressWarnings(%22deprecation%22)%0A%09@Test%0A%09public void test_string_either_or () %7B%0A%0A%09%09assertThat(%22the simpsons%22,%0A%09%09%09%09either(containsString(%22the%22)).or(containsString(%22simpsons%22)));%0A%09%7D%0A%0A%09@SuppressWarnings(%22deprecation%22)%0A%09@Test%0A%09public void test_every_item_contains () %7B%0A%09%09%0A%09%09List%3CString%3E movies = Lists.newArrayList(%0A%09%09%09%09%22the matrix%22, %0A%09%09%09%09%22the lord of the rings%22, %0A%09%09%09%09%22the lion king%22, %0A%09%09%09%09%22the dark knight%22);%0A%09%09assertThat(movies, everyItem(containsString(%22the%22)));%0A%09%7D%0A%09%0A%09@SuppressWarnings(%22deprecation%22)%0A%09@Test%0A%09public void test_list_has_items () %7B%0A%0A%09%09List%3CString%3E websites = Lists.newArrayList(%0A%09%09%09%09%22leveluplunch.com%22, %0A%09%09%09%09%22www.leveluplunch.com%22 );%0A%0A%09    assertThat(websites, hasItems(%22leveluplunch.com%22));%0A%09%7D%0A%0A%7D%0A

add junit matchers