From f16d173f64004751c5df99d38673e2af9af1ed0b Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Fri, 18 Sep 2015 14:46:13 -0400 Subject: [PATCH] Fixes split on TXTData --- model/src/main/java/denominator/common/Util.java | 2 +- model/src/test/java/denominator/common/UtilTest.java | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/model/src/main/java/denominator/common/Util.java b/model/src/main/java/denominator/common/Util.java index aaad8c0c..416b2adf 100644 --- a/model/src/main/java/denominator/common/Util.java +++ b/model/src/main/java/denominator/common/Util.java @@ -240,7 +240,7 @@ public static String flatten(Map input) { } public static Map toMap(String type, String rdata) { - return toMap(type, Util.split(' ', rdata)); + return "TXT".equals(type) ? TXTData.create(rdata) : toMap(type, Util.split(' ', rdata)); } public static Map toMap(String type, List parts) { diff --git a/model/src/test/java/denominator/common/UtilTest.java b/model/src/test/java/denominator/common/UtilTest.java index da30da38..28e631a8 100644 --- a/model/src/test/java/denominator/common/UtilTest.java +++ b/model/src/test/java/denominator/common/UtilTest.java @@ -1,5 +1,6 @@ package denominator.common; +import denominator.model.rdata.TXTData; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -163,7 +164,6 @@ public void filterRetains() { public boolean apply(String breakfast) { return "pancakes".equals(breakfast); } - }); assertThat(it).containsExactly("pancakes"); } @@ -190,4 +190,9 @@ public boolean apply(String breakfast) { assertTrue(and(startsWithP, notPoo).apply("pancakes")); assertFalse(and(startsWithP, notPoo).apply("poo")); } + + @Test + public void toMapDoesntSplitTXT() { + assertThat(Util.toMap("TXT", "ONE TWO THREE")).isEqualTo(TXTData.create("ONE TWO THREE")); + } }