From 4de72bfe8bf0b3eb4a306e3a45df4226bdd1e92e Mon Sep 17 00:00:00 2001 From: Robert von Burg Date: Mon, 15 Jan 2018 10:15:32 +0100 Subject: [PATCH] [Minor] Fix broken test --- .../utils/objectfilter/ObjectFilterTest.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/li.strolch.utils/src/test/java/li/strolch/utils/objectfilter/ObjectFilterTest.java b/li.strolch.utils/src/test/java/li/strolch/utils/objectfilter/ObjectFilterTest.java index c21e4366b..c24f5f827 100644 --- a/li.strolch.utils/src/test/java/li/strolch/utils/objectfilter/ObjectFilterTest.java +++ b/li.strolch.utils/src/test/java/li/strolch/utils/objectfilter/ObjectFilterTest.java @@ -1,12 +1,12 @@ /* * Copyright 2013 Robert von Burg - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -15,6 +15,7 @@ */ package li.strolch.utils.objectfilter; +import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assert.*; import java.util.List; @@ -100,7 +101,7 @@ public class ObjectFilterTest { filter.add(myObj, myObj); fail("Should have failed adding twice!"); } 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); @@ -118,7 +119,7 @@ public class ObjectFilterTest { filter.remove(myObj, myObj); fail("Should have failed removing twice!"); } 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); @@ -158,7 +159,7 @@ public class ObjectFilterTest { filter.add(myObj, myObj); fail("Should have failed add after modify"); } 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); @@ -186,7 +187,7 @@ public class ObjectFilterTest { filter.update(myObj, myObj); fail("Should have failed modify after remove"); } 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);