Skip to content

Commit

Permalink
return (nil) for null. pom update.
Browse files Browse the repository at this point in the history
  • Loading branch information
minkenlai committed May 7, 2016
1 parent b86757a commit 5b9f61f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source/>
<target/>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
</project>
3 changes: 2 additions & 1 deletion src/com/kenlai/MKLRedis/CommandProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public String process(String fullCmd) {
return store.set(tokens[1], tokens[2], expiration);
case GET:
verifyLength(tokens, 2);
return store.get(tokens[1]);
String value = store.get(tokens[1]);
return (value == null) ? "(nil)" : value;
case INCR:
verifyLength(tokens, 2);
return store.incr(tokens[1]).toString();
Expand Down
1 change: 1 addition & 0 deletions test/com/kenlai/MKLRedis/CommandProcessorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public void testProcess() {
assertEquals(OK, cp.process("SET foo bar"));
assertTrue(cp.process("BAD").startsWith(ERROR));
assertTrue(cp.process("What+is&this?").startsWith(ERROR));
assertEquals("(nil)", cp.process("GET bar"));

assertEquals("1", cp.process("INCR numerical"));
assertEquals("2", cp.process("DBSIZE"));
Expand Down

0 comments on commit 5b9f61f

Please sign in to comment.