Skip to content

Commit

Permalink
Fixes split on TXTData
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Cole committed Sep 18, 2015
1 parent aa37eaf commit f16d173
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion model/src/main/java/denominator/common/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public static String flatten(Map<String, Object> input) {
}

public static Map<String, Object> 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<String, Object> toMap(String type, List<String> parts) {
Expand Down
7 changes: 6 additions & 1 deletion model/src/test/java/denominator/common/UtilTest.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -163,7 +164,6 @@ public void filterRetains() {
public boolean apply(String breakfast) {
return "pancakes".equals(breakfast);
}

});
assertThat(it).containsExactly("pancakes");
}
Expand All @@ -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"));
}
}

0 comments on commit f16d173

Please sign in to comment.