// Path: src/main/java/com/groupon/vertx/memcache/MemcacheException.java
// public class MemcacheException extends RuntimeException {
//     private static final long serialVersionUID = -386882705199382789L;
// 
//     public MemcacheException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/JsendStatus.java
// public enum JsendStatus {
//     success,
//     error,
//     fail;
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/response/ModifyCommandResponse.java
// public final class ModifyCommandResponse extends MemcacheCommandResponse {
//     private final Integer data;
// 
//     private ModifyCommandResponse(Builder builder) {
//         super(builder);
//         data = builder.data;
//     }
// 
//     public Integer getData() {
//         return data;
//     }
// 
//     /**
//      * Builder for the ModifyCommandResponse
//      */
//     public static class Builder extends AbstractBuilder<Builder, ModifyCommandResponse> {
//         private Integer data;
// 
//         @Override
//         protected Builder self() {
//             return this;
//         }
// 
//         public Builder setData(Integer value) {
//             data = value;
//             return self();
//         }
// 
//         @Override
//         public ModifyCommandResponse build() {
//             return new ModifyCommandResponse(this);
//         }
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/stream/MemcacheResponseType.java
// public enum MemcacheResponseType {
//     VALUE("VALUE ", false),
//     STORED("STORED", true),
//     DELETED("DELETED", true),
//     TOUCHED("TOUCHED", true),
//     NOT_STORED("NOT_STORED", true),
//     EXISTS("EXISTS", true),
//     NOT_FOUND("NOT_FOUND", true),
//     END("END", true),
//     ERROR("ERROR", true),
//     CLIENT_ERROR("CLIENT ERROR", false),
//     SERVER_ERROR("SERVER ERROR", false);
// 
//     public final String type;
//     public final boolean exact;
// 
//     MemcacheResponseType(String type, boolean exact) {
//         this.type = type;
//         this.exact = exact;
//     }
// 
//     public boolean matches(ByteArrayOutputStream line) {
//         boolean match;
//         try {
//             if (!exact) {
//                 match = line.toString("UTF-8").startsWith(type);
//             } else {
//                 match = line.toString("UTF-8").equals(type);
//             }
//         } catch (UnsupportedEncodingException e) {
//             match = false;
//         }
//         return match;
//     }
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import org.junit.Before;
import org.junit.Test;
import com.groupon.vertx.memcache.MemcacheException;
import com.groupon.vertx.memcache.client.JsendStatus;
import com.groupon.vertx.memcache.client.response.ModifyCommandResponse;
import com.groupon.vertx.memcache.stream.MemcacheResponseType;
        assertEquals("Wrong status", JsendStatus.success, response.getStatus());
        assertEquals("Value not parsed", Integer.valueOf(12345), response.getData());
    }

    @Test
    public void testNonIntegerResult() throws Exception {
        outputStream.write("hello".getBytes());
        try {
            parser.isResponseEnd(outputStream);
            assertTrue("Failed to throw exception", false);
        } catch (MemcacheException me) {
            assertEquals("Unexpected exception", "Unexpected format in response", me.getMessage());
        }
    }

    @Test
    public void testNotFoundResult() throws Exception {
        outputStream.write(MemcacheResponseType.NOT_FOUND.type.getBytes());
        assertTrue("Failed to parse value", parser.isResponseEnd(outputStream));

        ModifyCommandResponse response = parser.getResponse();
        assertEquals("Wrong status", JsendStatus.success, response.getStatus());
        assertNull("Value should be null", response.getData());
    }

    @Test
    public void testErrorEndLine() throws Exception {
        outputStream.write(MemcacheResponseType.ERROR.type.getBytes());
        assertTrue("Failed to identify end", parser.isResponseEnd(outputStream));
        ModifyCommandResponse response = parser.getResponse();
// Path: src/main/java/com/groupon/vertx/memcache/MemcacheException.java
// public class MemcacheException extends RuntimeException {
//     private static final long serialVersionUID = -386882705199382789L;
// 
//     public MemcacheException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/JsendStatus.java
// public enum JsendStatus {
//     success,
//     error,
//     fail;
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/client/response/ModifyCommandResponse.java
// public final class ModifyCommandResponse extends MemcacheCommandResponse {
//     private final Integer data;
// 
//     private ModifyCommandResponse(Builder builder) {
//         super(builder);
//         data = builder.data;
//     }
// 
//     public Integer getData() {
//         return data;
//     }
// 
//     /**
//      * Builder for the ModifyCommandResponse
//      */
//     public static class Builder extends AbstractBuilder<Builder, ModifyCommandResponse> {
//         private Integer data;
// 
//         @Override
//         protected Builder self() {
//             return this;
//         }
// 
//         public Builder setData(Integer value) {
//             data = value;
//             return self();
//         }
// 
//         @Override
//         public ModifyCommandResponse build() {
//             return new ModifyCommandResponse(this);
//         }
//     }
// }
// 
// Path: src/main/java/com/groupon/vertx/memcache/stream/MemcacheResponseType.java
// public enum MemcacheResponseType {
//     VALUE("VALUE ", false),
//     STORED("STORED", true),
//     DELETED("DELETED", true),
//     TOUCHED("TOUCHED", true),
//     NOT_STORED("NOT_STORED", true),
//     EXISTS("EXISTS", true),
//     NOT_FOUND("NOT_FOUND", true),
//     END("END", true),
//     ERROR("ERROR", true),
//     CLIENT_ERROR("CLIENT ERROR", false),
//     SERVER_ERROR("SERVER ERROR", false);
// 
//     public final String type;
//     public final boolean exact;
// 
//     MemcacheResponseType(String type, boolean exact) {
//         this.type = type;
//         this.exact = exact;
//     }
// 
//     public boolean matches(ByteArrayOutputStream line) {
//         boolean match;
//         try {
//             if (!exact) {
//                 match = line.toString("UTF-8").startsWith(type);
//             } else {
//                 match = line.toString("UTF-8").equals(type);
//             }
//         } catch (UnsupportedEncodingException e) {
//             match = false;
//         }
//         return match;
//     }
// }


// Path: src/test/java/com/groupon/vertx/memcache/parser/ModifyLineParserTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import org.junit.Before;
import org.junit.Test;
import com.groupon.vertx.memcache.MemcacheException;
import com.groupon.vertx.memcache.client.JsendStatus;
import com.groupon.vertx.memcache.client.response.ModifyCommandResponse;
import com.groupon.vertx.memcache.stream.MemcacheResponseType;

        assertEquals("Wrong status", JsendStatus.success, response.getStatus());
        assertEquals("Value not parsed", Integer.valueOf(12345), response.getData());
    }

    @Test
    public void testNonIntegerResult() throws Exception {
        outputStream.write("hello".getBytes());
        try {
            parser.isResponseEnd(outputStream);
            assertTrue("Failed to throw exception", false);
        } catch (MemcacheException me) {
            assertEquals("Unexpected exception", "Unexpected format in response", me.getMessage());
        }
    }

    @Test
    public void testNotFoundResult() throws Exception {
        outputStream.write(MemcacheResponseType.NOT_FOUND.type.getBytes());
        assertTrue("Failed to parse value", parser.isResponseEnd(outputStream));

        ModifyCommandResponse response = parser.getResponse();
        assertEquals("Wrong status", JsendStatus.success, response.getStatus());
        assertNull("Value should be null", response.getData());
    }

    @Test
    public void testErrorEndLine() throws Exception {
        outputStream.write(MemcacheResponseType.ERROR.type.getBytes());
        assertTrue("Failed to identify end", parser.isResponseEnd(outputStream));
        ModifyCommandResponse response = parser.getResponse();
        assertEquals("Wrong status", JsendStatus.error, response.getStatus());