method2testcases
stringlengths
118
6.63k
### 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: ManifestUtils { @SuppressWarnings("unchecked") public static String createManifest(Package packageToDeploy, Map<String, ?> model) { Map<String, Object> newModel = new HashMap<>(); backslashEscapeMap((Map<String, Object>) model, newModel); String rawManifest = applyManifestTemplate(packageToDeploy, newMode...
### Question: RepositoryInitializationService { @EventListener @Transactional public void initialize(ApplicationReadyEvent event) { synchronizeRepositories(); synchronizePackageMetadata(); } RepositoryInitializationService(RepositoryRepository repositoryRepository, PackageMetadataRepository packageMetadataRepository...
### Question: DefaultClientHeadersFactoryImpl implements ClientHeadersFactory { @Override public MultivaluedMap<String, String> update(MultivaluedMap<String, String> incomingHeaders, MultivaluedMap<String, String> clientOutgoingHeaders) { if (LOG.isLoggable(Level.FINER)) { LOG.entering(CLASS_NAME, "update", new Object[...
### 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: DebugBashCodeToggleSupport { public String disableDebugging(String sourceCode) throws IOException { int index = sourceCode.indexOf(DEBUG_POSTFIX); if (index == -1) { return sourceCode; } int pos = index + DEBUG_POSTFIX.length(); String data = sourceCode.substring(pos); if (data.startsWith("\n")) { data=da...
### 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: BashPIDSnippetSupport { public String buildKillOldTerminalsSnippet() { String code= "cd ~/.basheditor\n" + "KILL_TEXTFILE=\"./PID_debug-terminal_port_$1.txt\"\n" + "if [ -f \"$KILL_TEXTFILE\" ]; then\n" + " while IFS='' read -r LINE || [ -n \"${LINE}\" ]; do\n" + " kill -9 ${LINE}\n" + " done < $KILL_TEXT...
### 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: SimpleWordCodeCompletion { public Set<String> calculate(String source, int offset) { rebuildCacheIfNecessary(source); if (offset == 0) { return unmodifiableSet(allWordsCache); } String wanted = getTextbefore(source, offset); return filter(allWordsCache, wanted); } void add(String word); Set<String> calcu...
### Question: SimpleWordCodeCompletion { public String getTextbefore(String source, int offset) { if (source == null || source.isEmpty()) { return ""; } if (offset <= 0) { return ""; } int sourceLength = source.length(); if (offset > sourceLength) { return ""; } StringBuilder sb = new StringBuilder(); int current = off...
### Question: CommandStringToCommandListConverter { public List<String> convert(String commandString) { List<String> list = new ArrayList<>(); if (commandString == null) { return list; } String inspect = commandString.trim(); if (inspect.isEmpty()) { return list; } String[] commands = commandString.split(" "); for (Str...
### Question: SimpleStringUtils { public static String nextReducedVariableWord(String string, int offset) { return nextWord(string, offset, new ReducedVariableWordEndDetector()); } static boolean equals(String text1, String text2); static String shortString(String string, int max); static String nextReducedVariableWor...
### Question: DebugBashCodeToggleSupport { public String enableDebugging(String sourceCode, String hostname, int port) throws IOException { bashPIDSnippetSupport.ensureKillOldTerminalFileExistsInSystemUserHome(); bashPIDSnippetSupport.ensureStoreTerminalPIDFileExistsInSystemUserHome(); ensureDebugFileExistsInSystemUser...
### Question: SimpleStringUtils { public static String shortString(String string, int max) { if (max == 0) { return EMPTY; } if (string == null) { return EMPTY; } if (string.length() <= max) { return string; } if (max == 1) { return "."; } if (max == 2) { return ".."; } if (max == 3) { return "..."; } StringBuilder sb ...
### 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: CommandStringVariableReplaceSupport { public String replaceVariables(String commandLineWithVariables, Map<String,String> mapping) { if (mapping==null) { return commandLineWithVariables; } String result = ""+commandLineWithVariables; for (String key: mapping.keySet()) { String replace = mapping.get(key); i...
### Question: InternalTerminalCommandStringBuilder { public String build(TerminalLaunchContext context) { if (context == null) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(bashPIDFileSupport.buildWritePIDToPortSpecificTmpFileSnippet(context.getPort())); sb.append("cd "); sb.append(context.getUnixSty...
### 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: WallInfo { public boolean isCrossWall(Point a, Point b) { if (x2 < Math.min(a.getX(), b.getX()) || x1 > Math.max(a.getX(), b.getX())) { return false; } if (y2 < Math.min(a.getY(), b.getY()) || y1 > Math.max(a.getY(), b.getY())) { return false; } if (isInWall(b.getX(), b.getY()) && !isInWall(a.getX(), a.ge...
### 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: CommonUtils { @SuppressWarnings("unchecked") public static List<Result> selectSort(List<Result> results, int k, String distanceMethod) { int len = results.size(); assert len >= k; TreeSet<Result> set; Comparator<Result> comp = distanceMethod.trim().equals("euclidean") ? new AscendingOrderComparator() : ne...
### 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: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeArticleTotal> getArticleTotal(Date beginDate, Date endDate) throws WxErrorException { String responseContent = this.wxMpService.post(GET_ARTICLE_TOTAL, buildParams(beginDate, endDate)); return WxDataCubeArticleTotal.f...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeArticleResult> getUserRead(Date beginDate, Date endDate) throws WxErrorException { return this.getArticleResults(GET_USER_READ, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override List<W...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeArticleResult> getUserReadHour(Date beginDate, Date endDate) throws WxErrorException { return this.getArticleResults(GET_USER_READ_HOUR, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Overri...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeArticleResult> getUserShare(Date beginDate, Date endDate) throws WxErrorException { return this.getArticleResults(GET_USER_SHARE, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override List...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeArticleResult> getUserShareHour(Date beginDate, Date endDate) throws WxErrorException { return this.getArticleResults(GET_USER_SHARE_HOUR, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Over...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsg(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Override List<Wx...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgHour(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_HOUR, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Overrid...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgWeek(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_WEEK, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Overrid...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgMonth(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_MONTH, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Overr...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgDist(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_DIST, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService); @Overrid...
### 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: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgDistWeek(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_DIST_WEEK, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService);...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeMsgResult> getUpstreamMsgDistMonth(Date beginDate, Date endDate) throws WxErrorException { return this.getUpstreamMsg(GET_UPSTREAM_MSG_DIST_MONTH, beginDate, endDate); } WxMpDataCubeServiceImpl(WxMpService wxMpService...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeInterfaceResult> getInterfaceSummary(Date beginDate, Date endDate) throws WxErrorException { String responseContent = this.wxMpService.post(GET_INTERFACE_SUMMARY, buildParams(beginDate, endDate)); return WxDataCubeInt...
### Question: WxMpDataCubeServiceImpl implements WxMpDataCubeService { @Override public List<WxDataCubeInterfaceResult> getInterfaceSummaryHour(Date beginDate, Date endDate) throws WxErrorException { String responseContent = this.wxMpService.post(GET_INTERFACE_SUMMARY_HOUR, buildParams(beginDate, endDate)); return WxDa...
### 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 WxMpMaterialNewsBatchGetResult materialNewsBatchGet(int offset, int count) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/batchget_material"; Map<String, Object> params = new HashMap<>(); params.put("type", WxCon...
### Question: WxMpMaterialServiceImpl implements WxMpMaterialService { @Override public WxMpMaterialFileBatchGetResult materialFileBatchGet(String type, int offset, int count) throws WxErrorException { String url = MATERIAL_API_URL_PREFIX + "/batchget_material"; Map<String, Object> params = new HashMap<>(); params.put(...
### 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 WxMediaUploadResult mediaUpload(String mediaType, String fileType, InputStream inputStream) throws WxErrorException { try { return this.mediaUpload(mediaType, FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), fileTy...
### 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: WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateTmpTicket(int sceneId, Integer expireSeconds) throws WxErrorException { if (sceneId == 0) { throw new WxErrorException(WxError.newBuilder().setErrorCode(-1).setErrorMsg("临时二维码场景值不能为0!").build()); } if (expir...
### Question: WxMpQrcodeServiceImpl implements WxMpQrcodeService { @Override public WxMpQrCodeTicket qrCodeCreateLastTicket(int sceneId) throws WxErrorException { if (sceneId < 1 || sceneId > 100000) { throw new WxErrorException(WxError.newBuilder().setErrorCode(-1).setErrorMsg("永久二维码的场景值目前只支持1--100000!").build()); } S...
### 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: WxPayServiceImpl implements WxPayService { @Override public WxPayBillResult downloadBill(String billDate, String billType, String tarType, String deviceInfo) throws WxPayException { WxPayDownloadBillRequest request = new WxPayDownloadBillRequest(); request.setBillType(billType); request.setBillDate(billDa...
### Question: WxPayServiceImpl implements WxPayService { public void report(WxPayReportRequest request) throws WxPayException { request.checkAndSign(this.getConfig()); String url = this.getPayBaseUrl() + "/payitil/report"; String responseContent = this.post(url, request.toXML(), true); WxPayCommonResult result = WxPayB...