From 85d96c71f2293298d498179b9c466d5bebb692bc Mon Sep 17 00:00:00 2001 From: Oliver Gierke Date: Tue, 21 Jul 2015 16:49:53 +0200 Subject: [PATCH] DATACMNS-736 - Polishing. Tweaked unit test to check for the correct wording. Polished DistanceFormatterUnitTests to actually run in a Maven build. Original pull request: #134. --- .../geo/format/DistanceFormatterUnitTests.java | 5 +++++ .../data/geo/format/PointFormatterUnitTests.java | 14 +++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/springframework/data/geo/format/DistanceFormatterUnitTests.java b/src/test/java/org/springframework/data/geo/format/DistanceFormatterUnitTests.java index 40ab07da3..13f6f2549 100644 --- a/src/test/java/org/springframework/data/geo/format/DistanceFormatterUnitTests.java +++ b/src/test/java/org/springframework/data/geo/format/DistanceFormatterUnitTests.java @@ -43,6 +43,11 @@ public class DistanceFormatterUnitTests { static Distance REFERENCE = new Distance(10.8, Metrics.KILOMETERS); + @Test + public void testname() { + // To make sure Maven picks up the tests + } + public static class UnparameterizedTests { /** diff --git a/src/test/java/org/springframework/data/geo/format/PointFormatterUnitTests.java b/src/test/java/org/springframework/data/geo/format/PointFormatterUnitTests.java index 281ce4449..722c30c6e 100644 --- a/src/test/java/org/springframework/data/geo/format/PointFormatterUnitTests.java +++ b/src/test/java/org/springframework/data/geo/format/PointFormatterUnitTests.java @@ -24,8 +24,10 @@ import java.util.Arrays; import java.util.Collection; import java.util.Locale; +import org.junit.Rule; import org.junit.Test; import org.junit.experimental.runners.Enclosed; +import org.junit.rules.ExpectedException; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; @@ -49,11 +51,17 @@ public class PointFormatterUnitTests { public static class UnparameterizedTests { + public @Rule ExpectedException exception = ExpectedException.none(); + /** * @see DATAREST-279, DATACMNS-626 */ - @Test(expected = IllegalArgumentException.class) + @Test public void rejectsArbitraryNonsense() { + + exception.expect(IllegalArgumentException.class); + exception.expectMessage("comma"); + INSTANCE.convert("foo"); } @@ -79,8 +87,8 @@ public class PointFormatterUnitTests { @Parameters public static Collection parameters() { - return Arrays.asList(new String[] { "10.8,20.9" }, new String[] { " 10.8,20.9 " }, - new String[] { " 10.8 ,20.9" }, new String[] { " 10.8, 20.9 " }); + return Arrays.asList(new String[] { "10.8,20.9" }, new String[] { " 10.8,20.9 " }, new String[] { " 10.8 ,20.9" }, + new String[] { " 10.8, 20.9 " }); } public @Parameter String source;