com.noenv.wiremongo.mapping.collection.GetCollections Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vertx-wiremongo Show documentation
Show all versions of vertx-wiremongo Show documentation
Lightweight mongo mocking for Vert.x
package com.noenv.wiremongo.mapping.collection;
import com.noenv.wiremongo.command.collection.GetCollectionsCommand;
import com.noenv.wiremongo.mapping.MappingBase;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class GetCollections extends MappingBase, GetCollectionsCommand, GetCollections> {
public GetCollections() {
super("getCollections");
}
public GetCollections(JsonObject json) {
super(json);
}
@Override
public GetCollections returns(final List response) {
return stub(c -> null == response ? null : new ArrayList<>(response));
}
@Override
protected List parseResponse(Object jsonValue) {
return ((JsonArray) jsonValue).stream()
.map(o -> (String) o)
.collect(Collectors.toList());
}
}