[Minor] Fix broken test

This commit is contained in:
Robert von Burg 2018-01-15 10:15:32 +01:00
parent c5e272eabd
commit 4de72bfe8b
1 changed files with 8 additions and 7 deletions

View File

@ -15,6 +15,7 @@
*/ */
package li.strolch.utils.objectfilter; package li.strolch.utils.objectfilter;
import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.util.List; import java.util.List;
@ -100,7 +101,7 @@ public class ObjectFilterTest {
filter.add(myObj, myObj); filter.add(myObj, myObj);
fail("Should have failed adding twice!"); fail("Should have failed adding twice!");
} catch (RuntimeException e) { } catch (RuntimeException e) {
assertEquals("Stale State exception: Invalid + after +", e.getMessage()); assertThat(e.getMessage(), containsString("Stale State exception: Invalid + after +"));
} }
testAssertions(filter, 1, 1, 1, 0, 0); testAssertions(filter, 1, 1, 1, 0, 0);
@ -118,7 +119,7 @@ public class ObjectFilterTest {
filter.remove(myObj, myObj); filter.remove(myObj, myObj);
fail("Should have failed removing twice!"); fail("Should have failed removing twice!");
} catch (RuntimeException e) { } catch (RuntimeException e) {
assertEquals("Stale State exception: Invalid - after -", e.getMessage()); assertThat(e.getMessage(), containsString("Stale State exception: Invalid - after -"));
} }
testAssertions(filter, 1, 1, 0, 0, 1); testAssertions(filter, 1, 1, 0, 0, 1);
@ -158,7 +159,7 @@ public class ObjectFilterTest {
filter.add(myObj, myObj); filter.add(myObj, myObj);
fail("Should have failed add after modify"); fail("Should have failed add after modify");
} catch (RuntimeException e) { } catch (RuntimeException e) {
assertEquals("Stale State exception: Invalid + after +=", e.getMessage()); assertThat(e.getMessage(), containsString("Stale State exception: Invalid + after +="));
} }
testAssertions(filter, 1, 1, 0, 1, 0); testAssertions(filter, 1, 1, 0, 1, 0);
@ -186,7 +187,7 @@ public class ObjectFilterTest {
filter.update(myObj, myObj); filter.update(myObj, myObj);
fail("Should have failed modify after remove"); fail("Should have failed modify after remove");
} catch (RuntimeException e) { } catch (RuntimeException e) {
assertEquals("Stale State exception: Invalid += after -", e.getMessage()); assertThat(e.getMessage(), containsString("Stale State exception: Invalid += after -"));
} }
testAssertions(filter, 1, 1, 0, 0, 1); testAssertions(filter, 1, 1, 0, 0, 1);