method2testcases
stringlengths
118
3.08k
### Question: JsonPatchExample extends JsonExample { public JsonObject test() { JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch jsonPatch = builder .test("/topics/2", "Data") .move("/series/2", "/topics/2") .build(); return jsonPatch.apply(jsonObject); } String replace(); JsonObject addAndRemove(); Jso...
### Question: JsonPatchExample extends JsonExample { public JsonObject copy() { JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch jsonPatch = builder.copy("/series/0", "/topics/0").build(); return jsonPatch.apply(jsonObject); } String replace(); JsonObject addAndRemove(); JsonObject move(); JsonObject co...
### Question: JsonPatchExample extends JsonExample { public JsonObject move() { JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch jsonPatch = builder.move("/series/0", "/topics/0").build(); return jsonPatch.apply(jsonObject); } String replace(); JsonObject addAndRemove(); JsonObject move(); JsonObject co...
### Question: JsonBindingExample extends JsonData { public String serializeListOfBooks() { return JsonbBuilder.create().toJson(books); } String serializeBook(); Book deserializeBook(); String serializeListOfBooks(); List<Book> deserializeListOfBooks(); String serializeArrayOfBooks(); String serializeArrayOfStrings(); ...
### Question: JsonPatchExample extends JsonExample { public JsonObject addAndRemove() { JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch jsonPatch = builder .add("/comments", Json.createArrayBuilder().add("Very Good!").add("Excellent").build()) .remove("/notes") .build(); return jsonPatch.apply(jsonObjec...
### Question: JsonPatchExample extends JsonExample { public String replace() { JsonPatchBuilder builder = Json.createPatchBuilder(); JsonPatch jsonPatch = builder.replace("/series/0", "Spring 5").build(); JsonObject newJsonObject = jsonPatch.apply(jsonObject); JsonPointer pointer = Json.createPointer("/series/0"); Json...
### Question: JsonMergeDiffExample extends JsonExample { public JsonMergePatch createMergePatch(){ JsonValue source = Json.createValue("{\"colour\":\"blue\"}"); JsonValue target = Json.createValue("{\"colour\":\"red\"}"); JsonMergePatch jsonMergePatch = Json.createMergeDiff(source, target); return jsonMergePatch; } Js...
### Question: Java8Integration extends JsonExample { public List<String> filterJsonArrayToList() { List<String> topics = jsonObject.getJsonArray("topics").stream() .filter(jsonValue -> ((JsonString) jsonValue).getString().startsWith("C")) .map(jsonValue -> ((JsonString) jsonValue).getString()) .collect(Collectors.toLis...
### Question: Java8Integration extends JsonExample { public JsonArray filterJsonArrayToJsonArray() { JsonArray topics = jsonObject.getJsonArray("topics").stream() .filter(jsonValue -> ((JsonString) jsonValue).getString().startsWith("C")) .collect(JsonCollectors.toJsonArray()); return topics; } List<String> filterJsonA...
### Question: Book { public void addChapterTitle(String chapterTitle) { chapterTitles.add(chapterTitle); } List<String> getChapterTitles(); void addChapterTitle(String chapterTitle); Map<String, String> getAuthorChapter(); void addAuthorChapter(String author, String chapter); }### Answer: @Test public void givenListW...
### Question: Book { public void addAuthorChapter(String author, String chapter) { authorChapter.put(author,chapter); } List<String> getChapterTitles(); void addChapterTitle(String chapterTitle); Map<String, String> getAuthorChapter(); void addAuthorChapter(String author, String chapter); }### Answer: @Test public vo...
### Question: ClientChoice { public void addChoices(Choice choice) { choices.add(choice); } void addChoices(Choice choice); void addClientChoices(String name, List<Choice> choices); List<Choice> getChoices(); Map<String, List<Choice>> getClientChoices(); }### Answer: @Test public void givenListWithConstraints_shouldV...
### Question: JsonBindingExample extends JsonData { public List<Book> deserializeListOfBooks() { return JsonbBuilder.create().fromJson(bookListJson, new ArrayList<Book>().getClass().getGenericSuperclass()); } String serializeBook(); Book deserializeBook(); String serializeListOfBooks(); List<Book> deserializeListOfBoo...
### Question: ClientChoice { public void addClientChoices(String name, List<Choice> choices) { clientChoices.put(name, choices); } void addChoices(Choice choice); void addClientChoices(String name, List<Choice> choices); List<Choice> getChoices(); Map<String, List<Choice>> getClientChoices(); }### Answer: @Test publi...
### Question: Customer { public void setEmail(String email) { this.email = email; } String getFirstName(); void setFirstName(String firstName); String getSecondName(); void setSecondName(String secondName); String getEmail(); void setEmail(String email); }### Answer: @Test public void givenBeanWithValidEmailConstrain...
### Question: Person { public void setEmail(String email) { this.email = email; } String getFirstName(); void setFirstName(String firstName); String getSecondName(); void setSecondName(String secondName); String getEmail(); void setEmail(String email); }### Answer: @Test public void givenBeanWithValidEmailConstraints...
### Question: Person { public void setCars(List<String> cars) { this.cars = cars; } String getFirstName(); void setFirstName(String firstName); String getSecondName(); void setSecondName(String secondName); String getEmail(); void setEmail(String email); List<String> getCars(); void setCars(List<String> cars); }### A...
### Question: RepeatedConstraint { public void setText(String text) { this.text = text; } String getText(); void setText(String text); }### Answer: @Test public void givenBeanWithValidDomain_shouldValidate() { RepeatedConstraint repeatedConstraint = new RepeatedConstraint(); repeatedConstraint.setText("www.readlearnc...
### Question: JsonBindingExample extends JsonData { public String serializeArrayOfBooks() { return JsonbBuilder.create().toJson(arrayBooks); } String serializeBook(); Book deserializeBook(); String serializeListOfBooks(); List<Book> deserializeListOfBooks(); String serializeArrayOfBooks(); String serializeArrayOfStrin...
### Question: OptionalExample { public void setText(String text) { this.text = Optional.of(text); } Optional<String> getName(); void setName(String name); Optional<String> getText(); void setText(String text); }### Answer: @Test public void givenBeanWithOptionalStringExample_shouldNotValidate() { OptionalExample opti...
### Question: JsonBindingExample extends JsonData { public String serializeArrayOfStrings() { return JsonbBuilder.create().toJson(new String[]{"Java EE", "Java SE"}); } String serializeBook(); Book deserializeBook(); String serializeListOfBooks(); List<Book> deserializeListOfBooks(); String serializeArrayOfBooks(); St...
### Question: JsonBindingExample extends JsonData { public String customizedMapping() { JsonbConfig jsonbConfig = new JsonbConfig() .withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_DASHES) .withPropertyOrderStrategy(PropertyOrderStrategy.LEXICOGRAPHICAL) .withStrictIJSON(true) .withFormatting(true) .w...
### Question: JsonBindingExample extends JsonData { public String annotationMethodMapping() { return JsonbBuilder.create().toJson(newspaper); } String serializeBook(); Book deserializeBook(); String serializeListOfBooks(); List<Book> deserializeListOfBooks(); String serializeArrayOfBooks(); String serializeArrayOfStri...
### Question: JsonBindingExample extends JsonData { public String annotationPropertyAndMethodMapping() { return JsonbBuilder.create().toJson(booklet); } String serializeBook(); Book deserializeBook(); String serializeListOfBooks(); List<Book> deserializeListOfBooks(); String serializeArrayOfBooks(); String serializeAr...
### Question: JsonBindingExample extends JsonData { public String annotationPropertiesMapping() { return JsonbBuilder.create().toJson(magazine); } String serializeBook(); Book deserializeBook(); String serializeListOfBooks(); List<Book> deserializeListOfBooks(); String serializeArrayOfBooks(); String serializeArrayOfS...
### Question: AuthenticationUtil { public static void clearAuthentication() { SecurityContextHolder.getContext().setAuthentication(null); } private AuthenticationUtil(); static void clearAuthentication(); static void configureAuthentication(String role); }### Answer: @Test public void clearAuthentication_ShouldRemove...
### Question: AuthenticationUtil { public static void configureAuthentication(String role) { Collection<GrantedAuthority> authorities = AuthorityUtils.createAuthorityList(role); Authentication authentication = new UsernamePasswordAuthenticationToken( USERNAME, role, authorities ); SecurityContextHolder.getContext().set...
### Question: SerializerFactoryLoader { public static SerializerFactory getFactory(ProcessingEnvironment processingEnv) { return new SerializerFactoryImpl(loadExtensions(processingEnv), processingEnv); } private SerializerFactoryLoader(); static SerializerFactory getFactory(ProcessingEnvironment processingEnv); }### ...
### Question: AnnotationValues { public static AnnotationMirror getAnnotationMirror(AnnotationValue value) { return AnnotationMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static Annotation...
### Question: AnnotationValues { public static String getString(AnnotationValue value) { return valueOfType(value, String.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annota...
### Question: AnnotationValues { public static ImmutableList<String> getStrings(AnnotationValue value) { return STRINGS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationM...
### Question: AnnotationValues { public static VariableElement getEnum(AnnotationValue value) { return EnumVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirro...
### Question: AnnotationValues { public static ImmutableList<VariableElement> getEnums(AnnotationValue value) { return ENUMS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnota...
### Question: AnnotationValues { public static ImmutableList<AnnotationValue> getAnnotationValues(AnnotationValue value) { return ANNOTATION_VALUES_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static Ann...
### Question: AnnotationValues { public static int getInt(AnnotationValue value) { return valueOfType(value, Integer.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(AnnotationV...
### Question: AnnotationValues { public static ImmutableList<Integer> getInts(AnnotationValue value) { return INTS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror...
### Question: AnnotationValues { public static long getLong(AnnotationValue value) { return valueOfType(value, Long.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(AnnotationVa...
### Question: AnnotationValues { public static ImmutableList<Long> getLongs(AnnotationValue value) { return LONGS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(...
### Question: AnnotationValues { public static byte getByte(AnnotationValue value) { return valueOfType(value, Byte.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(AnnotationVa...
### Question: AnnotationValues { public static ImmutableList<Byte> getBytes(AnnotationValue value) { return BYTES_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(...
### Question: AnnotationValues { public static short getShort(AnnotationValue value) { return valueOfType(value, Short.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annotatio...
### Question: AnnotationValues { public static ImmutableList<Short> getShorts(AnnotationValue value) { return SHORTS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirr...
### Question: AnnotationValues { public static float getFloat(AnnotationValue value) { return valueOfType(value, Float.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annotatio...
### Question: AnnotationValues { public static ImmutableList<Float> getFloats(AnnotationValue value) { return FLOATS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirr...
### Question: AnnotationValues { public static double getDouble(AnnotationValue value) { return valueOfType(value, Double.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annota...
### Question: AnnotationValues { public static ImmutableList<Double> getDoubles(AnnotationValue value) { return DOUBLES_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationM...
### Question: AnnotationValues { public static boolean getBoolean(AnnotationValue value) { return valueOfType(value, Boolean.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Ann...
### Question: AnnotationValues { public static ImmutableList<Boolean> getBooleans(AnnotationValue value) { return BOOLEANS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotati...
### Question: AnnotationValues { public static char getChar(AnnotationValue value) { return valueOfType(value, Character.class); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Annotat...
### Question: AnnotationValues { public static ImmutableList<Character> getChars(AnnotationValue value) { return CHARS_VISITOR.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMi...
### Question: SerializerFactoryImpl implements SerializerFactory { @Override public Serializer getSerializer(TypeMirror typeMirror) { for (SerializerExtension extension : extensions) { Optional<Serializer> serializer = extension.getSerializer(typeMirror, this, env); if (serializer.isPresent()) { return serializer.get()...
### Question: IdentitySerializerFactory { public static Serializer getSerializer(TypeMirror typeMirror) { return new IdentitySerializer(typeMirror); } private IdentitySerializerFactory(); static Serializer getSerializer(TypeMirror typeMirror); }### Answer: @Test public void proxyFieldType_isUnchanged() throws Excepti...
### Question: TemplateVars { String toText() { Map<String, Object> vars = toVars(); return parsedTemplate().evaluate(vars); } TemplateVars(); }### Answer: @Test public void testHappy() { HappyVars happy = new HappyVars(); happy.integer = 23; happy.string = "wibble"; happy.list = ImmutableList.of(5, 17, 23); assertTha...
### Question: JavaScanner { int tokenEnd(int start) { if (start >= s.length()) { return s.length(); } switch (s.charAt(start)) { case ' ': case '\n': return spaceEnd(start); case '/': if (s.charAt(start + 1) == '*') { return blockCommentEnd(start); } else if (s.charAt(start + 1) == '/') { return lineCommentEnd(start); ...
### Question: PropertyNames { static String decapitalizeLikeJavaBeans(String propertyName) { if (propertyName != null && propertyName.length() >= 2 && Character.isUpperCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { return propertyName; } return decapitalizeNormally(propertyName); } ...
### Question: PropertyNames { static String decapitalizeNormally(String propertyName) { if (Strings.isNullOrEmpty(propertyName)) { return propertyName; } return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); } }### Answer: @Test public void decapitalizeNormally() { NORMAL_CASES .forEach( ...
### Question: TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier( Elements elementUtils, Types typeUtils, String packageName, Set<TypeMirror> types, TypeMirror base); }### Answer: @Test pub...
### Question: TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier( Elements elementUtils, Types typeUtils, String packageName, Set<TypeMirror> types, TypeMirror base); }### Answer: @Test public void te...
### Question: SimpleValueType { public static SimpleValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_SimpleValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static SimpleValueType create(...
### Question: PackagelessValueType { public static PackagelessValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_PackagelessValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static Packagel...
### Question: BasicAnnotationProcessor extends AbstractProcessor { protected static Step asStep(ProcessingStep processingStep) { return new ProcessingStepAsStep(processingStep); } @Override final synchronized void init(ProcessingEnvironment processingEnv); @Override final ImmutableSet<String> getSupportedAnnotationTyp...
### Question: MoreElements { public static PackageElement getPackage(Element element) { while (element.getKind() != PACKAGE) { element = element.getEnclosingElement(); } return (PackageElement) element; } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element...
### Question: MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); stat...
### Question: MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Elem...
### Question: MoreElements { public static TypeElement asType(Element element) { return element.accept(TypeElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeEl...
### Question: MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); s...
### Question: MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element eleme...
### Question: MoreElements { public static boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationClass) { return getAnnotationMirror(element, annotationClass).isPresent(); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element e...
### Question: SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String to...
### Question: SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror( TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirr...
### Question: AnnotationMirrors { public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); } private AnnotationMirrors(); static Equivalence<AnnotationMirror> equivalence(); static Immutable...
### Question: BaseActionImpl { public BaseActionImpl() { } BaseActionImpl(); BaseActionImpl(InferenceConfigDefinition kpiDefinition); }### Answer: @Test public void testBaseActionImpl() { assertEquals("AVERAGE",ExecutionActions.AVERAGE.toString()); }
### Question: BaseActionImpl { protected String getEsQueryWithDates(JobSchedule schedule, String esQuery) { Long fromDate = InsightsUtils.getDataFromTime(schedule.name()); esQuery = esQuery.replace("__dataFromTime__", fromDate.toString()); Long toDate = InsightsUtils.getDataToTime(schedule.name()); esQuery = esQuery.re...
### Question: CountActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } CountActionImpl(InferenceConfigDefinition kpiDefinition); }### Answer: @Test public void testExecute() { load(); Map<String, Object> resultMap = new HashMap<String,...
### Question: MinMaxActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } MinMaxActionImpl(InferenceConfigDefinition kpiDefinition); }### Answer: @Test public void testExecute() throws InsightsJobFailedException { load(); Map<String, Obj...
### Question: OfflineDataProcessingExecutor extends TimerTask { public int executeOfflineProcessing() { File queryFolderPath = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH); File[] files = queryFolderPath.listFiles(); int jsonFileCount = 0; if (files == null) { return jsonFileCount; } for (File eachFile...
### Question: OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FA...
### Question: OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); }...
### Question: HttpMatch { public Method[] findInterfaceMethods(String methodName) { Method[] methods = interfaceClass.getMethods(); List<Method> ret = new ArrayList<Method>(); for (Method method : methods) { if (method.getName().equals(methodName)) ret.add(method); } return ret.toArray(new Method[] {}); } HttpMatch(Cla...
### Question: Reader { public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>()...
### Question: HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeO...
### Question: HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository, @NonNull BaseScheduler scheduler); @Override void...
### Question: HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); @Override Single<UserResponse> fetchUsers(int page); }### Answer: @Test public void fetch...
### Question: DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvi...
### Question: Teleporter extends Tileable implements TileableListener { public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = d...
### Question: Teleporter extends Tileable implements TileableListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Ov...
### Question: HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean i...
### Question: HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnect...
### Question: HorizontalTrack extends Track { @Override public boolean accepts(Direction direction, Marble marble) { return allowsConnection(direction); } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override bool...
### Question: HorizontalTrack extends Track { @Override public boolean passesMidpoint(Direction direction, Marble marble) { return true; } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Dire...
### Question: HorizontalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case LEFT: case RIGHT: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } } boo...
### Question: VerticalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.TOP); Tile right = tile.get(Direction.BOTTOM); return left != null && right != null; } boolean isC...
### Question: VerticalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case TOP: case BOTTOM: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnectio...
### Question: VerticalTrack extends Track { @Override public boolean accepts(Direction direction, Marble marble) { return allowsConnection(direction); } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolea...
### Question: VerticalTrack extends Track { @Override public boolean passesMidpoint(Direction direction, Marble marble) { return true; } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction direction); @Override boolean accepts(Direct...
### Question: VerticalTrack extends Track { @Override public void accept(Direction direction, Marble marble) { switch (direction) { case TOP: case BOTTOM: informAcceptation(direction, marble); break; default: throw new IllegalArgumentException("The track does not accept balls from the given " + "direction"); } } boole...
### Question: FilterTrack extends Track implements TileableListener { @Override public boolean isConnected() { return track.isConnected(); } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Override boolean allowsConnection(Direction direct...
### Question: FilterTrack extends Track implements TileableListener { @Override public boolean allowsConnection(Direction direction) { return track.allowsConnection(direction); } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Override boo...
### Question: FilterTrack extends Track implements TileableListener { @Override public boolean accepts(Direction direction, Marble marble) { return track.accepts(direction, marble); } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Overrid...
### Question: FilterTrack extends Track implements TileableListener { public Track getTrack() { return track; } FilterTrack(Track track, MarbleType marbleType); Track getTrack(); MarbleType getMarbleType(); @Override boolean isConnected(); @Override boolean allowsConnection(Direction direction); @Override boolean accep...