Skip to content

Commit

Permalink
fixing config reader. fixes graphhopper#551
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter committed Oct 20, 2015
1 parent 2e7b9ca commit 63834d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/java/com/graphhopper/util/Helper.java
Expand Up @@ -124,7 +124,7 @@ public static void loadProperties( Map<String, String> map, Reader tmpReader ) t

String field = line.substring(0, index);
String value = line.substring(index + 1);
map.put(field, value);
map.put(field.trim(), value.trim());
}
} finally
{
Expand Down
13 changes: 13 additions & 0 deletions core/src/test/java/com/graphhopper/util/HelperTest.java
Expand Up @@ -18,7 +18,11 @@
package com.graphhopper.util;

import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;

import org.junit.After;
import org.junit.Test;
Expand Down Expand Up @@ -89,4 +93,13 @@ public void testKeepIn()
assertEquals(3, Helper.keepIn(2, 3, 4), 1e-2);
assertEquals(3, Helper.keepIn(-2, 3, 4), 1e-2);
}

@Test
public void testLoadProperties() throws IOException
{
Map<String, String> map = new HashMap<String, String>();
Helper.loadProperties(map, new StringReader("blup=test\n blup2 = xy"));
assertEquals("test", map.get("blup"));
assertEquals("xy", map.get("blup2"));
}
}

0 comments on commit 63834d5

Please sign in to comment.