method2testcases
stringlengths
118
3.08k
### Question: ObservableValue extends Node { public void reportChanged() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChanged( this ); } ObservableValue( @Nullable final ArezContext context, ...
### Question: ObservableValue extends Node { void reportPossiblyChanged() { getContext().getTransaction().reportPossiblyChanged( this ); } ObservableValue( @Nullable final ArezContext context, @Nullable final Component component, @Nullable final String name, @Nul...
### Question: ObservableValue extends Node { void reportChangeConfirmed() { if ( willPropagateSpyEvents() ) { reportSpyEvent( new ObservableValueChangeEvent( asInfo(), getObservableValue() ) ); } getContext().getTransaction().reportChangeConfirmed( this ); } ObservableValue( @Nullable final ArezContext context, ...
### Question: ArezUtil { @Nonnull @OmitSymbol( unless = "arez.enable_names" ) static String throwableToString( @Nonnull final Throwable throwable ) { final StringBuilder sb = new StringBuilder(); Throwable t = throwable; while ( null != t ) { addCausedByPrefix( sb ); sb.append( t.toString() ); for ( final StackTraceEle...
### Question: ObservableValue extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObservableValueInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0196: ObservableValue.asInfo() invoked but Arez.areSpiesEnabled()...
### Question: Component implements Disposable { @Nonnull public Object getId() { return _id; } Component( @Nullable final ArezContext context, @Nonnull final String type, @Nonnull final Object id, @Nullable final String name, @Nullable final SafeProcedure preDispose, ...
### Question: Component implements Disposable { public void complete() { if ( !_complete ) { _complete = true; if ( Arez.areSpiesEnabled() && getContext().getSpy().willPropagateSpyEvents() ) { final ComponentInfo component = getContext().getSpy().asComponentInfo( this ); getContext().getSpy().reportSpyEvent( new Compon...
### Question: Component implements Disposable { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ComponentInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0194: Component.asInfo() invoked but Arez.areSpiesEnabled() returned...
### Question: Component implements Disposable { Component( @Nullable final ArezContext context, @Nonnull final String type, @Nonnull final Object id, @Nullable final String name, @Nullable final SafeProcedure preDispose, @Nullable final SafeProcedure postDispose ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant...
### Question: Observer extends Node { void invariantDependenciesBackLink( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( () -> observable.getObservers().contains( this ), () -> "Arez-0090: " + context + ": Observer named '" + getName() + "' ha...
### Question: Observer extends Node { void invariantDependenciesNotDisposed() { if ( Arez.shouldCheckInvariants() ) { getDependencies().forEach( observable -> invariant( observable::isNotDisposed, () -> "Arez-0091: Observer named '" + getName() + "' has " + "ObservableValue dependency named '" + observable.getName() + ...
### Question: Observer extends Node { void invariantDependenciesUnique( @Nonnull final String context ) { if ( Arez.shouldCheckInvariants() ) { invariant( () -> getDependencies().size() == new HashSet<>( getDependencies() ).size(), () -> "Arez-0089: " + context + ": The set of dependencies in observer named '" + getNam...
### Question: Observer extends Node { void replaceDependencies( @Nonnull final List<ObservableValue<?>> dependencies ) { if ( Arez.shouldCheckInvariants() ) { invariantDependenciesUnique( "Pre replaceDependencies" ); } _dependencies = Objects.requireNonNull( dependencies ); if ( Arez.shouldCheckInvariants() ) { invaria...
### Question: Observer extends Node { void clearDependencies() { getDependencies().forEach( dependency -> { dependency.removeObserver( this ); if ( !dependency.hasObservers() ) { dependency.setLeastStaleObserverState( Flags.STATE_UP_TO_DATE ); } } ); getDependencies().clear(); } Observer( @Nonnull final ComputableValue...
### Question: Observer extends Node { void scheduleReaction() { if ( isNotDisposed() ) { if ( Arez.shouldCheckInvariants() ) { invariant( this::isActive, () -> "Arez-0088: Observer named '" + getName() + "' is not active but an attempt has been made " + "to schedule observer." ); } if ( !getTask().isQueued() ) { getCon...
### Question: Observer extends Node { @SuppressWarnings( "ConstantConditions" ) @OmitSymbol( unless = "arez.enable_spies" ) @Nonnull ObserverInfo asInfo() { if ( Arez.shouldCheckInvariants() ) { invariant( Arez::areSpiesEnabled, () -> "Arez-0197: Observer.asInfo() invoked but Arez.areSpiesEnabled() returned false." ); ...
### Question: ObserverInfoImpl implements ObserverInfo { @Override public boolean isScheduled() { return _observer.getTask().isQueued(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Override boolean isRunning(); @Over...
### Question: Observer extends Node { boolean isActive() { return Flags.isActive( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context, @Nullable final Component component, @Nullable final String name, ...
### Question: Observer extends Node { int getState() { return Flags.getState( _flags ); } Observer( @Nonnull final ComputableValue<?> computableValue, final int flags ); Observer( @Nullable final ArezContext context, @Nullable final Component component, @Nullable final String name, ...
### Question: ArezLogger { static void log( @Nonnull final String message, @Nullable final Throwable throwable ) { c_logger.log( message, throwable ); } private ArezLogger(); }### Answer: @Test public void log() { final String message1 = ValueUtil.randomString(); final String message2 = ValueUtil.randomString(); Are...
### Question: NoSuchEntityException extends NoResultException { @Override public String toString() { if ( Arez.areNamesEnabled() ) { return "NoSuchEntityException[id=" + _id + ']'; } else { return super.toString(); } } NoSuchEntityException( @Nonnull final Object id ); @Nonnull Object getId(); @Override String toString...
### Question: TypeBasedLocator implements Locator { public <T> void registerLookup( @Nonnull final Class<T> type, @Nonnull final Function<Object, T> findByIdFunction ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( () -> !_findByIdFunctions.containsKey( type ), () -> "Arez-0188: Attempting to register lookup ...
### Question: ObserverInfoImpl implements ObserverInfo { @Override public boolean isRunning() { return _spy.isTransactionActive() && null != getTrackerTransaction(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Overri...
### Question: CollectionsUtil { @Nonnull public static <T> List<T> asList( @Nonnull final Stream<T> stream ) { return wrap( stream.collect( Collectors.toList() ) ); } private CollectionsUtil(); @Nonnull static Collection<T> wrap( @Nonnull final Collection<T> collection ); @Nonnull static Set<T> wrap( @Nonnull final Se...
### Question: MemoizeCache implements Disposable { public T get( @Nonnull final Object... args ) { if ( Arez.shouldCheckApiInvariants() ) { apiInvariant( this::isNotDisposed, () -> "Arez-0161: MemoizeCache named '" + _name + "' had get() invoked when disposed." ); } return getComputableValue( args ).get(); } MemoizeCac...
### Question: ObserverInfoImpl implements ObserverInfo { @Override public boolean isReadOnly() { return Arez.shouldEnforceTransactionType() && !_observer.isMutation(); } ObserverInfoImpl( @Nonnull final Spy spy, @Nonnull final Observer observer ); @Nonnull @Override String getName(); @Override boolean isActive(); @Over...
### Question: ObserverInfoImpl implements ObserverInfo { @Nonnull @Override public List<ObservableValueInfo> getDependencies() { final Transaction transaction = _spy.isTransactionActive() ? getTrackerTransaction() : null; if ( null != transaction ) { final List<ObservableValue<?>> observableValues = transaction.getObse...
### Question: JMoveWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, getRefactoringsInJMoveFormat(refactorings)); } @Override String getName(); @Override vo...
### Question: JBWriter implements RefactoringsWriter { @Override public void writeRefactoringsInTextForm(List<RefactoringTextRepresentation> refactorings, Path refactoringsPath) throws IOException { Files.write(refactoringsPath, Collections.singleton(JSON_CONVERTER.toJson(refactorings))); } @Override void write(List<M...
### Question: JBReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { try (BufferedReader reader = Files.newBufferedReader(refactoringsPath)) { Type listType = new TypeToken<List<JBRefactoringTextRepresentation>>(){}.getType(); retur...
### Question: JMoveReader implements RefactoringsReader { @Override public List<RefactoringTextRepresentation> read(Path refactoringsPath) throws IOException { return parseLines(Files.lines(refactoringsPath)); } @Override List<RefactoringTextRepresentation> read(Path refactoringsPath); @Override List<RefactoringTextRe...
### Question: RepositoryInitializationService { @EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); } RepositoryInitializationService(RepositoryRepository repositoryRepository, PackageMetadataRepository packageMetadataRepository...
### Question: DocumentKeyWords { public static DocumentKeyWord[] getAll(){ return ALL_KEYWORDS; } static DocumentKeyWord[] getAll(); }### Answer: @Test public void all_key_words_can_be_initialzed() { DocumentKeyWord[] results = DocumentKeyWords.getAll(); assertNotNull(results); }
### Question: ParseToken { public boolean isFunctionKeyword() { return "function".equals(text); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); bool...
### Question: ParseToken { public boolean isFunction() { boolean isFunctionName = endsWithFunctionBrackets(); isFunctionName = isFunctionName && isLegalFunctionName(); isFunctionName = isFunctionName && !isComment(); isFunctionName = isFunctionName && text.length() > 2; isFunctionName = isFunctionName && !isString(); r...
### Question: ParseToken { public String getTextAsFunctionName() { if (getSafeText().endsWith("()")) { return text.substring(0, text.length() - 2); } return text; } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String to...
### Question: TokenParser { void moveUntilNextCharWillBeNoStringContent(ParseContext context) { context.appendCharToText(); char c = context.getCharAtPos(); if (!isStringChar(c)) { return; } if (c=='\'') { }else if (context.isCharBeforeEscapeSign()) { return; } char stringCharToScan = c; moveToNextCharNotInStringAndApp...
### Question: BashCallPIDStoreSnippetBuilder { public String buildPIDFileAbsolutePath(String port) { String path = buildPIDFile(port).toPath().toAbsolutePath().toString(); return path; } BashCallPIDStoreSnippetBuilder(); String buildPIDFileAbsolutePath(String port); String buildPIDParentFolderAbsolutePath(); String bui...
### Question: BashCallPIDStoreSnippetBuilder { public String buildWritePIDToPortSpecificTmpFileSnippet(int port) { StringBuilder sb = new StringBuilder(); sb.append("cd \"").append(OSUtil.toUnixPath(buildPIDParentFolderAbsolutePath())).append("\";"); sb.append("./").append(BashPIDSnippetSupport.FILENAME_STORE_TERMINAL_...
### Question: DefaultWindowsTerminalCommandStringProvider implements DefaultTerminalCommandStringProvider { @Override public String getStarterCommandString() { return "cmd.exe /C "+TerminalCommandVariable.BE_TERMINAL.getVariableRepresentation(); } @Override String getStarterCommandString(); @Override String getTermina...
### Question: LineIsBashSheBangValidator { public boolean isValid(String line) { if (line == null) { return false; } if (line.isEmpty()) { return false; } if (!line.startsWith("#!")) { return false; } if (line.indexOf("bash") != -1 ) { return true; } if (line.endsWith(" sh")) { return true; } return false; } boolean i...
### Question: DefaultWindowsTerminalCommandStringProvider implements DefaultTerminalCommandStringProvider { @Override public String getTerminalCommandString() { return "start \""+TerminalCommandVariable.BE_CMD_TITLE.getVariableRepresentation()+"\" cmd.exe /C bash --login -c '"+TerminalCommandVariable.BE_CMD_CALL.getVar...
### Question: FileExtensionExtractor { public String extractFileExtension(File file) { Objects.requireNonNull(file); String fileName = file.getName(); int index = fileName.lastIndexOf('.'); if (index==-1) { return null; } if (fileName.length()==index-1) { return null; } return fileName.substring(index); } String extra...
### Question: ExternalToolCommandArrayBuilder { public String[] build(String externalToolCall, File editorFile) { numKeywordsReplaced = 0; String[] ret = externalToolCall.split(" "); for (int i = 0; i < ret.length; i++) if (ret[i].equalsIgnoreCase("$filename")) { ret[i] = editorFile.toPath().toString(); numKeywordsRepl...
### Question: SimpleStringUtils { public static boolean equals(String text1, String text2) { if (text1 == null) { if (text2 == null) { return true; } return false; } if (text2 == null) { return false; } return text2.equals(text1); } static boolean equals(String text1, String text2); static String shortString(String st...
### Question: OSUtil { public static String toUnixPath(String path) { if (path==null) { return "null"; } int index = path.indexOf(':'); if (index!=1) { return path; } char windowsDrive = path.charAt(0); String remaining = path.substring(2); StringBuilder sb = new StringBuilder(); sb.append('/'); sb.append(windowsDrive)...
### Question: BashFileExtensionMatcher { public boolean isMatching(String fileExtension) { return isMatching(fileExtension,true); } boolean isMatching(String fileExtension); boolean isMatching(String fileExtension, boolean removePoint); }### Answer: @Test public void test_matching() { assertTrue(matcherToTest.isMatch...
### Question: BashScriptModel implements BashVariableRegistry { public boolean hasErrors() { return !getErrors().isEmpty(); } Collection<BashFunction> getFunctions(); Collection<BashError> getErrors(); boolean hasErrors(); List<ParseToken> getDebugTokens(); boolean hasDebugTokens(); Map<String, BashVariable> getVariab...
### Question: ParseToken { public boolean isVariableDefinition() { String t = getSafeText(); boolean isVariable = t.endsWith("="); isVariable = isVariable && t.length()>1; isVariable = isVariable && VALID_VARIABLE_NAME_PATTERN.matcher(t).matches(); return isVariable; } ParseToken(); ParseToken(String text); ParseTo...
### Question: ParseToken { public boolean isDo() { return getSafeText().equals("do"); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean isSing...
### Question: ParseToken { public boolean isDone() { return getSafeText().equals("done"); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean is...
### Question: ParseToken { public boolean isIf() { return getSafeText().equals("if"); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean isSing...
### Question: ParseToken { public boolean isFi() { return getSafeText().equals("fi"); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolean isSing...
### Question: ParseToken { public boolean isHereDoc() { return ! isHereString() && getSafeText().startsWith("<<"); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolea...
### Question: ParseToken { public boolean isHereString() { return getSafeText().startsWith("<<<"); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); b...
### Question: ParseToken { public boolean isComment() { return getSafeText().startsWith("#"); } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString(); String createTypeDescription(); boolean isComment(); boolea...
### Question: ParseToken { public boolean isString() { boolean isString = isSingleString() || isDoubleString() || isDoubleTickedString(); return isString; } ParseToken(); ParseToken(String text); ParseToken(String text, int start, int end); String getText(); int getStart(); int getEnd(); @Override String toString()...
### Question: JdbcTemplateLocationDataSource implements LocationDataSource { @Override public Print next() { return cacheNext(); } JdbcTemplateLocationDataSource(JdbcTemplate tmplate); @Override Print next(); @Override Print prev(); @Override boolean hasNext(); }### Answer: @Test public void testNext() { long pre = Sy...
### Question: LoadPaths { public static void loadStaticPath(String filename, CountDownLatch latch){ List<StaticPath> tmpPaths = new ArrayList<StaticPath>(); try { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse(L...
### Question: PointQueue { public Point enqueue(Point p, int level) { assert level == Constant.SLOW_QUEUE_LENGTH || level == Constant.NORMAL_QUEUE_LENGTH || level == Constant.FAST_QUEUE_LENGTH || level == Constant.MAX_QUEUE_LENGTH; if (this._queue.size() < Constant.MAX_QUEUE_LENGTH + 1) { return (Point)p.clone(); } Poi...
### Question: KDTreeTool { public static KDTree unmodifiableKDTree(KDTree tree) { UnmodifiableKDTree kdTree = new KDTreeTool.UnmodifiableKDTree(2); kdTree.setKdTree(tree); return kdTree; } static KDTree unmodifiableKDTree(KDTree tree); }### Answer: @Test public void testAsUnmodifiableKDTree() throws KeySizeException,...
### Question: StaticPathChecker { public Point checker(PathPoint pathPoint) { int x = pathPoint.getX(), y = pathPoint.getY(); int angle = pathPoint.angle(); if (queue.size() > 0) { PathPoint lastPoint = this.queue.peekLast(); int distance = (int) Math.sqrt(Math.pow(lastPoint.getX() - x, 2) + Math.pow(lastPoint.getY() +...
### Question: PF implements Filter { public PF(int n) { this.particleNumbers = n; MIN_NEFF = 2*n/3; particles = new Particle[particleNumbers]; LOGGER.debug("particle numbers: {}", particleNumbers); } PF(int n); @Override void init(Point point); @Override void predict(Sensors sensor, double al); @Override Point update(P...
### Question: WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public Integer create(WxCpDepart depart) throws WxErrorException { String url = "https: String responseContent = this.mainService.post(url, depart.toJson()); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return ...
### Question: WxCpTagServiceImpl implements WxCpTagService { @Override public WxCpTagAddOrRemoveUsersResult addUsers2Tag(String tagId, List<String> userIds, List<String> partyIds) throws WxErrorException { String url = "https: JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("tagid", tagId); if (userIds...
### Question: WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public WxMpMaterialNews materialNewsInfo(String media_id) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/get_material"; return this.wxMpService.execute(MaterialNewsInfoRequestExecutor.create(this.wxMpService.getRequestH...
### Question: WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public boolean materialDelete(String media_id) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/del_material"; return this.wxMpService.execute(MaterialDeleteRequestExecutor.create(this.wxMpService.getRequestHttp()), url, ...
### Question: WxCpTagServiceImpl implements WxCpTagService { @Override public List<WxCpUser> listUsersByTagId(String tagId) throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilde...
### Question: WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public File mediaDownload(String media_id) throws WxErrorException { String url = MEDIA_API_URL_PREFIX + "/get"; return this.wxMpService.execute( MediaDownloadRequestExecutor.create(this.wxMpService.getRequestHttp(), this.wxMpService.getWx...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public WxUserTag tagCreate(String name) throws WxErrorException { String url = API_URL_PREFIX + "/create"; JsonObject json = new JsonObject(); JsonObject tagJson = new JsonObject(); tagJson.addProperty("name", name); json.add("tag", tagJson)...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public List<WxUserTag> tagGet() throws WxErrorException { String url = API_URL_PREFIX + "/get"; String responseContent = this.wxMpService.get(url, null); return WxUserTag.listFromJson(responseContent); } WxMpUserTagServiceImpl(WxMpService wx...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public Boolean tagUpdate(Long id, String name) throws WxErrorException { String url = API_URL_PREFIX + "/update"; JsonObject json = new JsonObject(); JsonObject tagJson = new JsonObject(); tagJson.addProperty("id", id); tagJson.addProperty("...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public Boolean tagDelete(Long id) throws WxErrorException { String url = API_URL_PREFIX + "/delete"; JsonObject json = new JsonObject(); JsonObject tagJson = new JsonObject(); tagJson.addProperty("id", id); json.add("tag", tagJson); String r...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public WxTagListUser tagListUser(Long tagId, String nextOpenid) throws WxErrorException { String url = "https: JsonObject json = new JsonObject(); json.addProperty("tagid", tagId); json.addProperty("next_openid", StringUtils.trimToEmpty(next...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public boolean batchTagging(Long tagId, String[] openids) throws WxErrorException { String url = API_URL_PREFIX + "/members/batchtagging"; JsonObject json = new JsonObject(); json.addProperty("tagid", tagId); JsonArray openidArrayJson = new ...
### Question: WxCpTagServiceImpl implements WxCpTagService { @Override public WxCpTagAddOrRemoveUsersResult removeUsersFromTag(String tagId, List<String> userIds) throws WxErrorException { String url = "https: JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("tagid", tagId); JsonArray jsonArray = new Js...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public boolean batchUntagging(Long tagId, String[] openids) throws WxErrorException { String url = API_URL_PREFIX + "/members/batchuntagging"; JsonObject json = new JsonObject(); json.addProperty("tagid", tagId); JsonArray openidArrayJson = ...
### Question: WxMpUserTagServiceImpl implements WxMpUserTagService { @Override public List<Long> userTagList(String openid) throws WxErrorException { String url = API_URL_PREFIX + "/getidlist"; JsonObject json = new JsonObject(); json.addProperty("openid", openid); String responseContent = this.wxMpService.post(url, js...
### Question: WxMpMenuServiceImpl implements WxMpMenuService { @Override public WxMenu menuTryMatch(String userid) throws WxErrorException { String url = API_URL_PREFIX + "/trymatch"; JsonObject jsonObject = new JsonObject(); jsonObject.addProperty("user_id", userid); try { String resultContent = this.wxMpService.post(...
### Question: WxMpMenuServiceImpl implements WxMpMenuService { @Override public WxMpGetSelfMenuInfoResult getSelfMenuInfo() throws WxErrorException { String url = "https: String resultContent = this.wxMpService.get(url, null); return WxMpGetSelfMenuInfoResult.fromJson(resultContent); } WxMpMenuServiceImpl(WxMpService w...
### Question: WxCpTagServiceImpl implements WxCpTagService { @Override public void delete(String tagId) throws WxErrorException { String url = "https: this.mainService.get(url, null); } WxCpTagServiceImpl(WxCpService mainService); @Override String create(String tagName); @Override void update(String tagId, String tagNa...
### Question: WxMpXmlOutTransferKefuMessage extends WxMpXmlOutMessage { public void setTransInfo(TransInfo transInfo) { this.transInfo = transInfo; } WxMpXmlOutTransferKefuMessage(); TransInfo getTransInfo(); void setTransInfo(TransInfo transInfo); }### Answer: @Test public void test() { WxMpXmlOutTransferKefuMessage ...
### Question: WxMpKfOnlineList { public static WxMpKfOnlineList fromJson(String json) { return WxMpGsonBuilder.INSTANCE.create().fromJson(json, WxMpKfOnlineList.class); } static WxMpKfOnlineList fromJson(String json); @Override String toString(); List<WxMpKfInfo> getKfOnlineList(); void setKfOnlineList(List<WxMpKfInfo...
### Question: WxMpTemplateMessage implements Serializable { public String toJson() { return WxMpGsonBuilder.INSTANCE.create().toJson(this); } WxMpTemplateMessage(); static WxMpTemplateMessageBuilder builder(); String getToUser(); void setToUser(String toUser); String getTemplateId(); void setTemplateId(String templateI...
### Question: WxCpMediaServiceImpl implements WxCpMediaService { @Override public WxMediaUploadResult upload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException, IOException { return this.upload(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileType)); } W...
### Question: WxCpMediaServiceImpl implements WxCpMediaService { @Override public File download(String mediaId) throws WxErrorException { String url = "https: return this.mainService.execute( MediaDownloadRequestExecutor.create(this.mainService.getRequestHttp(), this.mainService.getWxCpConfigStorage().getTmpDirFile()),...
### Question: WxCpUserServiceImpl implements WxCpUserService { @Override public void authenticate(String userId) throws WxErrorException { String url = "https: this.mainService.get(url, null); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser user...
### Question: WxCpUserServiceImpl implements WxCpUserService { @Override public void create(WxCpUser user) throws WxErrorException { String url = "https: this.mainService.post(url, user.toJson()); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser ...
### Question: WxCpUserServiceImpl implements WxCpUserService { @Override public void update(WxCpUser user) throws WxErrorException { String url = "https: this.mainService.post(url, user.toJson()); } WxCpUserServiceImpl(WxCpService mainService); @Override void authenticate(String userId); @Override void create(WxCpUser ...
### Question: WxCpUserServiceImpl implements WxCpUserService { @Override public void delete(String... userIds) throws WxErrorException { if (userIds.length == 1) { this.deleteOne(userIds[0]); } String url = "https: JsonObject jsonObject = new JsonObject(); JsonArray jsonArray = new JsonArray(); for (String userid : use...
### Question: WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public List<WxCpDepart> listAll() throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); JsonElement tmpJsonElement = new JsonParser().parse(responseContent); return WxCpGsonBuilder.INS...
### Question: WxCpUserServiceImpl implements WxCpUserService { @Override public WxCpUser getById(String userid) throws WxErrorException { String url = "https: String responseContent = this.mainService.get(url, null); return WxCpUser.fromJson(responseContent); } WxCpUserServiceImpl(WxCpService mainService); @Override vo...
### Question: WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); } if (s...
### Question: WxCpUserServiceImpl implements WxCpUserService { @Override public List<WxCpUser> listSimpleByDepartment(Integer departId, Boolean fetchChild, Integer status) throws WxErrorException { String url = "https: String params = ""; if (fetchChild != null) { params += "&fetch_child=" + (fetchChild ? "1" : "0"); }...
### Question: WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public void update(WxCpDepart group) throws WxErrorException { String url = "https: this.mainService.post(url, group.toJson()); } WxCpDepartmentServiceImpl(WxCpService mainService); @Override Integer create(WxCpDepart depart); @Overrid...
### Question: WxPayServiceImpl implements WxPayService { @Override public WxPayConfig getConfig() { return this.config; } @Override WxPayConfig getConfig(); @Override void setConfig(WxPayConfig config); @Override WxPayRefundResult refund(WxPayRefundRequest request); @Override WxPayRefundQueryResult refundQuery(String ...
### Question: WxCpDepartmentServiceImpl implements WxCpDepartmentService { @Override public void delete(Integer departId) throws WxErrorException { String url = "https: this.mainService.get(url, null); } WxCpDepartmentServiceImpl(WxCpService mainService); @Override Integer create(WxCpDepart depart); @Override void upda...
### Question: WxPayBaseResult { protected String getXmlValue(String... path) { Document doc = this.getXmlDoc(); String expression = String.format("/%s try { return (String) XPathFactory .newInstance() .newXPath() .compile(expression) .evaluate(doc, XPathConstants.STRING); } catch (XPathExpressionException e) { throw ne...
### Question: WxCpMenuServiceImpl implements WxCpMenuService { @Override public void create(WxMenu menu) throws WxErrorException { this.create(this.mainService.getWxCpConfigStorage().getAgentId(), menu); } WxCpMenuServiceImpl(WxCpService mainService); @Override void create(WxMenu menu); @Override void create(Integer ag...
### Question: SHA1 { public static String gen(String... arr) { if (StringUtils.isAnyEmpty(arr)) { throw new IllegalArgumentException("非法请求参数,有部分参数为空 : " + Arrays.toString(arr)); } Arrays.sort(arr); StringBuilder sb = new StringBuilder(); for (String a : arr) { sb.append(a); } return DigestUtils.sha1Hex(sb.toString()); ...