memcachedClient.delete("name");
assertFalse(memcachedClient.prepend("name", "hello ", 2000));
assertFalse(memcachedClient.append("name", " zhuang", 2000));
// append test
// blank key
new BlankKeyChecker() {
@Override
public void call() throws Exception {
memcachedClient.append("", 0, 1);
}
}.check();
// null key
new BlankKeyChecker() {
@Override
public void call() throws Exception {
memcachedClient.append((String) null, 0, 1);
}
}.check();
// invalid key
new InValidKeyChecker() {
@Override
public void call() throws Exception {
memcachedClient.append("test\r\n", 0, 1);
}
}.check();
new InValidKeyChecker() {
@Override
public void call() throws Exception {
memcachedClient.append("test test2", 0, 1);
}
}.check();
// key is too long
new TooLongKeyChecker(memcachedClient) {
@Override
public void call() throws Exception {
int keyLength = memcachedClient.getProtocol() == Protocol.Text ? 256
: 65536;
StringBuilder sb = new StringBuilder();
for (int i = 0; i < keyLength; i++) {
sb.append(i);
}
memcachedClient.append(sb.toString(), 0, 1);
}
}.check();
// prepend test
// blank key
new BlankKeyChecker() {
@Override
public void call() throws Exception {
memcachedClient.prepend("", 0, 1);
}
}.check();
// null key
new BlankKeyChecker() {
@Override
public void call() throws Exception {
memcachedClient.prepend((String) null, 0, 1);
}
}.check();