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")); + } }