method2testcases
stringlengths
118
3.08k
### Question: MultiGeometry implements Geometry { public List<Geometry> getGeometryObject() { return mGeometries; } MultiGeometry(List<? extends Geometry> geometries); String getGeometryType(); List<Geometry> getGeometryObject(); void setGeometryType(String type); @Override String toString(); }### Answer: @Test public...
### Question: LineString implements Geometry<List<LatLng>> { public String getGeometryType() { return GEOMETRY_TYPE; } LineString(List<LatLng> coordinates); String getGeometryType(); List<LatLng> getGeometryObject(); @Override String toString(); }### Answer: @Test public void testGetType() { LineString lineString = cr...
### Question: LineString implements Geometry<List<LatLng>> { public List<LatLng> getGeometryObject() { return mCoordinates; } LineString(List<LatLng> coordinates); String getGeometryType(); List<LatLng> getGeometryObject(); @Override String toString(); }### Answer: @Test public void testGetGeometryObject() { LineStrin...
### Question: GeoJsonPointStyle extends Style implements GeoJsonStyle { @Override public String[] getGeometryType() { return GEOMETRY_TYPE; } GeoJsonPointStyle(); @Override String[] getGeometryType(); float getAlpha(); void setAlpha(float alpha); float getAnchorU(); float getAnchorV(); void setAnchor(float anchorU, flo...
### Question: GeoJsonLayer extends Layer { public Iterable<GeoJsonFeature> getFeatures() { return (Iterable<GeoJsonFeature>) super.getFeatures(); } GeoJsonLayer(GoogleMap map, JSONObject geoJsonFile, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager ground...
### Question: GeoJsonLayer extends Layer { public void addFeature(GeoJsonFeature feature) { if (feature == null) { throw new IllegalArgumentException("Feature cannot be null"); } super.addFeature(feature); } GeoJsonLayer(GoogleMap map, JSONObject geoJsonFile, MarkerManager markerManager, PolygonManager polygonManager, ...
### Question: GeoJsonLayer extends Layer { public void removeFeature(GeoJsonFeature feature) { if (feature == null) { throw new IllegalArgumentException("Feature cannot be null"); } super.removeFeature(feature); } GeoJsonLayer(GoogleMap map, JSONObject geoJsonFile, MarkerManager markerManager, PolygonManager polygonMan...
### Question: KmlTrack extends KmlLineString { public HashMap<String, String> getProperties() { return mProperties; } KmlTrack(ArrayList<LatLng> coordinates, ArrayList<Double> altitudes, ArrayList<Long> timestamps, HashMap<String, String> properties); ArrayList<Long> getTimestamps(); HashMap<String, String> getProperti...
### Question: GeoJsonLayer extends Layer { public LatLngBounds getBoundingBox() { return mBoundingBox; } GeoJsonLayer(GoogleMap map, JSONObject geoJsonFile, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManager groundOverlayManager); GeoJsonLayer(GoogleMap ma...
### Question: GeoJsonLineStringStyle extends Style implements GeoJsonStyle { @Override public String[] getGeometryType() { return GEOMETRY_TYPE; } GeoJsonLineStringStyle(); @Override String[] getGeometryType(); int getColor(); void setColor(int color); boolean isClickable(); void setClickable(boolean clickable); boolea...
### Question: GeoJsonMultiLineString extends MultiGeometry { public String getType() { return getGeometryType(); } GeoJsonMultiLineString(List<GeoJsonLineString> geoJsonLineStrings); String getType(); List<GeoJsonLineString> getLineStrings(); }### Answer: @Test public void testGetType() { List<GeoJsonLineString> lineS...
### Question: GeoJsonMultiLineString extends MultiGeometry { public List<GeoJsonLineString> getLineStrings() { List<Geometry> geometryList = getGeometryObject(); ArrayList<GeoJsonLineString> geoJsonLineStrings = new ArrayList<GeoJsonLineString>(); for (Geometry geometry : geometryList) { GeoJsonLineString lineString = ...
### Question: GeoJsonFeature extends Feature implements Observer { public void setGeometry(Geometry geometry) { super.setGeometry(geometry); setChanged(); notifyObservers(); } GeoJsonFeature(Geometry geometry, String id, HashMap<String, String> properties, LatLngBounds boundingBox); String set...
### Question: GeoJsonFeature extends Feature implements Observer { public LatLngBounds getBoundingBox() { return mBoundingBox; } GeoJsonFeature(Geometry geometry, String id, HashMap<String, String> properties, LatLngBounds boundingBox); String setProperty(String property, String propertyValue)...
### Question: GeoJsonLineString extends LineString { public String getType() { return getGeometryType(); } GeoJsonLineString(List<LatLng> coordinates); GeoJsonLineString(List<LatLng> coordinates, List<Double> altitudes); String getType(); List<LatLng> getCoordinates(); List<Double> getAltitudes(); }### Answer: @Test ...
### Question: KmlMultiGeometry extends MultiGeometry { public ArrayList<Geometry> getGeometryObject() { List<Geometry> geometriesList = super.getGeometryObject(); return new ArrayList<>(geometriesList); } KmlMultiGeometry(ArrayList<Geometry> geometries); ArrayList<Geometry> getGeometryObject(); @Override String toStrin...
### Question: GeoJsonLineString extends LineString { public List<LatLng> getCoordinates() { return getGeometryObject(); } GeoJsonLineString(List<LatLng> coordinates); GeoJsonLineString(List<LatLng> coordinates, List<Double> altitudes); String getType(); List<LatLng> getCoordinates(); List<Double> getAltitudes(); }###...
### Question: GeoJsonLineString extends LineString { public List<Double> getAltitudes() { return mAltitudes; } GeoJsonLineString(List<LatLng> coordinates); GeoJsonLineString(List<LatLng> coordinates, List<Double> altitudes); String getType(); List<LatLng> getCoordinates(); List<Double> getAltitudes(); }### Answer: @T...
### Question: GeoJsonPoint extends Point { public String getType() { return getGeometryType(); } GeoJsonPoint(LatLng coordinates); GeoJsonPoint(LatLng coordinates, Double altitude); String getType(); LatLng getCoordinates(); Double getAltitude(); }### Answer: @Test public void testGetType() { GeoJsonPoint p = new Geo...
### Question: GeoJsonPoint extends Point { public LatLng getCoordinates() { return getGeometryObject(); } GeoJsonPoint(LatLng coordinates); GeoJsonPoint(LatLng coordinates, Double altitude); String getType(); LatLng getCoordinates(); Double getAltitude(); }### Answer: @Test public void testGetCoordinates() { GeoJsonP...
### Question: GeoJsonPoint extends Point { public Double getAltitude() { return mAltitude; } GeoJsonPoint(LatLng coordinates); GeoJsonPoint(LatLng coordinates, Double altitude); String getType(); LatLng getCoordinates(); Double getAltitude(); }### Answer: @Test public void testGetAltitude() { GeoJsonPoint p = new Geo...
### Question: GeoJsonMultiPoint extends MultiGeometry { public String getType() { return getGeometryType(); } GeoJsonMultiPoint(List<GeoJsonPoint> geoJsonPoints); String getType(); List<GeoJsonPoint> getPoints(); }### Answer: @Test public void testGetType() { List<GeoJsonPoint> points = new ArrayList<>(); points.add(n...
### Question: GeoJsonMultiPoint extends MultiGeometry { public List<GeoJsonPoint> getPoints() { List<Geometry> geometryList = getGeometryObject(); ArrayList<GeoJsonPoint> geoJsonPoints = new ArrayList<GeoJsonPoint>(); for (Geometry geometry : geometryList) { GeoJsonPoint point = (GeoJsonPoint) geometry; geoJsonPoints.a...
### Question: GeoJsonPolygon implements DataPolygon { public String getType() { return GEOMETRY_TYPE; } GeoJsonPolygon( List<? extends List<LatLng>> coordinates); String getType(); List<? extends List<LatLng>> getCoordinates(); List<? extends List<LatLng>> getGeometryObject(); String getGeometryType(); Arra...
### Question: GeoJsonPolygon implements DataPolygon { public List<? extends List<LatLng>> getCoordinates() { return mCoordinates; } GeoJsonPolygon( List<? extends List<LatLng>> coordinates); String getType(); List<? extends List<LatLng>> getCoordinates(); List<? extends List<LatLng>> getGeometryObject(); St...
### Question: GeoJsonRenderer extends Renderer implements Observer { public void setMap(GoogleMap map) { super.setMap(map); for (Feature feature : super.getFeatures()) { redrawFeatureToMap((GeoJsonFeature) feature, map); } } GeoJsonRenderer(GoogleMap map, HashMap<GeoJsonFeature, Object> features, MarkerManager markerMa...
### Question: KmlPoint extends Point { public Double getAltitude() { return mAltitude; } KmlPoint(LatLng coordinates); KmlPoint(LatLng coordinates, Double altitude); Double getAltitude(); }### Answer: @Test public void testPointAltitude() { KmlPoint kmlPoint = createSimplePoint(); assertNotNull(kmlPoint); assertNull(...
### Question: GeoJsonRenderer extends Renderer implements Observer { public void addFeature(GeoJsonFeature feature) { super.addFeature(feature); if (isLayerOnMap()) { feature.addObserver(this); } } GeoJsonRenderer(GoogleMap map, HashMap<GeoJsonFeature, Object> features, MarkerManager markerManager, PolygonManager polyg...
### Question: GeoJsonRenderer extends Renderer implements Observer { public void removeLayerFromMap() { if (isLayerOnMap()) { for (Feature feature : super.getFeatures()) { removeFromMap(super.getAllFeatures().get(feature)); feature.deleteObserver(this); } setLayerVisibility(false); } } GeoJsonRenderer(GoogleMap map, Ha...
### Question: GeoJsonRenderer extends Renderer implements Observer { public void removeFeature(GeoJsonFeature feature) { super.removeFeature(feature); if (super.getFeatures().contains(feature)) { feature.deleteObserver(this); } } GeoJsonRenderer(GoogleMap map, HashMap<GeoJsonFeature, Object> features, MarkerManager mar...
### Question: GeoJsonMultiPolygon extends MultiGeometry { public String getType() { return getGeometryType(); } GeoJsonMultiPolygon(List<GeoJsonPolygon> geoJsonPolygons); String getType(); List<GeoJsonPolygon> getPolygons(); }### Answer: @Test public void testGetType() { List<GeoJsonPolygon> polygons = new ArrayList<>...
### Question: GeoJsonPolygonStyle extends Style implements GeoJsonStyle { @Override public String[] getGeometryType() { return GEOMETRY_TYPE; } GeoJsonPolygonStyle(); @Override String[] getGeometryType(); int getFillColor(); void setFillColor(int fillColor); boolean isGeodesic(); void setGeodesic(boolean geodesic); int...
### Question: Renderer { public GoogleMap getMap() { return mMap; } Renderer(GoogleMap map, Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, GroundOverlayManag...
### Question: Renderer { public Set<Feature> getFeatures() { return mFeatures.keySet(); } Renderer(GoogleMap map, Context context, MarkerManager markerManager, PolygonManager polygonManager, PolylineManager polylineManager, ...
### Question: Renderer { protected void removeFeature(Feature feature) { if (mFeatures.containsKey(feature)) { removeFromMap(mFeatures.remove(feature)); } } Renderer(GoogleMap map, Context context, MarkerManager markerManager, PolygonManager polygonManager, ...
### Question: KmlPolygon implements DataPolygon<ArrayList<ArrayList<LatLng>>> { public String getGeometryType() { return GEOMETRY_TYPE; } KmlPolygon(List<LatLng> outerBoundaryCoordinates, List<List<LatLng>> innerBoundaryCoordinates); String getGeometryType(); List<List<LatLng>> getGeometryObject()...
### Question: Point implements Geometry { public String getGeometryType() { return GEOMETRY_TYPE; } Point(LatLng coordinates); String getGeometryType(); LatLng getGeometryObject(); @Override String toString(); }### Answer: @Test public void testGetGeometryType() { Point p = new Point(new LatLng(0, 50)); assertEquals("...
### Question: Point implements Geometry { public LatLng getGeometryObject() { return mCoordinates; } Point(LatLng coordinates); String getGeometryType(); LatLng getGeometryObject(); @Override String toString(); }### Answer: @Test public void testGetGeometryObject() { Point p = new Point(new LatLng(0, 50)); assertEqual...
### Question: Feature extends Observable { public String getId() { return mId; } Feature(Geometry featureGeometry, String id, Map<String, String> properties); Iterable<String> getPropertyKeys(); Iterable getProperties(); String getProperty(String property); String getId(); boolean hasProperty(String ...
### Question: Gradient { int[] generateColorMap(double opacity) { HashMap<Integer, ColorInterval> colorIntervals = generateColorIntervals(); int[] colorMap = new int[mColorMapSize]; ColorInterval interval = colorIntervals.get(0); int start = 0; for (int i = 0; i < mColorMapSize; i++) { if (colorIntervals.containsKey(i)...
### Question: PointQuadTree { public void clear() { mChildren = null; if (mItems != null) { mItems.clear(); } } PointQuadTree(double minX, double maxX, double minY, double maxY); PointQuadTree(Bounds bounds); private PointQuadTree(double minX, double maxX, double minY, double maxY, int depth); private PointQuadTree(...
### Question: PointQuadTree { public Collection<T> search(Bounds searchBounds) { final List<T> results = new ArrayList<T>(); search(searchBounds, results); return results; } PointQuadTree(double minX, double maxX, double minY, double maxY); PointQuadTree(Bounds bounds); private PointQuadTree(double minX, double maxX,...
### Question: SphericalUtil { public static double computeDistanceBetween(LatLng from, LatLng to) { return computeAngleBetween(from, to) * EARTH_RADIUS; } private SphericalUtil(); static double computeHeading(LatLng from, LatLng to); static LatLng computeOffset(LatLng from, double distance, double heading); static Lat...
### Question: KmlPolygon implements DataPolygon<ArrayList<ArrayList<LatLng>>> { public List<LatLng> getOuterBoundaryCoordinates() { return mOuterBoundaryCoordinates; } KmlPolygon(List<LatLng> outerBoundaryCoordinates, List<List<LatLng>> innerBoundaryCoordinates); String getGeometryType(); List<Lis...
### Question: SphericalUtil { public static double computeArea(List<LatLng> path) { return abs(computeSignedArea(path)); } private SphericalUtil(); static double computeHeading(LatLng from, LatLng to); static LatLng computeOffset(LatLng from, double distance, double heading); static LatLng computeOffsetOrigin(LatLng t...
### Question: SphericalUtil { public static double computeSignedArea(List<LatLng> path) { return computeSignedArea(path, EARTH_RADIUS); } private SphericalUtil(); static double computeHeading(LatLng from, LatLng to); static LatLng computeOffset(LatLng from, double distance, double heading); static LatLng computeOffset...
### Question: KmlPolygon implements DataPolygon<ArrayList<ArrayList<LatLng>>> { public List<List<LatLng>> getInnerBoundaryCoordinates() { return mInnerBoundaryCoordinates; } KmlPolygon(List<LatLng> outerBoundaryCoordinates, List<List<LatLng>> innerBoundaryCoordinates); String getGeometryType(); Li...
### Question: KmlPolygon implements DataPolygon<ArrayList<ArrayList<LatLng>>> { public List<List<LatLng>> getGeometryObject() { List<List<LatLng>> coordinates = new ArrayList<>(); coordinates.add(mOuterBoundaryCoordinates); if (mInnerBoundaryCoordinates != null) { coordinates.addAll(mInnerBoundaryCoordinates); } return...
### Question: ExternalSystemRecentTaskListModel extends DefaultListModel { @SuppressWarnings("unchecked") public void setFirst(@Nonnull ExternalTaskExecutionInfo task) { insertElementAt(task, 0); for (int i = 1; i < size(); i++) { if (task.equals(getElementAt(i))) { remove(i); break; } } ensureSize(ExternalSystemConsta...
### Question: ExternalSystemRecentTaskListModel extends DefaultListModel { @SuppressWarnings("unchecked") public void ensureSize(int elementsNumber) { int toAdd = elementsNumber - size(); if (toAdd == 0) { return; } if(toAdd < 0) { removeRange(elementsNumber, size() - 1); } while (--toAdd >= 0) { addElement(new MyEmpty...
### Question: RxDownloader { public Single<List<FileContainer>> asList() { this.subject.subscribe(this.itemsObserver); this.size = this.files.size(); this.remains = this.size; Observable<FileContainer> observable = Observable .fromIterable(this.files) .observeOn(AndroidSchedulers.mainThread()) .subscribeOn(Schedulers.i...
### Question: Utils { public static void shouldAllPositive(int... numbers) { for (int num : numbers) { if (num < 1) { throw new IllegalArgumentException("Number should be > 0"); } } } static int toPositiveInt(String input); static void shouldAllPositive(int... numbers); static void shouldAllNonNegative(int... numbers)...
### Question: CommandFactory { public Command getCommand(String commandLine) throws InvalidCommandException, InvalidCommandParams { commandLine = commandLine.trim().replaceAll(" {2}", " "); String[] split = commandLine.split(" "); String mainCommand = split[0].toUpperCase(); String[] params = Arrays.copyOfRange(split, ...
### Question: EntityFactory { public Entity getEntity(DrawEntityCommand command) { if (command instanceof DrawLineCommand) { DrawLineCommand cmd = (DrawLineCommand) command; return new Line(cmd.getX1(), cmd.getY1(), cmd.getX2(), cmd.getY2()); } else if (command instanceof DrawRectangleCommand) { DrawRectangleCommand cm...
### Question: IEXByteConverter { public static short convertBytesToShort(final byte[] bytes) { return (short) ( (0xff & bytes[1]) << 8 | (0xff & bytes[0]) << 0); } private IEXByteConverter(); static long convertBytesToLong(final byte[] bytes); static int convertBytesToInt(final byte[] bytes); static int convertBytesTo...
### Question: IEXPrice implements Comparable<IEXPrice>, Serializable { @Override public int hashCode() { return Objects.hashCode(number); } IEXPrice(final long number); long getNumber(); BigDecimal toBigDecimal(); @Override int compareTo(final IEXPrice iexPrice); @Override boolean equals(Object o); @Override int hashCo...
### Question: IEXPrice implements Comparable<IEXPrice>, Serializable { @Override public int compareTo(final IEXPrice iexPrice) { return compare(this.getNumber(), iexPrice.getNumber()); } IEXPrice(final long number); long getNumber(); BigDecimal toBigDecimal(); @Override int compareTo(final IEXPrice iexPrice); @Override...
### Question: IEXTOPSMessageBlock extends IEXSegment { public static IEXSegment createIEXSegment(final byte[] packet) { final List<IEXMessage> iexMessages = new ArrayList<>(); int offset = 40; final IEXMessageHeader iexMessageHeader = IEXMessageHeader.createIEXMessageHeader(Arrays.copyOfRange(packet, 0, offset)); for (...
### Question: IEXByteConverter { public static int convertBytesToUnsignedShort(final byte[] bytes) { return convertBytesToShort(bytes) & 0xffff; } private IEXByteConverter(); static long convertBytesToLong(final byte[] bytes); static int convertBytesToInt(final byte[] bytes); static int convertBytesToUnsignedShort(fin...
### Question: IEXByteConverter { public static int convertBytesToInt(final byte[] bytes) { return ((0xff & bytes[3]) << 24 | (0xff & bytes[2]) << 16 | (0xff & bytes[1]) << 8 | (0xff & bytes[0]) << 0 ); } private IEXByteConverter(); static long convertBytesToLong(final byte[] bytes); static int convertBytesToInt(final ...
### Question: IEXByteConverter { public static long convertBytesToLong(final byte[] bytes) { return (long) (0xff & bytes[7]) << 56 | (long) (0xff & bytes[6]) << 48 | (long) (0xff & bytes[5]) << 40 | (long) (0xff & bytes[4]) << 32 | (long) (0xff & bytes[3]) << 24 | (long) (0xff & bytes[2]) << 16 | (long) (0xff & bytes[1...
### Question: IEXByteConverter { public static IEXPrice convertBytesToIEXPrice(final byte[] bytes) { return new IEXPrice(convertBytesToLong(bytes)); } private IEXByteConverter(); static long convertBytesToLong(final byte[] bytes); static int convertBytesToInt(final byte[] bytes); static int convertBytesToUnsignedShort...
### Question: IEXByteConverter { public static String convertBytesToString(final byte[] bytes) { return new String(bytes).trim(); } private IEXByteConverter(); static long convertBytesToLong(final byte[] bytes); static int convertBytesToInt(final byte[] bytes); static int convertBytesToUnsignedShort(final byte[] bytes...
### Question: IEXSegment { @Override public int hashCode() { return Objects.hash(messageHeader, messages); } protected IEXSegment( final IEXMessageHeader messageHeader, final List<IEXMessage> messages); IEXMessageHeader getMessageHeader(); List<IEXMessage> getMessages(); @Override boolean equal...
### Question: IEXMessageHeader { @Override public int hashCode() { return Objects.hash(version, messageProtocolID, channelID, sessionID, payloadLength, messageCount, streamOffset, firstMessageSequenceNumber, sendTime); } private IEXMessageHeader( final byte version, final IEXMessageProtocol mes...
### Question: IEXPrice implements Comparable<IEXPrice>, Serializable { public long getNumber() { return number; } IEXPrice(final long number); long getNumber(); BigDecimal toBigDecimal(); @Override int compareTo(final IEXPrice iexPrice); @Override boolean equals(Object o); @Override int hashCode(); @Override String toS...
### Question: IEXPrice implements Comparable<IEXPrice>, Serializable { @Override public String toString() { return toBigDecimal() .toString(); } IEXPrice(final long number); long getNumber(); BigDecimal toBigDecimal(); @Override int compareTo(final IEXPrice iexPrice); @Override boolean equals(Object o); @Override int h...
### Question: BookServiceImpl implements BookService { @Override @Transactional public Book saveBook(@NotNull @Valid final Book book) { LOGGER.debug("Creating {}", book); Book existing = repository.findOne(book.getId()); if (existing != null) { throw new BookAlreadyExistsException( String.format("There already exists a...
### Question: BookServiceImpl implements BookService { @Override @Transactional(readOnly = true) public List<Book> getList() { LOGGER.debug("Retrieving the list of all users"); return repository.findAll(); } @Autowired BookServiceImpl(final BookRepository repository); @Override @Transactional Book saveBook(@NotNull @V...
### Question: BookController { @RequestMapping(value = "/books", method = RequestMethod.POST, consumes = {"application/json"}) public Book saveBook(@RequestBody @Valid final Book book) { LOGGER.debug("Received request to create the {}", book); return bookService.saveBook(book); } @Autowired BookController(final BookSe...
### Question: BookController { @ApiOperation(value = "Retrieve a list of books.", responseContainer = "List") @RequestMapping(value = "/books", method = RequestMethod.GET, produces = {"application/json"}) public List<Book> listBooks() { LOGGER.debug("Received request to list all books"); return bookService.getList(); }...
### Question: MockableClient extends OkHttpClient { @Override public Call newCall(Request request) { if (shouldMockRequest(request)) { return mockedClient.newCall(request); } else { return realClient.newCall(request); } } MockableClient(Registry registry, OkHttpClient realClient, R...
### Question: ReplaceEndpointClient extends OkHttpClient { @Override public Call newCall(Request request) { return realClient.newCall( withReplacedEndpoint(request) ); } ReplaceEndpointClient(String newEndpoint, OkHttpClient realClient); @Override Call newCall(Request request); }### Answer: @...
### Question: IEXOrderBook implements OrderBook { public void priceLevelUpdate(final IEXPriceLevelUpdateMessage iexPriceLevelUpdateMessage) { switch (iexPriceLevelUpdateMessage.getIexMessageType()) { case PRICE_LEVEL_UPDATE_SELL: askSide.priceLevelUpdate(iexPriceLevelUpdateMessage); break; case PRICE_LEVEL_UPDATE_BUY: ...
### Question: PriceLevel { @Override public int hashCode() { return Objects.hash(symbol, timestamp, price, size); } PriceLevel( final String symbol, final long timestamp, final IEXPrice price, final int size); String getSymbol(); long getTimestamp(); IEXPrice getPrice(); ...
### Question: IMemoryImageInputStream extends ImageInputStreamImpl { @Override public long getStreamPosition() throws IOException { return address; } IMemoryImageInputStream(IMemory memory, long startingAddress); @Override int read(byte[] buffer, int offset, int length); @Override int read(); @Override long getStreamPo...
### Question: IMemoryImageInputStream extends ImageInputStreamImpl { @Override public void seek(long pos) throws IOException { address = pos; } IMemoryImageInputStream(IMemory memory, long startingAddress); @Override int read(byte[] buffer, int offset, int length); @Override int read(); @Override long getStreamPosition...
### Question: Addresses { public static boolean greaterThan(long a, long b) { if (signBitsSame(a, b)) { return a > b; } else { return a < b; } } static boolean greaterThan(long a, long b); static boolean greaterThanOrEqual(long a, long b); static boolean lessThan(long a, long b); static boolean lessThanOrEqual(long a,...
### Question: Addresses { public static boolean lessThan(long a, long b) { if (signBitsSame(a, b)) { return a < b; } else { return a > b; } } static boolean greaterThan(long a, long b); static boolean greaterThanOrEqual(long a, long b); static boolean lessThan(long a, long b); static boolean lessThanOrEqual(long a, lo...
### Question: SqlBuilder { public String build() { addCopyTable(); addColumnNames(); addFileConfig(); return getSql(); } SqlBuilder(EntityInfo entityInfo); String build(); void addCopyTable(); void addColumnNames(); void addFileConfig(); String getSql(); }### Answer: @Test public void testCompleteQuery() { SqlBuilder ...
### Question: SqlBuilder { public String build() { addLoadDataIntoTable(); addFileConfig(); addColumnNames(); return getSql(); } SqlBuilder(EntityInfo entityInfo); String build(); void addLoadDataIntoTable(); void addFileConfig(); void addColumnNames(); String getSql(); }### Answer: @Test public void testCompleteQuery...
### Question: UriUtils { public static URI getParent(final URI uri) { if (isRoot(uri)) { return null; } else { final URI parent = uri.getPath().endsWith("/") ? uri.resolve("..") : uri.resolve("."); final String parentStr = parent.toString(); return isRoot(parent) ? parent : URI.create(parentStr.substring(0, parentStr.l...
### Question: CharacterUtils { public static List<Character> filterLetters(List<Character> characters) { return characters.stream().filter(Character::isLetter).collect(toList()); } private CharacterUtils(); static List<Character> collectPrintableCharactersOf(Charset charset); static List<Character> filterLetters(List<...
### Question: BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { @Override public BigDecimal getRandomValue() { Double delegateRandomValue = delegate.getRandomValue(); BigDecimal randomValue = new BigDecimal(delegateRandomValue); if (scale != null) { randomValue = randomValue.setScale(this.scale, this.roundi...
### Question: BigDecimalRangeRandomizer implements Randomizer<BigDecimal> { public static BigDecimalRangeRandomizer aNewBigDecimalRangeRandomizer(final Double min, final Double max) { return new BigDecimalRangeRandomizer(min, max); } BigDecimalRangeRandomizer(final Double min, final Double max); BigDecimalRangeRandomi...
### Question: FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { @Override public Float getRandomValue() { return (float) nextDouble(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Float max, final long seed); static FloatRangeRandomizer aNewF...
### Question: FloatRangeRandomizer extends AbstractRangeRandomizer<Float> { public static FloatRangeRandomizer aNewFloatRangeRandomizer(final Float min, final Float max) { return new FloatRangeRandomizer(min, max); } FloatRangeRandomizer(final Float min, final Float max); FloatRangeRandomizer(final Float min, final Fl...
### Question: ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { @Override public ZonedDateTime getRandomValue() { long minSeconds = min.toEpochSecond(); long maxSeconds = max.toEpochSecond(); long seconds = (long) nextDouble(minSeconds, maxSeconds); int minNanoSeconds = min.getNano(); int ma...
### Question: ZonedDateTimeRangeRandomizer extends AbstractRangeRandomizer<ZonedDateTime> { public static ZonedDateTimeRangeRandomizer aNewZonedDateTimeRangeRandomizer(final ZonedDateTime min, final ZonedDateTime max) { return new ZonedDateTimeRangeRandomizer(min, max); } ZonedDateTimeRangeRandomizer(final ZonedDateTim...
### Question: ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { @Override public Short getRandomValue() { return (short) nextDouble(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Short max, final long seed); static ShortRangeRandomizer aNewS...
### Question: ShortRangeRandomizer extends AbstractRangeRandomizer<Short> { public static ShortRangeRandomizer aNewShortRangeRandomizer(final Short min, final Short max) { return new ShortRangeRandomizer(min, max); } ShortRangeRandomizer(final Short min, final Short max); ShortRangeRandomizer(final Short min, final Sh...
### Question: StringRandomizer extends AbstractRandomizer<String> { @Override public String getRandomValue() { int length = (int) nextDouble(minLength, maxLength); char[] chars = new char[length]; for (int i = 0; i < length; i++) { chars[i] = characterRandomizer.getRandomValue(); } return new String(chars); } StringRan...
### Question: StringDelegatingRandomizer implements Randomizer<String> { @Override public String getRandomValue() { return valueOf(delegate.getRandomValue()); } StringDelegatingRandomizer(final Randomizer<?> delegate); static StringDelegatingRandomizer aNewStringDelegatingRandomizer(final Randomizer<?> delegate); @Over...
### Question: CharacterRandomizer extends AbstractRandomizer<Character> { @Override public Character getRandomValue() { return characters.get(random.nextInt(characters.size())); } CharacterRandomizer(); CharacterRandomizer(final Charset charset); CharacterRandomizer(final long seed); CharacterRandomizer(final Charse...
### Question: MapRandomizer implements Randomizer<Map<K, V>> { public static <K, V> MapRandomizer<K, V> aNewMapRandomizer(final Randomizer<K> keyRandomizer, final Randomizer<V> valueRandomizer) { return new MapRandomizer<>(keyRandomizer, valueRandomizer, getRandomSize()); } MapRandomizer(final Randomizer<K> keyRandomiz...
### Question: ZoneIdRandomizer extends AbstractRandomizer<ZoneId> { @Override public ZoneId getRandomValue() { List<Map.Entry<String, String>> zoneIds = new ArrayList<>(ZoneId.SHORT_IDS.entrySet()); Map.Entry<String, String> randomZoneId = zoneIds.get(random.nextInt(zoneIds.size())); return ZoneId.of(randomZoneId.getVa...
### Question: TimeZoneRandomizer extends AbstractRandomizer<TimeZone> { @Override public TimeZone getRandomValue() { String[] timeZoneIds = TimeZone.getAvailableIDs(); return TimeZone.getTimeZone(timeZoneIds[random.nextInt(timeZoneIds.length)]); } TimeZoneRandomizer(); TimeZoneRandomizer(final long seed); static TimeZ...
### Question: ArrayPopulator { Object getRandomArray(final Class<?> fieldType, final RandomizationContext context) { Class<?> componentType = fieldType.getComponentType(); int randomSize = getRandomArraySize(context.getParameters()); Object result = Array.newInstance(componentType, randomSize); for (int i = 0; i < rand...
### Question: RegularExpressionRandomizer extends FakerBasedRandomizer<String> { @Override public String getRandomValue() { return faker.regexify(removeLeadingAndTailingBoundaryMatchers(regularExpression)); } RegularExpressionRandomizer(final String regularExpression); RegularExpressionRandomizer(final String regularE...
### Question: CollectionUtils { public static <T> T randomElementOf(final List<T> list) { if (list.isEmpty()) { return null; } return list.get(nextInt(0, list.size())); } private CollectionUtils(); static T randomElementOf(final List<T> list); }### Answer: @Test void testRandomElementOf() { String[] elements = {"foo"...