id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
72436214_56 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RequestValidator underTest;",
"type": "RequestValidator",
"var_name": "underTest"
},
{
"declarator": "validator",
"modifier": "private",
"original_string": "private... | {
"body": "@Test\n public void canHandleEntitySerialisationFailure() throws Exception {\n ObjectMapper mapper = mock(ObjectMapper.class);\n RequestValidator underTest = new RequestValidator(validator, mapper);\n given(mapper.writeValueAsString(any())).willThrow(new JsonGenerationException(\"ba... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RequestValidator.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RequestValidator.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public <T> Try<T> validate(T underTest) {\n Set<ConstraintViolation<T>> violations = validator.validate(underTest);\n\n if (violations.isEmpty()) {\n return Try.success(underTest);\n } else {\n Exception failure = createFailure(violations, underTest);\n ... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_21 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsTheWardByCode() throws Exception {\n Ward ward = ward().build();\n User user = user().withRole(Role.USER).withWards(newHashSet(ward)).build();\n given(wardRepository.findByCode(ward.getCode())).willReturn(Collections.singletonList(ward));\n\n Try<Wa... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(WardService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(WardService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "wardSummar... | {
"body": "@Transactional(readOnly = true)\n public Try<Ward> getByCode(String wardCode, User user) {\n List<Ward> wards = wardRepository.findByCode(wardCode);\n if (wards.isEmpty()) {\n String msg = String.format(\"No ward with code=%s\", wardCode);\n log.debug(msg);\n ... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_37 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private CanvassCardService underTest;",
"type": "CanvassCardService",
"var_name": "underTest"
},
{
"declarator": "wardService",
"modifier": "private",
"original_string": "p... | {
"body": "@Test\n public void returnsTheCanvassCard() throws Exception {\n User user = mock(User.class);\n Ward ward = ward().withWardCode(\"code\").build();\n byte[] pdfContent = \"content\".getBytes();\n given(wardService.getByCode(ward.getCode(), user)).willReturn(Try.success(ward))... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(CanvassCardService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(CanvassCardService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator... | {
"body": "public Try<byte[]> generateCanvassCard(ElectorsByStreetsRequest request, String wardCode, User user) {\n return wardService.getByCode(wardCode, user)\n .flatMap(ward -> {\n RequestInfo requestInfo = new RequestInfo(wardCode, ward.getName(), ward.getConstituency().ge... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_60 | {
"fields": [
{
"declarator": "underTest = new RestErrorHandler()",
"modifier": "private",
"original_string": "private RestErrorHandler underTest = new RestErrorHandler();",
"type": "RestErrorHandler",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinit... | {
"body": "@Test\n public void mapsValidationExceptionToBadRequest() throws Exception {\n ResponseEntity<?> responseEntity = underTest.mapToResponseEntity(new ValidationException(\"error\"));\n\n assertThat(responseEntity, hasStatusCode(equalTo(400)));\n }",
"class_method_signature": "RestErrorH... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RestErrorHandler.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RestErrorHandler.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public ResponseEntity<?> mapToResponseEntity(Exception exception) {\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_JSON);\n return mapToResponseEntity(exception, headers);\n }",
"class_method_signature": "RestErrorHandler.mapToResponseEnt... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_61 | {
"fields": [
{
"declarator": "underTest = new RestErrorHandler()",
"modifier": "private",
"original_string": "private RestErrorHandler underTest = new RestErrorHandler();",
"type": "RestErrorHandler",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinit... | {
"body": "@Test\n public void mapsLoginFailureToUnauthorized() throws Exception {\n ResponseEntity<?> responseEntity = underTest.mapToResponseEntity(new LoginFailure(\"error\"));\n\n assertThat(responseEntity, hasStatusCode(equalTo(401)));\n }",
"class_method_signature": "RestErrorHandlerTest.m... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RestErrorHandler.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RestErrorHandler.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public ResponseEntity<?> mapToResponseEntity(Exception exception) {\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_JSON);\n return mapToResponseEntity(exception, headers);\n }",
"class_method_signature": "RestErrorHandler.mapToResponseEnt... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_36 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private CanvassCardService underTest;",
"type": "CanvassCardService",
"var_name": "underTest"
},
{
"declarator": "wardService",
"modifier": "private",
"original_string": "p... | {
"body": "@Test\n public void returnsNotAuthorizedIfNoWardPermission() throws Exception {\n User user = mock(User.class);\n given(wardService.getByCode(\"code\", user))\n .willReturn(Try.failure(new NotAuthorizedFailure(\"notAuthorized\")));\n\n Try<byte[]> canvassCard = underT... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(CanvassCardService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(CanvassCardService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator... | {
"body": "public Try<byte[]> generateCanvassCard(ElectorsByStreetsRequest request, String wardCode, User user) {\n return wardService.getByCode(wardCode, user)\n .flatMap(ward -> {\n RequestInfo requestInfo = new RequestInfo(wardCode, ward.getName(), ward.getConstituency().ge... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_20 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsFailureIfWardNotFoundWhenGettingWardByCode() throws Exception {\n Ward w = ward().build();\n User user = user().withRole(Role.USER).withWards(newHashSet(w)).build();\n given(wardRepository.findByCode(w.getCode())).willReturn(Collections.emptyList());\n\n ... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(WardService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(WardService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "wardSummar... | {
"body": "@Transactional(readOnly = true)\n public Try<Ward> getByCode(String wardCode, User user) {\n List<Ward> wards = wardRepository.findByCode(wardCode);\n if (wards.isEmpty()) {\n String msg = String.format(\"No ward with code=%s\", wardCode);\n log.debug(msg);\n ... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_57 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RequestValidator underTest;",
"type": "RequestValidator",
"var_name": "underTest"
},
{
"declarator": "validator",
"modifier": "private",
"original_string": "private... | {
"body": "@Test\n public void failsWithMessages() throws Exception {\n Try<User> validate = underTest.validate(new User(null, null));\n\n assertThat(validate.isSuccess(), is(false));\n assertThat(validate.getFailure().getMessage(), containsString(\"name may not be null\"));\n assertTha... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RequestValidator.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RequestValidator.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public <T> Try<T> validate(T underTest) {\n Set<ConstraintViolation<T>> violations = validator.validate(underTest);\n\n if (violations.isEmpty()) {\n return Try.success(underTest);\n } else {\n Exception failure = createFailure(violations, underTest);\n ... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_7 | {
"fields": [],
"file": "common/src/test/java/com/infinityworks/common/lang/ListExtrasTest.java",
"identifier": "ListExtrasTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void isNullOrEmptyReturnsTrueIfListIsNull() throws Exception {\n assertThat(ListExtras.isNullOrEmpty(null), is(true));\n }",
"class_method_signature": "ListExtrasTest.isNullOrEmptyReturnsTrueIfListIsNull()",
"constructor": false,
"full_signature": "@Test public void isNull... | {
"fields": [],
"file": "common/src/main/java/com/infinityworks/common/lang/ListExtras.java",
"identifier": "ListExtras",
"interfaces": "",
"methods": [
{
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boole... | {
"body": "public static boolean isNullOrEmpty(List<?> underTest) {\n return underTest == null || underTest.isEmpty();\n }",
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boolean isNullOrEmpty(List<?> underTest)",
"ide... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_41 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RecordVotedService underTest;",
"type": "RecordVotedService",
"var_name": "underTest"
},
{
"declarator": "pafClient",
"modifier": "private",
"original_string": "pri... | {
"body": "@Test\n public void undosAWontVote() throws Exception {\n User user = user().withWriteAccess(true).build();\n Ern recordVote = Ern.valueOf(\"E05001221-PD-123-1\");\n Ward ward = ward().withWardCode(\"E05001221\").build();\n UUID contactId = UUID.randomUUID();\n Immutab... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RecordVotedService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(RecordVotedService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator... | {
"body": "public Try<DeleteContactResponse> undoWontVote(User user, Ern ern, UUID contactId) {\n if (!user.getWriteAccess()) {\n log.warn(\"User={} tried to delete contact for ern={} but does not have write access\", user, ern);\n return Try.failure(new NotAuthorizedFailure(\"Forbidden\"... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_16 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private MapsRequestExecutor underTest;",
"type": "MapsRequestExecutor",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinityworks/webapp/clients/gmaps/MapsRequestExecu... | {
"body": "@Test\n public void returnsAWrappedMapsApiFailureIfTheRequestReturnsServerError() throws Exception {\n CallStub<String> request = CallStub.serverError();\n\n Try<String> response = underTest.execute(request);\n\n assertThat(response.isFailure(), is(true));\n assertThat(respon... | {
"fields": [
{
"declarator": "FORMAT = \"Error calling Maps API %s. Response contained status code=%d, status text=%s\"",
"modifier": "private static final",
"original_string": "private static final String FORMAT = \"Error calling Maps API %s. Response contained status code=%d, status text=%s\"... | {
"body": "public <T> Try<T> execute(Call<T> call) {\n try {\n Response<T> response = call.execute();\n if (response.isSuccessful()) {\n T body = response.body();\n return Try.success(body);\n } else {\n return handleUnsuccessful(cal... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_54 | {
"fields": [],
"file": "web-server/src/test/java/com/infinityworks/webapp/security/SecurityUtilsTest.java",
"identifier": "SecurityUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void returnsFailureWhenUsernameIsNull() throws Exception {\n String header = \"Basic OmFzZGFkc2FzZA==\";\n\n Try<Credentials> credentialsTry = SecurityUtils.credentialsFromAuthHeader(header);\n\n assertThat(credentialsTry.isSuccess(), is(false));\n }",
"class_met... | {
"fields": [],
"file": "web-server/src/main/java/com/infinityworks/webapp/security/SecurityUtils.java",
"identifier": "SecurityUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SecurityUtils.credentialsFromAuthHeader(String authHeader)",
"constructor": false,
"full_sig... | {
"body": "public static Try<Credentials> credentialsFromAuthHeader(String authHeader) {\n if (!authHeader.contains(\"Basic \")) {\n return loginFailure();\n } else {\n String credsPart = authHeader.replaceFirst(\"Basic \", \"\");\n String decoded = new String(Base64.dec... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_4 | {
"fields": [],
"file": "common/src/test/java/com/infinityworks/common/lang/ListExtrasTest.java",
"identifier": "ListExtrasTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void noneNullReturnsFalseIfListIsNull() throws Exception {\n assertThat(ListExtras.noneNull(null), is(false));\n }",
"class_method_signature": "ListExtrasTest.noneNullReturnsFalseIfListIsNull()",
"constructor": false,
"full_signature": "@Test public void noneNullReturnsFal... | {
"fields": [],
"file": "common/src/main/java/com/infinityworks/common/lang/ListExtras.java",
"identifier": "ListExtras",
"interfaces": "",
"methods": [
{
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boole... | {
"body": "public static boolean noneNull(Collection<?> underTest) {\n return underTest != null && underTest.stream().allMatch(o -> o != null);\n }",
"class_method_signature": "ListExtras.noneNull(Collection<?> underTest)",
"constructor": false,
"full_signature": "public static boolean noneNull(Collec... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_42 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RecordVotedService underTest;",
"type": "RecordVotedService",
"var_name": "underTest"
},
{
"declarator": "pafClient",
"modifier": "private",
"original_string": "pri... | {
"body": "@Test\n public void failsToRecordVoteIfUserDoesNotHaveWardPermission() throws Exception {\n User user = user().withWriteAccess(true).build();\n Ern recordVote = Ern.valueOf(\"E05001221-PD-123-1\");\n Call<RecordVotedResponse> call = CallStub.success(ImmutableRecordVotedResponse.buil... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RecordVotedService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(RecordVotedService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator... | {
"body": "public Try<RecordVoteResponse> recordVote(User user, Ern ern) {\n return user\n .ensureWriteAccess()\n .flatMap(resolvedUser -> wardService.getByCode(ern.getWardCode(), user)\n .flatMap(ward -> {\n Call<RecordVotedRespon... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_15 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private MapsRequestExecutor underTest;",
"type": "MapsRequestExecutor",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinityworks/webapp/clients/gmaps/MapsRequestExecu... | {
"body": "@Test\n public void returnsTheRequestContent() throws Exception {\n String content = \"data\";\n CallStub<String> request = CallStub.success(content);\n\n Try<String> response = underTest.execute(request);\n\n assertThat(response, isSuccess(equalTo(content)));\n }",
"cla... | {
"fields": [
{
"declarator": "FORMAT = \"Error calling Maps API %s. Response contained status code=%d, status text=%s\"",
"modifier": "private static final",
"original_string": "private static final String FORMAT = \"Error calling Maps API %s. Response contained status code=%d, status text=%s\"... | {
"body": "public <T> Try<T> execute(Call<T> call) {\n try {\n Response<T> response = call.execute();\n if (response.isSuccessful()) {\n T body = response.body();\n return Try.success(body);\n } else {\n return handleUnsuccessful(cal... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_39 | {
"fields": [
{
"declarator": "userRepository",
"modifier": "private",
"original_string": "private UserRepository userRepository;",
"type": "UserRepository",
"var_name": "userRepository"
},
{
"declarator": "underTest",
"modifier": "private",
"original_string... | {
"body": "@Test\n public void returnsFailureIfCannotFindUser() throws Exception {\n User amy = user().withFirstName(\"Amy\").build();\n given(userRepository.findOne(amy.getId())).willReturn(amy);\n Principal p = new BasicUserPrincipal(\"name\");\n\n Try<User> userTry = underTest.extrac... | {
"fields": [
{
"declarator": "userRepository",
"modifier": "private final",
"original_string": "private final UserRepository userRepository;",
"type": "UserRepository",
"var_name": "userRepository"
}
],
"file": "web-server/src/main/java/com/infinityworks/webapp/service/Sessi... | {
"body": "@Transactional(readOnly = true)\n public Try<User> extractUserFromPrincipal(Principal principal) {\n if (principal instanceof UsernamePasswordAuthenticationToken) {\n Object sessionPrincipal = ((UsernamePasswordAuthenticationToken) principal).getPrincipal();\n if (sessionPri... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_58 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private ConstituenciesStatsConverter underTest;",
"type": "ConstituenciesStatsConverter",
"var_name": "underTest"
},
{
"declarator": "mappingService",
"modifier": "private",
... | {
"body": "@Test\n public void convertsTheConstituenciesStats() throws Exception {\n when(mappingService.getRegionByConstituency(\"E14000649\")).thenReturn(\"West Midlands\");\n\n StatsIntention intention = ImmutableStatsIntention.builder()\n .withProbablyRemain(1)\n .wi... | {
"fields": [
{
"declarator": "regionMappingService",
"modifier": "private final",
"original_string": "private final ConstituencyRegionMappingService regionMappingService;",
"type": "ConstituencyRegionMappingService",
"var_name": "regionMappingService"
}
],
"file": "web-serve... | {
"body": "@Override\n public StatsOverview apply(AllConstituenciesStatsResponse constituenciesStats) {\n int canvassed = 0;\n int pledges = 0;\n int voted = 0;\n int votedPledges = 0;\n List<ConstituenciesStatsResponse> transformedStats = new ArrayList<>();\n\n for (Const... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_8 | {
"fields": [],
"file": "common/src/test/java/com/infinityworks/common/lang/ListExtrasTest.java",
"identifier": "ListExtrasTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void isNullOrEmptyReturnsTrueIfListIsEmpty() throws Exception {\n List<Integer> data = emptyList();\n\n boolean isValid = ListExtras.isNullOrEmpty(data);\n\n assertThat(isValid, is(true));\n }",
"class_method_signature": "ListExtrasTest.isNullOrEmptyReturnsTrueIf... | {
"fields": [],
"file": "common/src/main/java/com/infinityworks/common/lang/ListExtras.java",
"identifier": "ListExtras",
"interfaces": "",
"methods": [
{
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boole... | {
"body": "public static boolean isNullOrEmpty(List<?> underTest) {\n return underTest == null || underTest.isEmpty();\n }",
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boolean isNullOrEmpty(List<?> underTest)",
"ide... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_19 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsFailureIfUserDoesNotHavePermissionWhenGettingWardByCode() throws Exception {\n Ward w = ward().build();\n User user = user().withRole(Role.USER).build();\n given(wardRepository.findByCode(w.getCode())).willReturn(Collections.singletonList(w));\n\n T... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(WardService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(WardService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "wardSummar... | {
"body": "@Transactional(readOnly = true)\n public Try<Ward> getByCode(String wardCode, User user) {\n List<Ward> wards = wardRepository.findByCode(wardCode);\n if (wards.isEmpty()) {\n String msg = String.format(\"No ward with code=%s\", wardCode);\n log.debug(msg);\n ... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_62 | {
"fields": [
{
"declarator": "underTest = new RestErrorHandler()",
"modifier": "private",
"original_string": "private RestErrorHandler underTest = new RestErrorHandler();",
"type": "RestErrorHandler",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinit... | {
"body": "@Test\n public void mapsBadCredentialsToUnauthorized() throws Exception {\n ResponseEntity<?> responseEntity = underTest.mapToResponseEntity(new BadCredentialsException(\"error\"));\n\n assertThat(responseEntity, hasStatusCode(equalTo(401)));\n }",
"class_method_signature": "RestError... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RestErrorHandler.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RestErrorHandler.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public ResponseEntity<?> mapToResponseEntity(Exception exception) {\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_JSON);\n return mapToResponseEntity(exception, headers);\n }",
"class_method_signature": "RestErrorHandler.mapToResponseEnt... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_35 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsNotAuthorizedIfNonAdminWhenRemoveConstituencyFromUser() throws Exception {\n User admin = user().withRole(Role.USER).build();\n User user = user().withConstituencies(new HashSet<>()).build();\n Constituency constituency = constituency().build();\n g... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ConstituencyAssociationService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(ConstituencyAssociationService.class);",
"type": "Logger",
"var_name": "log"
},... | {
"body": "@Transactional\n public Try<User> removeUserAssociation(User user, UUID constituencyID, UUID userID) {\n if (!user.isAdmin()) {\n log.error(\"Non admin attempted to remove association of user={} to constituency={}. user={}\", userID, constituencyID, user);\n return Try.failu... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_23 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsFailureIfConstituencyNotFound() throws Exception {\n User user = mock(User.class);\n Constituency c = constituency().build();\n given(constituencyRepository.findOne(c.getId())).willReturn(null);\n\n Try<UserRestrictedWards> result = underTest.findBy... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(WardService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(WardService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "wardSummar... | {
"body": "@Transactional(readOnly = true)\n public Try<UserRestrictedWards> findByConstituency(UUID constituencyID, User user) {\n log.debug(\"Finding accessible wards for constituency={} user={}\", constituencyID, user);\n\n return Optional.ofNullable(constituencyRepository.findOne(constituencyID))... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_22 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsTheWards() throws Exception {\n Constituency c = constituency().build();\n Set<Ward> wards = newHashSet(\n ward().withWardName(\"Willenhall\").withConstituency(c).build(),\n ward().withWardName(\"Binley\").withConstituency(c).build()... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(WardService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(WardService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "wardSummar... | {
"body": "@Transactional(readOnly = true)\n public Try<UserRestrictedWards> findByConstituency(UUID constituencyID, User user) {\n log.debug(\"Finding accessible wards for constituency={} user={}\", constituencyID, user);\n\n return Optional.ofNullable(constituencyRepository.findOne(constituencyID))... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_34 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsNotFoundIfConstituencyNotFoundWhenRemoveConstituencyFromUser() throws Exception {\n User admin = user().withRole(Role.ADMIN).build();\n User user = user().withConstituencies(new HashSet<>()).build();\n Constituency constituency = constituency().build();\n ... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ConstituencyAssociationService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(ConstituencyAssociationService.class);",
"type": "Logger",
"var_name": "log"
},... | {
"body": "@Transactional\n public Try<User> removeUserAssociation(User user, UUID constituencyID, UUID userID) {\n if (!user.isAdmin()) {\n log.error(\"Non admin attempted to remove association of user={} to constituency={}. user={}\", userID, constituencyID, user);\n return Try.failu... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_63 | {
"fields": [
{
"declarator": "underTest = new RestErrorHandler()",
"modifier": "private",
"original_string": "private RestErrorHandler underTest = new RestErrorHandler();",
"type": "RestErrorHandler",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinit... | {
"body": "@Test\n public void mapsAccessDeniedToForbidden() throws Exception {\n ResponseEntity<?> responseEntity = underTest.mapToResponseEntity(new AccessDeniedException(\"error\"));\n\n assertThat(responseEntity, hasStatusCode(equalTo(403)));\n }",
"class_method_signature": "RestErrorHandler... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RestErrorHandler.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RestErrorHandler.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public ResponseEntity<?> mapToResponseEntity(Exception exception) {\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_JSON);\n return mapToResponseEntity(exception, headers);\n }",
"class_method_signature": "RestErrorHandler.mapToResponseEnt... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_18 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RemoveExpiredPasswordResetTokensService underTest;",
"type": "RemoveExpiredPasswordResetTokensService",
"var_name": "underTest"
},
{
"declarator": "repository",
"modifier... | {
"body": "@Test\n public void removesTheExpiredPasswordToken() throws Exception {\n given(repository.deleteByExpiresLessThan(any())).willReturn(1L);\n\n Long numDeleted = underTest.removeExpiredTokens();\n\n assertThat(numDeleted, is(1L));\n }",
"class_method_signature": "RemoveExpiredPa... | {
"fields": [
{
"declarator": "tokenRepository",
"modifier": "private final",
"original_string": "private final PasswordResetTokenRepository tokenRepository;",
"type": "PasswordResetTokenRepository",
"var_name": "tokenRepository"
}
],
"file": "web-server/src/main/java/com/inf... | {
"body": "@Transactional\n public Long removeExpiredTokens() {\n return tokenRepository.deleteByExpiresLessThan(now());\n }",
"class_method_signature": "RemoveExpiredPasswordResetTokensService.removeExpiredTokens()",
"constructor": false,
"full_signature": "@Transactional public Long removeExpired... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_9 | {
"fields": [],
"file": "common/src/test/java/com/infinityworks/common/lang/ListExtrasTest.java",
"identifier": "ListExtrasTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void isNullOrEmptyReturnsFalseIfListHasElements() throws Exception {\n List<Integer> data = asList(1, 8, 4);\n\n boolean isValid = ListExtras.isNullOrEmpty(data);\n\n assertThat(isValid, is(false));\n }",
"class_method_signature": "ListExtrasTest.isNullOrEmptyRet... | {
"fields": [],
"file": "common/src/main/java/com/infinityworks/common/lang/ListExtras.java",
"identifier": "ListExtras",
"interfaces": "",
"methods": [
{
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boole... | {
"body": "public static boolean isNullOrEmpty(List<?> underTest) {\n return underTest == null || underTest.isEmpty();\n }",
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boolean isNullOrEmpty(List<?> underTest)",
"ide... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_59 | {
"fields": [],
"file": "web-server/src/test/java/com/infinityworks/webapp/converter/PafToStreetResponseConverterTest.java",
"identifier": "PafToStreetResponseConverterTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void mapsTheStreetResponseFromPaf() {\n PafToStreetResponseConverter underTest = new PafToStreetResponseConverter();\n\n Street streetResponse = underTest.apply(ImmutablePafStreetResponse.builder()\n .withDependentStreet(\"dependentStreet\")\n .... | {
"fields": [],
"file": "web-server/src/main/java/com/infinityworks/webapp/converter/PafToStreetResponseConverter.java",
"identifier": "PafToStreetResponseConverter",
"interfaces": "implements Function<PafStreetResponse, Street>",
"methods": [
{
"class_method_signature": "PafToStreetResponseConverte... | {
"body": "@Override\n public Street apply(PafStreetResponse pafStreet) {\n return ImmutableStreet\n .builder()\n .withMainStreet(pafStreet.mainStreet())\n .withPostTown(pafStreet.postTown())\n .withDependentStreet(pafStreet.dependentStreet())\n ... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_38 | {
"fields": [
{
"declarator": "userRepository",
"modifier": "private",
"original_string": "private UserRepository userRepository;",
"type": "UserRepository",
"var_name": "userRepository"
},
{
"declarator": "underTest",
"modifier": "private",
"original_string... | {
"body": "@Test\n public void extractsUserFromSession() throws Exception {\n User amy = user().withFirstName(\"Amy\").build();\n given(userRepository.findOne(amy.getId())).willReturn(amy);\n CurrentUser user = new CurrentUser(amy);\n Principal p = new UsernamePasswordAuthenticationToke... | {
"fields": [
{
"declarator": "userRepository",
"modifier": "private final",
"original_string": "private final UserRepository userRepository;",
"type": "UserRepository",
"var_name": "userRepository"
}
],
"file": "web-server/src/main/java/com/infinityworks/webapp/service/Sessi... | {
"body": "@Transactional(readOnly = true)\n public Try<User> extractUserFromPrincipal(Principal principal) {\n if (principal instanceof UsernamePasswordAuthenticationToken) {\n Object sessionPrincipal = ((UsernamePasswordAuthenticationToken) principal).getPrincipal();\n if (sessionPri... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_14 | {
"fields": [
{
"declarator": "req",
"modifier": "private",
"original_string": "private HttpServletRequest req;",
"type": "HttpServletRequest",
"var_name": "req"
},
{
"declarator": "res",
"modifier": "private",
"original_string": "private HttpServletResponse... | {
"body": "@Test\n public void allowsAnyHostIfWildcard() throws Exception {\n given(req.getHeader(\"Origin\")).willReturn(\"http://111.11.11.111\");\n CorsConfig allowedHosts = new CorsConfig(ImmutableSet.of(\"*\"), \"\");\n CorsFilter underTest = new CorsFilter(allowedHosts);\n\n under... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(CorsFilter.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(CorsFilter.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "@Override\n public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {\n\n HttpServletRequest request = (HttpServletRequest) req;\n HttpServletResponse response = (HttpServletResponse) res;\n String requestOrigin = request... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_43 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RecordVotedService underTest;",
"type": "RecordVotedService",
"var_name": "underTest"
},
{
"declarator": "pafClient",
"modifier": "private",
"original_string": "pri... | {
"body": "@Test\n public void failsToRecordVoteIfUserDoesNotHaveWriteAccess() throws Exception {\n User user = user().withWriteAccess(false).build();\n Ern recordVote = Ern.valueOf(\"E05001221-PD-123-1\");\n\n Try<RecordVoteResponse> recordVoteResponse = underTest.recordVote(user, recordVote)... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RecordVotedService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(RecordVotedService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator... | {
"body": "public Try<RecordVoteResponse> recordVote(User user, Ern ern) {\n return user\n .ensureWriteAccess()\n .flatMap(resolvedUser -> wardService.getByCode(ern.getWardCode(), user)\n .flatMap(ward -> {\n Call<RecordVotedRespon... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_5 | {
"fields": [],
"file": "common/src/test/java/com/infinityworks/common/lang/ListExtrasTest.java",
"identifier": "ListExtrasTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void noneNullReturnsTrueIfAllElementPresent() throws Exception {\n List<Integer> data = asList(1, 4, 2);\n\n boolean isValid = ListExtras.noneNull(data);\n\n assertThat(isValid, is(true));\n }",
"class_method_signature": "ListExtrasTest.noneNullReturnsTrueIfAllEl... | {
"fields": [],
"file": "common/src/main/java/com/infinityworks/common/lang/ListExtras.java",
"identifier": "ListExtras",
"interfaces": "",
"methods": [
{
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boole... | {
"body": "public static boolean noneNull(Collection<?> underTest) {\n return underTest != null && underTest.stream().allMatch(o -> o != null);\n }",
"class_method_signature": "ListExtras.noneNull(Collection<?> underTest)",
"constructor": false,
"full_signature": "public static boolean noneNull(Collec... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_55 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RequestValidator underTest;",
"type": "RequestValidator",
"var_name": "underTest"
},
{
"declarator": "validator",
"modifier": "private",
"original_string": "private... | {
"body": "@Test\n public void passesValidation() throws Exception {\n Try<User> validate = underTest.validate(new User(\"a\", 1));\n\n assertThat(validate.isSuccess(), is(true));\n }",
"class_method_signature": "RequestValidatorTest.passesValidation()",
"constructor": false,
"full_signature... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RequestValidator.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RequestValidator.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public <T> Try<T> validate(T underTest) {\n Set<ConstraintViolation<T>> violations = validator.validate(underTest);\n\n if (violations.isEmpty()) {\n return Try.success(underTest);\n } else {\n Exception failure = createFailure(violations, underTest);\n ... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_48 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RequestPasswordResetService underTest;",
"type": "RequestPasswordResetService",
"var_name": "underTest"
},
{
"declarator": "userService",
"modifier": "private",
"or... | {
"body": "@Test\n public void requestsPasswordReset() throws Exception {\n PasswordResetToken token = token();\n\n given(passwordResetTokenRepository.findOneByUserUsername(token.getUser().getUsername())).willReturn(Optional.empty());\n given(passwordResetTokenRepository.save((PasswordResetTok... | {
"fields": [
{
"declarator": "userService",
"modifier": "private final",
"original_string": "private final UserService userService;",
"type": "UserService",
"var_name": "userService"
},
{
"declarator": "passwordResetNotifier",
"modifier": "private final",
"... | {
"body": "@Transactional\n public Try<RequestPasswordResetResponse> requestPasswordReset(PasswordResetRequest request) {\n return userService\n .getByUsername(request.username())\n .flatMap(user -> {\n PasswordResetToken resetToken = passwordResetTokenGenera... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_64 | {
"fields": [
{
"declarator": "underTest = new RestErrorHandler()",
"modifier": "private",
"original_string": "private RestErrorHandler underTest = new RestErrorHandler();",
"type": "RestErrorHandler",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinit... | {
"body": "@Test\n public void mapsPafApiFailureToServerError() throws Exception {\n ResponseEntity<?> responseEntity = underTest.mapToResponseEntity(new PafApiFailure(\"error\"));\n\n assertThat(responseEntity, hasStatusCode(equalTo(500)));\n }",
"class_method_signature": "RestErrorHandlerTest.... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RestErrorHandler.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RestErrorHandler.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public ResponseEntity<?> mapToResponseEntity(Exception exception) {\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_JSON);\n return mapToResponseEntity(exception, headers);\n }",
"class_method_signature": "RestErrorHandler.mapToResponseEnt... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_33 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsNotFoundIfUserNotFoundWhenRemoveConstituencyFromUser() throws Exception {\n User admin = user().withRole(Role.ADMIN).build();\n User user = user().withConstituencies(new HashSet<>()).build();\n Constituency constituency = constituency().build();\n g... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ConstituencyAssociationService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(ConstituencyAssociationService.class);",
"type": "Logger",
"var_name": "log"
},... | {
"body": "@Transactional\n public Try<User> removeUserAssociation(User user, UUID constituencyID, UUID userID) {\n if (!user.isAdmin()) {\n log.error(\"Non admin attempted to remove association of user={} to constituency={}. user={}\", userID, constituencyID, user);\n return Try.failu... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_25 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private AddressService underTest;",
"type": "AddressService",
"var_name": "underTest"
},
{
"declarator": "wardService",
"modifier": "private",
"original_string": "private W... | {
"body": "@Test\n public void returnsNotAuthorizedIfUserDoesNotHaveWardPermissionWhenGettingTownStreetsByWardCode() throws Exception {\n User userWithoutWardPermissions = user()\n .withWards(newHashSet())\n .withConstituencies(newHashSet())\n .build();\n ... | {
"fields": [
{
"declarator": "wardService",
"modifier": "private final",
"original_string": "private final WardService wardService;",
"type": "WardService",
"var_name": "wardService"
},
{
"declarator": "pafAddressService",
"modifier": "private final",
"orig... | {
"body": "public Try<StreetsByWardResponse> getTownStreetsByWardCode(String wardCode, User user) {\n return wardService\n .getByCode(wardCode, user)\n .flatMap(ward -> pafAddressService.getStreetsByWard(ward.getCode()));\n }",
"class_method_signature": "AddressService.getTow... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_52 | {
"fields": [],
"file": "web-server/src/test/java/com/infinityworks/webapp/security/SecurityUtilsTest.java",
"identifier": "SecurityUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void returnsFailureIfAuthHeaderIsJunk() throws Exception {\n String header = \"Basic 8wgq8wgweg0qweg=\";\n\n Try<Credentials> credentialsTry = SecurityUtils.credentialsFromAuthHeader(header);\n\n assertThat(credentialsTry.isSuccess(), is(false));\n }",
"class_met... | {
"fields": [],
"file": "web-server/src/main/java/com/infinityworks/webapp/security/SecurityUtils.java",
"identifier": "SecurityUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SecurityUtils.credentialsFromAuthHeader(String authHeader)",
"constructor": false,
"full_sig... | {
"body": "public static Try<Credentials> credentialsFromAuthHeader(String authHeader) {\n if (!authHeader.contains(\"Basic \")) {\n return loginFailure();\n } else {\n String credsPart = authHeader.replaceFirst(\"Basic \", \"\");\n String decoded = new String(Base64.dec... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_2 | {
"fields": [],
"file": "common/src/test/java/com/infinityworks/common/lang/StringExtrasTest.java",
"identifier": "StringExtrasTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void returnsTrueIfNonNullAndPresent() throws Exception {\n assertThat(StringExtras.isNullOrEmpty(\"sdfsdf\"), is(false));\n }",
"class_method_signature": "StringExtrasTest.returnsTrueIfNonNullAndPresent()",
"constructor": false,
"full_signature": "@Test public void returns... | {
"fields": [],
"file": "common/src/main/java/com/infinityworks/common/lang/StringExtras.java",
"identifier": "StringExtras",
"interfaces": "",
"methods": [
{
"class_method_signature": "StringExtras.isNullOrEmpty(String underTest)",
"constructor": false,
"full_signature": "public static ... | {
"body": "public static boolean isNullOrEmpty(String underTest) {\n return underTest == null || underTest.isEmpty();\n }",
"class_method_signature": "StringExtras.isNullOrEmpty(String underTest)",
"constructor": false,
"full_signature": "public static boolean isNullOrEmpty(String underTest)",
"iden... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_44 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private UserService underTest;",
"type": "UserService",
"var_name": "underTest"
},
{
"declarator": "userRepository",
"modifier": "private",
"original_string": "private User... | {
"body": "@Test\n public void updatesTheUser() throws Exception {\n User user = user()\n .withFirstName(\"anil\")\n .withLastName(\"kumar\")\n .withUsername(\"anil@kumar.com\")\n .withWriteAccess(false)\n .build();\n User adm... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(UserService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(UserService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "userReposi... | {
"body": "@Transactional\n public Try<User> update(User user, UUID userToUpdate, UpdateUserRequest request) {\n if (!user.isAdmin()) {\n log.warn(\"Non admin tried to update a user!. User={}, userToUpdate={}\", user, userToUpdate);\n return Try.failure(new NotAuthorizedFailure(\"Not a... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_13 | {
"fields": [
{
"declarator": "req",
"modifier": "private",
"original_string": "private HttpServletRequest req;",
"type": "HttpServletRequest",
"var_name": "req"
},
{
"declarator": "res",
"modifier": "private",
"original_string": "private HttpServletResponse... | {
"body": "@Test\n public void deniesTheHostIfNotRegistered() throws Exception {\n given(req.getHeader(\"Origin\")).willReturn(\"http://111.11.11.111\");\n CorsConfig allowedHosts = new CorsConfig(ImmutableSet.of(\"http://135.31.22.221\"), \"\");\n CorsFilter underTest = new CorsFilter(allowed... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(CorsFilter.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(CorsFilter.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "@Override\n public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {\n\n HttpServletRequest request = (HttpServletRequest) req;\n HttpServletResponse response = (HttpServletResponse) res;\n String requestOrigin = request... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_29 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void returnsNotFoundIfUserNotFoundWhenAssociateConstituencyToUser() throws Exception {\n User admin = user().withRole(Role.ADMIN).build();\n User user = user().withConstituencies(new HashSet<>()).build();\n Constituency constituency = constituency().build();\n ... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ConstituencyAssociationService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(ConstituencyAssociationService.class);",
"type": "Logger",
"var_name": "log"
},... | {
"body": "@Transactional\n public Try<User> associateToUser(User permissible, UUID constituencyID, UUID userID) {\n if (!permissible.isAdmin()) {\n log.error(\"Non admin attempted to associate user={} to constituency={}. loggedInUser={}\", userID, constituencyID, permissible);\n retur... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_28 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void associatesConstituencyToUser() throws Exception {\n User admin = user().withRole(Role.ADMIN).build();\n User user = user().withConstituencies(new HashSet<>()).build();\n Constituency constituency = constituency().build();\n given(constituencyRepository.fin... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ConstituencyAssociationService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(ConstituencyAssociationService.class);",
"type": "Logger",
"var_name": "log"
},... | {
"body": "@Transactional\n public Try<User> associateToUser(User permissible, UUID constituencyID, UUID userID) {\n if (!permissible.isAdmin()) {\n log.error(\"Non admin attempted to associate user={} to constituency={}. loggedInUser={}\", userID, constituencyID, permissible);\n retur... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_12 | {
"fields": [
{
"declarator": "req",
"modifier": "private",
"original_string": "private HttpServletRequest req;",
"type": "HttpServletRequest",
"var_name": "req"
},
{
"declarator": "res",
"modifier": "private",
"original_string": "private HttpServletResponse... | {
"body": "@Test\n public void allowsTheHostIfDefined() throws Exception {\n given(req.getHeader(\"Origin\")).willReturn(\"http://135.31.22.221\");\n CorsConfig allowedHosts = new CorsConfig(ImmutableSet.of(\"http://135.31.22.221\"), \"\");\n CorsFilter underTest = new CorsFilter(allowedHosts)... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(CorsFilter.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(CorsFilter.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator":... | {
"body": "@Override\n public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {\n\n HttpServletRequest request = (HttpServletRequest) req;\n HttpServletResponse response = (HttpServletResponse) res;\n String requestOrigin = request... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_45 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private UserService underTest;",
"type": "UserService",
"var_name": "underTest"
},
{
"declarator": "userRepository",
"modifier": "private",
"original_string": "private User... | {
"body": "@Test\n public void updateUserFailsIfNonAdmin() throws Exception {\n User user = user()\n .withFirstName(\"anil\")\n .withLastName(\"kumar\")\n .withUsername(\"anil@kumar.com\")\n .withWriteAccess(false)\n .build();\n ... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(UserService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(UserService.class);",
"type": "Logger",
"var_name": "log"
},
{
"declarator": "userReposi... | {
"body": "@Transactional\n public Try<User> update(User user, UUID userToUpdate, UpdateUserRequest request) {\n if (!user.isAdmin()) {\n log.warn(\"Non admin tried to update a user!. User={}, userToUpdate={}\", user, userToUpdate);\n return Try.failure(new NotAuthorizedFailure(\"Not a... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_3 | {
"fields": [],
"file": "common/src/test/java/com/infinityworks/common/lang/ListExtrasTest.java",
"identifier": "ListExtrasTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void noneNullReturnsFalseIfSomeElementIsNull() throws Exception {\n List<Integer> data = asList(1, 4, null);\n\n boolean isValid = ListExtras.noneNull(data);\n\n assertThat(isValid, is(false));\n }",
"class_method_signature": "ListExtrasTest.noneNullReturnsFalseI... | {
"fields": [],
"file": "common/src/main/java/com/infinityworks/common/lang/ListExtras.java",
"identifier": "ListExtras",
"interfaces": "",
"methods": [
{
"class_method_signature": "ListExtras.isNullOrEmpty(List<?> underTest)",
"constructor": false,
"full_signature": "public static boole... | {
"body": "public static boolean noneNull(Collection<?> underTest) {\n return underTest != null && underTest.stream().allMatch(o -> o != null);\n }",
"class_method_signature": "ListExtras.noneNull(Collection<?> underTest)",
"constructor": false,
"full_signature": "public static boolean noneNull(Collec... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_53 | {
"fields": [],
"file": "web-server/src/test/java/com/infinityworks/webapp/security/SecurityUtilsTest.java",
"identifier": "SecurityUtilsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void returnsFailureWhenPasswordIsNull() throws Exception {\n String header = \"Basic YWRtaW46\";\n\n Try<Credentials> credentialsTry = SecurityUtils.credentialsFromAuthHeader(header);\n\n assertThat(credentialsTry.isSuccess(), is(false));\n }",
"class_method_sign... | {
"fields": [],
"file": "web-server/src/main/java/com/infinityworks/webapp/security/SecurityUtils.java",
"identifier": "SecurityUtils",
"interfaces": "",
"methods": [
{
"class_method_signature": "SecurityUtils.credentialsFromAuthHeader(String authHeader)",
"constructor": false,
"full_sig... | {
"body": "public static Try<Credentials> credentialsFromAuthHeader(String authHeader) {\n if (!authHeader.contains(\"Basic \")) {\n return loginFailure();\n } else {\n String credsPart = authHeader.replaceFirst(\"Basic \", \"\");\n String decoded = new String(Base64.dec... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_24 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private AddressService underTest;",
"type": "AddressService",
"var_name": "underTest"
},
{
"declarator": "wardService",
"modifier": "private",
"original_string": "private W... | {
"body": "@Test\n public void returnsNotFoundIfNoWardWhenGettingTownStreetsByWardCode() throws Exception {\n User u = user().build();\n String wardCode = \"E0911135\";\n given(wardService.getByCode(wardCode, u))\n .willReturn(Try.failure(new NotFoundFailure(\"failed\")));\n\n ... | {
"fields": [
{
"declarator": "wardService",
"modifier": "private final",
"original_string": "private final WardService wardService;",
"type": "WardService",
"var_name": "wardService"
},
{
"declarator": "pafAddressService",
"modifier": "private final",
"orig... | {
"body": "public Try<StreetsByWardResponse> getTownStreetsByWardCode(String wardCode, User user) {\n return wardService\n .getByCode(wardCode, user)\n .flatMap(ward -> pafAddressService.getStreetsByWard(ward.getCode()));\n }",
"class_method_signature": "AddressService.getTow... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_32 | {
"fields": [
{
"declarator": "constituencyRepository",
"modifier": "private",
"original_string": "private ConstituencyRepository constituencyRepository;",
"type": "ConstituencyRepository",
"var_name": "constituencyRepository"
},
{
"declarator": "underTest",
"modi... | {
"body": "@Test\n public void removesAssociationOfConstituencyToUser() throws Exception {\n User admin = user().withRole(Role.ADMIN).build();\n Constituency constituency = constituency().build();\n User user = user().withConstituencies(newHashSet(constituency)).build();\n given(constit... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(ConstituencyAssociationService.class)",
"modifier": "private final",
"original_string": "private final Logger log = LoggerFactory.getLogger(ConstituencyAssociationService.class);",
"type": "Logger",
"var_name": "log"
},... | {
"body": "@Transactional\n public Try<User> removeUserAssociation(User user, UUID constituencyID, UUID userID) {\n if (!user.isAdmin()) {\n log.error(\"Non admin attempted to remove association of user={} to constituency={}. user={}\", userID, constituencyID, user);\n return Try.failu... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_65 | {
"fields": [
{
"declarator": "underTest = new RestErrorHandler()",
"modifier": "private",
"original_string": "private RestErrorHandler underTest = new RestErrorHandler();",
"type": "RestErrorHandler",
"var_name": "underTest"
}
],
"file": "web-server/src/test/java/com/infinit... | {
"body": "@Test\n public void unmappedFailureToServerError() throws Exception {\n ResponseEntity<?> responseEntity = underTest.mapToResponseEntity(new NonExistantFailure());\n\n assertThat(responseEntity, hasStatusCode(equalTo(500)));\n }",
"class_method_signature": "RestErrorHandlerTest.unmapp... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(RestErrorHandler.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(RestErrorHandler.class);",
"type": "Logger",
"var_name": "log"
},
{
"... | {
"body": "public ResponseEntity<?> mapToResponseEntity(Exception exception) {\n HttpHeaders headers = new HttpHeaders();\n headers.setContentType(MediaType.APPLICATION_JSON);\n return mapToResponseEntity(exception, headers);\n }",
"class_method_signature": "RestErrorHandler.mapToResponseEnt... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
72436214_49 | {
"fields": [
{
"declarator": "underTest",
"modifier": "private",
"original_string": "private RequestPasswordResetService underTest;",
"type": "RequestPasswordResetService",
"var_name": "underTest"
},
{
"declarator": "userService",
"modifier": "private",
"or... | {
"body": "@Test\n public void returnsNotFoundErrorIfUserDoesNotExist() throws Exception {\n String username = \"idontexist@nothing.me\";\n given(userService.getByUsername(username)).willReturn(Try.failure(new NotFoundFailure(\"No user with name\")));\n PasswordResetRequest request = Immutable... | {
"fields": [
{
"declarator": "userService",
"modifier": "private final",
"original_string": "private final UserService userService;",
"type": "UserService",
"var_name": "userService"
},
{
"declarator": "passwordResetNotifier",
"modifier": "private final",
"... | {
"body": "@Transactional\n public Try<RequestPasswordResetResponse> requestPasswordReset(PasswordResetRequest request) {\n return userService\n .getByUsername(request.username())\n .flatMap(user -> {\n PasswordResetToken resetToken = passwordResetTokenGenera... | {
"created": null,
"fork": null,
"fork_count": 39,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72436214,
"size": 3406,
"stargazer_count": 83,
"stars": null,
"updates": null,
"url": "https://github.com/celestial-winter/vics"
} |
66343128_9 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void dependtest(){\n List<DependencyLink> list = storage.spanStore().getDependencies(1574947278711000L,360000L);\n for(DependencyLink span:list){\n System.out.println(span.parent);\n }\n }",
"class_method_signature": "ElasticsearchSpanStoreTest.dependtest()",
"constructor... | {
"fields": [
{
"declarator": "MAX_RAW_SPANS = 10000",
"modifier": "static final",
"original_string": "static final int MAX_RAW_SPANS = 10000;",
"type": "int",
"var_name": "MAX_RAW_SPANS"
},
{
"declarator": "ONE_DAY_IN_MILLIS = TimeUnit.DAYS.toMillis(1)",
"modifie... | {
"body": "@Override public ListenableFuture<List<DependencyLink>> getDependencies(long endMillis,\n @Nullable Long lookback) {\n long beginMillis = lookback != null ? endMillis - lookback : 0;\n // We just return all dependencies in the days that fall within endTs and lookback as\n // dependency links ... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_20 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "globalTimeo... | {
"body": "@Test\n public void skipsOnConsumerException() throws Exception {\n KafkaCollector.Builder builder = builder(\"consumer_exception\");\n\n AtomicInteger counter = new AtomicInteger();\n\n consumer = (spans, callback) -> {\n if (counter.getAndIncrement() == 1) {\n callback.onError(new R... | {
"fields": [
{
"declarator": "connector",
"modifier": "final",
"original_string": "final LazyCloseable<ZookeeperConsumerConnector> connector;",
"type": "LazyCloseable<ZookeeperConsumerConnector>",
"var_name": "connector"
},
{
"declarator": "streams",
"modifier": ... | {
"body": "public static Builder builder() {\n return new Builder();\n }",
"class_method_signature": "KafkaCollector.builder()",
"constructor": false,
"full_signature": "public static Builder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": "()",
... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_16 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "globalTimeo... | {
"body": "@Test\n public void messageWithSingleThriftSpan() throws Exception {\n KafkaCollector.Builder builder = builder(\"single_span\");\n\n byte[] bytes = Codec.JSON.writeSpan(TRACE.get(0));\n producer.send(new KeyedMessage<>(builder.topic, bytes));\n\n try (KafkaCollector collector = newKafkaTransp... | {
"fields": [
{
"declarator": "connector",
"modifier": "final",
"original_string": "final LazyCloseable<ZookeeperConsumerConnector> connector;",
"type": "LazyCloseable<ZookeeperConsumerConnector>",
"var_name": "connector"
},
{
"declarator": "streams",
"modifier": ... | {
"body": "public static Builder builder() {\n return new Builder();\n }",
"class_method_signature": "KafkaCollector.builder()",
"constructor": false,
"full_signature": "public static Builder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": "()",
... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_5 | {
"fields": [],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/elasticsearch/LazyClientTest.java",
"identifier": "LazyClientTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testToString() {\n LazyClient lazyClient = new LazyClient(new ElasticsearchStorage.Builder()\n .cluster(\"cluster\")\n .hosts(asList(\"host1\", \"host2\")));\n\n assertThat(lazyClient)\n .hasToString(\"{\\\"clusterName\\\": \\\"cluster\\\", \\\"hosts\\\": [\\... | {
"fields": [
{
"declarator": "clusterName",
"modifier": "private final",
"original_string": "private final String clusterName;",
"type": "String",
"var_name": "clusterName"
},
{
"declarator": "hosts",
"modifier": "private final",
"original_string": "private... | {
"body": "@Override public String toString() {\n StringBuilder json = new StringBuilder(\"{\\\"clusterName\\\": \\\"\").append(clusterName).append(\"\\\"\");\n json.append(\", \\\"hosts\\\": [\\\"\").append(Joiner.on(\"\\\", \\\"\").join(hosts)).append(\"\\\"]\");\n return json.append(\"}\").toString();\n ... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_17 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "globalTimeo... | {
"body": "@Test\n public void messageWithMultipleSpans_thrift() throws Exception {\n KafkaCollector.Builder builder = builder(\"multiple_spans_thrift\");\n\n byte[] bytes = Codec.JSON.writeSpans(TRACE);\n producer.send(new KeyedMessage<>(builder.topic, bytes));\n\n try (KafkaCollector collector = newKaf... | {
"fields": [
{
"declarator": "connector",
"modifier": "final",
"original_string": "final LazyCloseable<ZookeeperConsumerConnector> connector;",
"type": "LazyCloseable<ZookeeperConsumerConnector>",
"var_name": "connector"
},
{
"declarator": "streams",
"modifier": ... | {
"body": "public static Builder builder() {\n return new Builder();\n }",
"class_method_signature": "KafkaCollector.builder()",
"constructor": false,
"full_signature": "public static Builder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": "()",
... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_4 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void prefixWithTimestampMillis() {\n Span span = Span.builder().traceId(20L).id(20L).name(\"get\")\n .timestamp(TODAY * 1000).build();\n\n byte[] result =\n ElasticsearchSpanConsumer.prefixWithTimestampMillis(Codec.JSON.writeSpan(span), TODAY);\n\n String json = new S... | {
"fields": [
{
"declarator": "TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes()",
"modifier": "private static final",
"original_string": "private static final byte[] TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes();",
"type": "byte[]",
"var_name"... | {
"body": "@VisibleForTesting\n static byte[] prefixWithTimestampMillis(byte[] input, long timestampMillis) {\n String dateAsString = Long.toString(timestampMillis);\n byte[] newSpanBytes =\n new byte[TIMESTAMP_MILLIS_PREFIX.length + dateAsString.length() + input.length];\n int pos = 0;\n System.a... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_8 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void traceIdtest(){\n List<Span> list = storage.spanStore().getTrace(Util.lowerHexToUnsignedLong(\"7f88ce35d4be0917\"));\n for(Span span:list){\n System.out.println(span.duration);\n }\n }",
"class_method_signature": "ElasticsearchSpanStoreTest.traceIdtest()",
"constructo... | {
"fields": [
{
"declarator": "MAX_RAW_SPANS = 10000",
"modifier": "static final",
"original_string": "static final int MAX_RAW_SPANS = 10000;",
"type": "int",
"var_name": "MAX_RAW_SPANS"
},
{
"declarator": "ONE_DAY_IN_MILLIS = TimeUnit.DAYS.toMillis(1)",
"modifie... | {
"body": "@Override public ListenableFuture<List<Span>> getTrace(long traceId) {\n return transform(getRawTrace(traceId), new Function<List<Span>, List<Span>>() {\n @Override public List<Span> apply(List<Span> input) {\n return input == null ? null : CorrectForClockSkew.apply(MergeById.apply(input));\... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_10 | {
"fields": [
{
"declarator": "clientTracer = mock(ClientTracer.class)",
"modifier": "private final",
"original_string": "private final ClientTracer clientTracer = mock(ClientTracer.class);",
"type": "ClientTracer",
"var_name": "clientTracer"
},
{
"declarator": "subject... | {
"body": "@Test\n public void postProcessShouldFinishTracingFailedSQLCall() throws Exception {\n\n final int warningCount = 1;\n final int errorCode = 2;\n\n assertNull(subject.postProcess(\"sql\", mock(Statement.class), mock(ResultSetInternalMethods.class), mock(Connection.class), warningCou... | {
"fields": [
{
"declarator": "SERVICE_NAME_KEY = \"zipkinServiceName\"",
"modifier": "private final static",
"original_string": "private final static String SERVICE_NAME_KEY = \"zipkinServiceName\";",
"type": "String",
"var_name": "SERVICE_NAME_KEY"
},
{
"declarator": ... | {
"body": "@Override\n public ResultSetInternalMethods postProcess(final String sql, final Statement interceptedStatement, final ResultSetInternalMethods originalResultSet,\n final Connection connection, final int warningCount, final boolean noIndexUsed, final boolean... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_3 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void searchByTimestampMillis() {\n Span span = Span.builder().timestamp(TODAY * 1000).traceId(20L).id(20L).name(\"get\").build();\n\n accept(span);\n\n SearchResponse indexFromToday = storage.client()\n .prepareSearch(storage.indexNameFormatter.indexNameForTimestamp(TODAY))\... | {
"fields": [
{
"declarator": "TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes()",
"modifier": "private static final",
"original_string": "private static final byte[] TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes();",
"type": "byte[]",
"var_name"... | {
"body": "@Override\n public ListenableFuture<Void> accept(List<Span> spans) {\n if (spans.isEmpty()) return Futures.immediateFuture(null);\n\n // Create a bulk request when there is more than one span to store\n ListenableFuture<?> future;\n if (spans.size() == 1) {\n future = toGuava(createSpanIn... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_11 | {
"fields": [
{
"declarator": "clientTracer = mock(ClientTracer.class)",
"modifier": "private final",
"original_string": "private final ClientTracer clientTracer = mock(ClientTracer.class);",
"type": "ClientTracer",
"var_name": "clientTracer"
},
{
"declarator": "subject... | {
"body": "@Test\n public void postProcessShouldFinishTracingSuccessfulSQLCall() throws Exception {\n\n assertNull(subject.postProcess(\"sql\", mock(Statement.class), mock(ResultSetInternalMethods.class), mock(Connection.class), 0, true, true, null));\n\n final InOrder order = inOrder(clientTracer);\... | {
"fields": [
{
"declarator": "SERVICE_NAME_KEY = \"zipkinServiceName\"",
"modifier": "private final static",
"original_string": "private final static String SERVICE_NAME_KEY = \"zipkinServiceName\";",
"type": "String",
"var_name": "SERVICE_NAME_KEY"
},
{
"declarator": ... | {
"body": "@Override\n public ResultSetInternalMethods postProcess(final String sql, final Statement interceptedStatement, final ResultSetInternalMethods originalResultSet,\n final Connection connection, final int warningCount, final boolean noIndexUsed, final boolean... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_2 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void spanGoesIntoADailyIndex_fallsBackToTodayWhenNoTimestamps() {\n Span span = Span.builder().traceId(20L).id(20L).name(\"get\").build();\n\n accept(span);\n\n SearchResponse indexFromToday = storage.client()\n .prepareSearch(storage.indexNameFormatter.indexNameForTimestamp... | {
"fields": [
{
"declarator": "TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes()",
"modifier": "private static final",
"original_string": "private static final byte[] TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes();",
"type": "byte[]",
"var_name"... | {
"body": "@Override\n public ListenableFuture<Void> accept(List<Span> spans) {\n if (spans.isEmpty()) return Futures.immediateFuture(null);\n\n // Create a bulk request when there is more than one span to store\n ListenableFuture<?> future;\n if (spans.size() == 1) {\n future = toGuava(createSpanIn... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_12 | {
"fields": [
{
"declarator": "clientTracer = mock(ClientTracer.class)",
"modifier": "private final",
"original_string": "private final ClientTracer clientTracer = mock(ClientTracer.class);",
"type": "ClientTracer",
"var_name": "clientTracer"
},
{
"declarator": "subject... | {
"body": "@Test\n public void executeTopLevelOnlyShouldOnlyExecuteTopLevelQueries() throws Exception {\n assertTrue(subject.executeTopLevelOnly());\n verifyZeroInteractions(clientTracer);\n }",
"class_method_signature": "MySQLStatementInterceptorTest.executeTopLevelOnlyShouldOnlyExecuteTopLevel... | {
"fields": [
{
"declarator": "SERVICE_NAME_KEY = \"zipkinServiceName\"",
"modifier": "private final static",
"original_string": "private final static String SERVICE_NAME_KEY = \"zipkinServiceName\";",
"type": "String",
"var_name": "SERVICE_NAME_KEY"
},
{
"declarator": ... | {
"body": "@Override\n public boolean executeTopLevelOnly() {\n // True means that we don't get notified about queries that other interceptors issue\n return true;\n }",
"class_method_signature": "MySQLStatementInterceptor.executeTopLevelOnly()",
"constructor": false,
"full_signature": "@Ove... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_1 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void spanGoesIntoADailyIndex_whenTimestampIsExplicit() {\n long twoDaysAgo = (TODAY - 2 * DAY);\n\n Span span = Span.builder().traceId(20L).id(20L).name(\"get\")\n .timestamp(twoDaysAgo * 1000).build();\n\n accept(span);\n\n SearchResponse indexFromTwoDaysAgo = storage.cl... | {
"fields": [
{
"declarator": "TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes()",
"modifier": "private static final",
"original_string": "private static final byte[] TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes();",
"type": "byte[]",
"var_name"... | {
"body": "@Override\n public ListenableFuture<Void> accept(List<Span> spans) {\n if (spans.isEmpty()) return Futures.immediateFuture(null);\n\n // Create a bulk request when there is more than one span to store\n ListenableFuture<?> future;\n if (spans.size() == 1) {\n future = toGuava(createSpanIn... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_13 | {
"fields": [
{
"declarator": "clientTracer = mock(ClientTracer.class)",
"modifier": "private final",
"original_string": "private final ClientTracer clientTracer = mock(ClientTracer.class);",
"type": "ClientTracer",
"var_name": "clientTracer"
}
],
"file": "j360-trace-mysql/sr... | {
"body": "@Test\n public void closeShouldCleanUpStatementInterceptor() throws IOException {\n final MySQLStatementInterceptorManagementBean subject = new MySQLStatementInterceptorManagementBean(clientTracer);\n MySQLStatementInterceptor.setClientTracer(clientTracer);\n subject.close();\n ... | {
"fields": [],
"file": "j360-trace-mysql/src/main/java/me/j360/trace/mysql/MySQLStatementInterceptorManagementBean.java",
"identifier": "MySQLStatementInterceptorManagementBean",
"interfaces": "implements Closeable",
"methods": [
{
"class_method_signature": "MySQLStatementInterceptorManagementBean.... | {
"body": "@Override\n public void close() throws IOException {\n MySQLStatementInterceptor.setClientTracer(null);\n }",
"class_method_signature": "MySQLStatementInterceptorManagementBean.close()",
"constructor": false,
"full_signature": "@Override public void close()",
"identifier": "close",
"... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_0 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void spanGoesIntoADailyIndex_whenTimestampIsDerived() {\n long twoDaysAgo = (TODAY - 2 * DAY);\n\n Span span = Span.builder().traceId(20L).id(20L).name(\"get\")\n .addAnnotation(Annotation.create(twoDaysAgo * 1000, SERVER_RECV, WEB_ENDPOINT))\n .addAnnotation(Annotation.... | {
"fields": [
{
"declarator": "TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes()",
"modifier": "private static final",
"original_string": "private static final byte[] TIMESTAMP_MILLIS_PREFIX = \"{\\\"timestamp_millis\\\":\".getBytes();",
"type": "byte[]",
"var_name"... | {
"body": "@Override\n public ListenableFuture<Void> accept(List<Span> spans) {\n if (spans.isEmpty()) return Futures.immediateFuture(null);\n\n // Create a bulk request when there is more than one span to store\n ListenableFuture<?> future;\n if (spans.size() == 1) {\n future = toGuava(createSpanIn... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_18 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "globalTimeo... | {
"body": "@Test\n public void messageWithMultipleSpans_json() throws Exception {\n KafkaCollector.Builder builder = builder(\"multiple_spans_json\");\n\n byte[] bytes = Codec.JSON.writeSpans(TRACE);\n producer.send(new KeyedMessage<>(builder.topic, bytes));\n\n try (KafkaCollector collector = newKafkaTr... | {
"fields": [
{
"declarator": "connector",
"modifier": "final",
"original_string": "final LazyCloseable<ZookeeperConsumerConnector> connector;",
"type": "LazyCloseable<ZookeeperConsumerConnector>",
"var_name": "connector"
},
{
"declarator": "streams",
"modifier": ... | {
"body": "public static Builder builder() {\n return new Builder();\n }",
"class_method_signature": "KafkaCollector.builder()",
"constructor": false,
"full_signature": "public static Builder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": "()",
... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_14 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "globalTimeo... | {
"body": "@Test\n public void start_failsOnInvalidZooKeeper() throws Exception {\n thrown.expect(ZkTimeoutException.class);\n thrown.expectMessage(\"Unable to connect to zookeeper server within timeout: 6000\");\n\n KafkaCollector.Builder builder = builder(\"fail_invalid_zk\").zookeeper(\"1.1.1.1\");\n\n ... | {
"fields": [
{
"declarator": "connector",
"modifier": "final",
"original_string": "final LazyCloseable<ZookeeperConsumerConnector> connector;",
"type": "LazyCloseable<ZookeeperConsumerConnector>",
"var_name": "connector"
},
{
"declarator": "streams",
"modifier": ... | {
"body": "public static Builder builder() {\n return new Builder();\n }",
"class_method_signature": "KafkaCollector.builder()",
"constructor": false,
"full_signature": "public static Builder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": "()",
... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_7 | {
"fields": [
{
"declarator": "storage",
"modifier": "private final",
"original_string": "private final ElasticsearchStorage storage;",
"type": "ElasticsearchStorage",
"var_name": "storage"
}
],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/ela... | {
"body": "@Test\n public void spanStore(){\n /*List<String> names = storage.spanStore().getServiceNames();\n for(String name:names){\n System.out.println(name);\n }\n\n List<String> spanNames = storage.spanStore().getSpanNames(\"j360servletinterceptorintegration\");\n for(String name:spanNames){... | {
"fields": [
{
"declarator": "MAX_RAW_SPANS = 10000",
"modifier": "static final",
"original_string": "static final int MAX_RAW_SPANS = 10000;",
"type": "int",
"var_name": "MAX_RAW_SPANS"
},
{
"declarator": "ONE_DAY_IN_MILLIS = TimeUnit.DAYS.toMillis(1)",
"modifie... | {
"body": "@Override public ListenableFuture<List<List<Span>>> getTraces(QueryRequest request) {\n long endMillis = request.endTs;\n long beginMillis = endMillis - request.lookback;\n\n // TODO: once timestamp_millis is sufficiently deployed, switch this logic to use it\n BoolQueryBuilder filter = boolQue... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_15 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "globalTimeo... | {
"body": "@Test\n public void canSetMaxMessageSize() throws Exception {\n KafkaCollector.Builder builder = builder(\"max_message\").maxMessageSize(1);\n\n try (KafkaCollector collector = newKafkaTransport(builder, consumer)) {\n assertThat(collector.connector.get().config().fetchMessageMaxBytes())\n ... | {
"fields": [
{
"declarator": "connector",
"modifier": "final",
"original_string": "final LazyCloseable<ZookeeperConsumerConnector> connector;",
"type": "LazyCloseable<ZookeeperConsumerConnector>",
"var_name": "connector"
},
{
"declarator": "streams",
"modifier": ... | {
"body": "public static Builder builder() {\n return new Builder();\n }",
"class_method_signature": "KafkaCollector.builder()",
"constructor": false,
"full_signature": "public static Builder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": "()",
... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_6 | {
"fields": [],
"file": "j360-trace-storage/elasticsearch/src/test/java/me/j360/trace/storage/elasticsearch/LazyClientTest.java",
"identifier": "LazyClientTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void laayCientCompute(){\n LazyClient lazyClient = new LazyClient(new ElasticsearchStorage.Builder());\n lazyClient.compute();\n }",
"class_method_signature": "LazyClientTest.laayCientCompute()",
"constructor": false,
"full_signature": "@Test public void laayCientCompute()",
... | {
"fields": [
{
"declarator": "clusterName",
"modifier": "private final",
"original_string": "private final String clusterName;",
"type": "String",
"var_name": "clusterName"
},
{
"declarator": "hosts",
"modifier": "private final",
"original_string": "private... | {
"body": "@Override protected Client compute() {\n Settings settings = Settings.builder()\n .put(\"cluster.name\", clusterName)\n .put(\"lazyClient.transport.sniff\", true)\n .build();\n\n TransportClient client = TransportClient.builder()\n .settings(settings)\n .build();\n ... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
66343128_19 | {
"fields": [
{
"declarator": "thrown = ExpectedException.none()",
"modifier": "@Rule\n public",
"original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();",
"type": "ExpectedException",
"var_name": "thrown"
},
{
"declarator": "globalTimeo... | {
"body": "@Test\n public void skipsMalformedData() throws Exception {\n KafkaCollector.Builder builder = builder(\"decoder_exception\");\n\n producer.send(new KeyedMessage<>(builder.topic, Codec.JSON.writeSpans(TRACE)));\n producer.send(new KeyedMessage<>(builder.topic, new byte[0]));\n producer.send(ne... | {
"fields": [
{
"declarator": "connector",
"modifier": "final",
"original_string": "final LazyCloseable<ZookeeperConsumerConnector> connector;",
"type": "LazyCloseable<ZookeeperConsumerConnector>",
"var_name": "connector"
},
{
"declarator": "streams",
"modifier": ... | {
"body": "public static Builder builder() {\n return new Builder();\n }",
"class_method_signature": "KafkaCollector.builder()",
"constructor": false,
"full_signature": "public static Builder builder()",
"identifier": "builder",
"invocations": [],
"modifiers": "public static",
"parameters": "()",
... | {
"created": null,
"fork": null,
"fork_count": 37,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 66343128,
"size": 540,
"stargazer_count": 57,
"stars": null,
"updates": null,
"url": "https://github.com/xuminwlt/j360-trace"
} |
72847871_12 | {
"fields": [],
"file": "srcdeps-maven-enforcer/src/test/java/org/srcdeps/mvn/enforcer/SrcdepsEnforcerTest.java",
"identifier": "SrcdepsEnforcerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void assertFailWith() {\n Assert.assertArrayEquals( //\n new String[] { \"goal\", \"g1\" }, //\n SrcdepsEnforcer.assertFailWith( //\n MavenAssertions.failWithBuilder() //\n .addDefaults(false) //\n ... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(SrcdepsEnforcer.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(SrcdepsEnforcer.class);",
"type": "Logger",
"var_name": "log"
},
{
"de... | {
"body": "static String[] assertFailWith(MavenAssertions failWith, List<String> goals, List<String> profiles,\n Properties properties) {\n\n log.debug(\"srcdeps: The enforcer is using failWith [{}]\", failWith);\n final Set<String> failWithGoals = failWith.getGoals();\n for (String go... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_7 | {
"fields": [],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-include-required-quickstart/jar/src/test/java/org/srcdeps/quickstarts/mvn/git/interdep/InterdepTest.java",
"identifier": "InterdepTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testInterdep() {\n Assert.assertEquals(\"Hello World!\", new Interdep().getMessage());\n }",
"class_method_signature": "InterdepTest.testInterdep()",
"constructor": false,
"full_signature": "@Test public void testInterdep()",
"identifier": "testInterdep",
"invocat... | {
"fields": [
{
"declarator": "app = new App()",
"modifier": "final",
"original_string": "final App app = new App();",
"type": "App",
"var_name": "app"
}
],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-include-required-quickstart/jar/src/main/java/org/srcdeps/quickstart... | {
"body": "public String getMessage() {\n return app.getMessage();\n }",
"class_method_signature": "Interdep.getMessage()",
"constructor": false,
"full_signature": "public String getMessage()",
"identifier": "getMessage",
"invocations": [
"getMessage"
],
"modifiers": "public",
"parameter... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_13 | {
"fields": [],
"file": "srcdeps-maven-enforcer/src/test/java/org/srcdeps/mvn/enforcer/SrcdepsEnforcerTest.java",
"identifier": "SrcdepsEnforcerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void assertFailWithout() {\n Assert.assertArrayEquals( //\n new String[] { \"goals missing\", \"[g2]\" }, //\n SrcdepsEnforcer.assertFailWithout( //\n MavenAssertions.failWithoutBuilder() //\n .goal... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(SrcdepsEnforcer.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(SrcdepsEnforcer.class);",
"type": "Logger",
"var_name": "log"
},
{
"de... | {
"body": "static String[] assertFailWithout(MavenAssertions failWithout, List<String> goals, List<String> profiles,\n Properties properties) {\n\n log.debug(\"srcdeps: The enforcer is using failWithout [{}]\", failWithout);\n final Set<String> failWithoutGoals = new LinkedHashSet<>(failWitho... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_1 | {
"fields": [],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-snapshot-quickstart/jar/src/test/java/org/srcdeps/quickstarts/mvn/git/revision/AppClientTest.java",
"identifier": "AppClientTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test() {\n Assert.assertEquals(\"Hello World!\", new AppClient().getApp().getMessage());\n }",
"class_method_signature": "AppClientTest.test()",
"constructor": false,
"full_signature": "@Test public void test()",
"identifier": "test",
"invocations": [
"assertE... | {
"fields": [
{
"declarator": "app = new AppService().getApp()",
"modifier": "private final",
"original_string": "private final App app = new AppService().getApp();",
"type": "App",
"var_name": "app"
}
],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-snapshot-quickstart/... | {
"body": "public App getApp() {\n return app;\n }",
"class_method_signature": "AppClient.getApp()",
"constructor": false,
"full_signature": "public App getApp()",
"identifier": "getApp",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "App",
"signature": "App getAp... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_2 | {
"fields": [],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-gradle-source-dependency-quickstart/jar/src/test/java/org/srcdeps/quickstarts/mvn/git/revision/gradle/GreetingAppTest.java",
"identifier": "GreetingAppTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void test() {\n Assert.assertEquals(\"Hello World!\", new GreetingApp().getGreeter().greet(\"World\"));\n }",
"class_method_signature": "GreetingAppTest.test()",
"constructor": false,
"full_signature": "@Test public void test()",
"identifier": "test",
"invocations": [
... | {
"fields": [
{
"declarator": "greeter = new org.srcdeps.test.gradle.impl.HelloGreeter()",
"modifier": "private final",
"original_string": "private final org.srcdeps.test.gradle.api.Greeter greeter = new org.srcdeps.test.gradle.impl.HelloGreeter();",
"type": "org.srcdeps.test.gradle.api.Gr... | {
"body": "public org.srcdeps.test.gradle.api.Greeter getGreeter() {\n return greeter;\n }",
"class_method_signature": "GreetingApp.getGreeter()",
"constructor": false,
"full_signature": "public org.srcdeps.test.gradle.api.Greeter getGreeter()",
"identifier": "getGreeter",
"invocations": [],
"mo... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_3 | {
"fields": [],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-profile-and-properties-quickstart/jar/src/test/java/org/srcdeps/quickstarts/mvn/git/prop/profile/GreetingConsumerTest.java",
"identifier": "GreetingConsumerTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGreeting() {\n Assert.assertEquals(\"random name KMYTJDb9\", new GreetingConsumer().retrieveGreeting());\n }",
"class_method_signature": "GreetingConsumerTest.testGreeting()",
"constructor": false,
"full_signature": "@Test public void testGreeting()",
"identifie... | {
"fields": [],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-profile-and-properties-quickstart/jar/src/main/java/org/srcdeps/quickstarts/mvn/git/prop/profile/GreetingConsumer.java",
"identifier": "GreetingConsumer",
"interfaces": "",
"methods": [
{
"class_method_signature": "GreetingConsumer.r... | {
"body": "public String retrieveGreeting() {\n return new org.l2x6.maven.srcdeps.itest.api.generated.GeneratedGreeter().getGreeting();\n }",
"class_method_signature": "GreetingConsumer.retrieveGreeting()",
"constructor": false,
"full_signature": "public String retrieveGreeting()",
"identifier": "re... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_8 | {
"fields": [],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-interdep-modules-quickstart/jar/src/test/java/org/srcdeps/quickstarts/mvn/git/interdep/InterdepTest.java",
"identifier": "InterdepTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testInterdep() {\n Assert.assertEquals(\"Hello World!\", new Interdep().getService().getApp().getMessage());\n }",
"class_method_signature": "InterdepTest.testInterdep()",
"constructor": false,
"full_signature": "@Test public void testInterdep()",
"identifier": "tes... | {
"fields": [
{
"declarator": "service = new AppService()",
"modifier": "private final",
"original_string": "private final AppService service = new AppService();",
"type": "AppService",
"var_name": "service"
}
],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-interdep-mod... | {
"body": "public AppService getService() {\n return service;\n }",
"class_method_signature": "Interdep.getService()",
"constructor": false,
"full_signature": "public AppService getService()",
"identifier": "getService",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return":... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_5 | {
"fields": [],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-parent-quickstart/src/test/java/org/srcdeps/mvn/quickstarts/git/parent/AppClientTest.java",
"identifier": "AppClientTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void appMessage() {\n Assert.assertEquals(\"Hello World!\", new AppClient().getApp().getMessage());\n }",
"class_method_signature": "AppClientTest.appMessage()",
"constructor": false,
"full_signature": "@Test public void appMessage()",
"identifier": "appMessage",
"invo... | {
"fields": [
{
"declarator": "app = new App()",
"modifier": "private final",
"original_string": "private final App app = new App();",
"type": "App",
"var_name": "app"
}
],
"file": "srcdeps-maven-quickstarts/srcdeps-mvn-git-parent-quickstart/src/main/java/org/srcdeps/mvn/quic... | {
"body": "public App getApp() {\n return app;\n }",
"class_method_signature": "AppClient.getApp()",
"constructor": false,
"full_signature": "public App getApp()",
"identifier": "getApp",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "App",
"signature": "App getAp... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
72847871_11 | {
"fields": [
{
"declarator": "basedir = Paths.get(System.getProperty(\"basedir\", new File(\"\").getAbsolutePath()))",
"modifier": "private static final",
"original_string": "private static final Path basedir = Paths.get(System.getProperty(\"basedir\", new File(\"\").getAbsolutePath()));",
... | {
"body": "@Test\n public void initNoArgs() throws Exception {\n\n File projDir = resources.getBasedir(\"parent-with-jar\");\n\n MavenExecution mavenExec = verifier.forProject(projDir) //\n .withCliOption(\"-e\");\n\n final String srcdepsVersion = Constants.SRCDEPS_MAVEN_VERSION... | {
"fields": [
{
"declarator": "log = LoggerFactory.getLogger(SrcdepsInitMojo.class)",
"modifier": "private static final",
"original_string": "private static final Logger log = LoggerFactory.getLogger(SrcdepsInitMojo.class);",
"type": "Logger",
"var_name": "log"
},
{
"de... | {
"body": "@Override\n public void execute() throws MojoExecutionException, MojoFailureException {\n\n super.execute();\n\n org.srcdeps.core.GavSet.Builder gavSetBuilder = GavSet.builder() //\n .includes(includes) //\n .excludes(excludes);\n if (excludeSnapshots) ... | {
"created": null,
"fork": null,
"fork_count": 4,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 72847871,
"size": 727,
"stargazer_count": 7,
"stars": null,
"updates": null,
"url": "https://github.com/srcdeps/srcdeps-maven"
} |
10856630_10 | {
"fields": [
{
"declarator": "context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t}",
"modifier": "private",
"original_string": "private Mockery context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t... | {
"body": "@Test\n\tpublic void test_setTemplateRootDir() throws Throwable {\n\n\t\tFile templateRootDir = null;\n\n\t\tgenerator.setTemplateRootDir(templateRootDir);\n\n\t}",
"class_method_signature": "GeneratorTest.test_setTemplateRootDir()",
"constructor": false,
"full_signature": "@Test public void test_set... | {
"fields": [
{
"declarator": "GENERATOR_INSERT_LOCATION = \"generator-insert-location\"",
"modifier": "private static final",
"original_string": "private static final String GENERATOR_INSERT_LOCATION = \"generator-insert-location\";",
"type": "String",
"var_name": "GENERATOR_INSERT_... | {
"body": "public void setTemplateRootDir(File templateRootDir) {\n\t\tsetTemplateRootDirs(new File[] { templateRootDir });\n\t}",
"class_method_signature": "Generator.setTemplateRootDir(File templateRootDir)",
"constructor": false,
"full_signature": "public void setTemplateRootDir(File templateRootDir)",
"id... | {
"created": null,
"fork": null,
"fork_count": 12,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 10856630,
"size": 2664,
"stargazer_count": 9,
"stars": null,
"updates": null,
"url": "https://github.com/jacarrichan/rapid-framework"
} |
10856630_11 | {
"fields": [
{
"declarator": "context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t}",
"modifier": "private",
"original_string": "private Mockery context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t... | {
"body": "@Test\n\tpublic void test_addTemplateRootDir() throws Throwable {\n\n\t\tFile f = new File(\".\");\n\n\t\tgenerator.addTemplateRootDir(f);\n\n\t}",
"class_method_signature": "GeneratorTest.test_addTemplateRootDir()",
"constructor": false,
"full_signature": "@Test public void test_addTemplateRootDir()... | {
"fields": [
{
"declarator": "GENERATOR_INSERT_LOCATION = \"generator-insert-location\"",
"modifier": "private static final",
"original_string": "private static final String GENERATOR_INSERT_LOCATION = \"generator-insert-location\";",
"type": "String",
"var_name": "GENERATOR_INSERT_... | {
"body": "public void addTemplateRootDir(File file) {\n\t\ttemplateRootDirs.add(file);\n\t}",
"class_method_signature": "Generator.addTemplateRootDir(File file)",
"constructor": false,
"full_signature": "public void addTemplateRootDir(File file)",
"identifier": "addTemplateRootDir",
"invocations": [
"a... | {
"created": null,
"fork": null,
"fork_count": 12,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 10856630,
"size": 2664,
"stargazer_count": 9,
"stars": null,
"updates": null,
"url": "https://github.com/jacarrichan/rapid-framework"
} |
10856630_70 | {
"fields": [
{
"declarator": "context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t}",
"modifier": "private",
"original_string": "private Mockery context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t... | {
"body": "@Test\n\tpublic void test_setCopyBinaryFile() throws Throwable {\n\n\t\tboolean isCopyBinaryFile = true;\n\n\t\tgenerator.setCopyBinaryFile(isCopyBinaryFile);\n\n\t}",
"class_method_signature": "GeneratorTest.test_setCopyBinaryFile()",
"constructor": false,
"full_signature": "@Test public void test_s... | {
"fields": [
{
"declarator": "GENERATOR_INSERT_LOCATION = \"generator-insert-location\"",
"modifier": "private static final",
"original_string": "private static final String GENERATOR_INSERT_LOCATION = \"generator-insert-location\";",
"type": "String",
"var_name": "GENERATOR_INSERT_... | {
"body": "public void setCopyBinaryFile(boolean isCopyBinaryFile) {\n\t\tthis.isCopyBinaryFile = isCopyBinaryFile;\n\t}",
"class_method_signature": "Generator.setCopyBinaryFile(boolean isCopyBinaryFile)",
"constructor": false,
"full_signature": "public void setCopyBinaryFile(boolean isCopyBinaryFile)",
"iden... | {
"created": null,
"fork": null,
"fork_count": 12,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 10856630,
"size": 2664,
"stargazer_count": 9,
"stars": null,
"updates": null,
"url": "https://github.com/jacarrichan/rapid-framework"
} |
10856630_69 | {
"fields": [
{
"declarator": "context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t}",
"modifier": "private",
"original_string": "private Mockery context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t... | {
"body": "@Test\n\tpublic void test_addTemplateRootDir() throws Throwable {\n\n\t\tFile f = new File(\".\");\n\n\t\tgenerator.addTemplateRootDir(f);\n\n\t}",
"class_method_signature": "GeneratorTest.test_addTemplateRootDir()",
"constructor": false,
"full_signature": "@Test public void test_addTemplateRootDir()... | {
"fields": [
{
"declarator": "GENERATOR_INSERT_LOCATION = \"generator-insert-location\"",
"modifier": "private static final",
"original_string": "private static final String GENERATOR_INSERT_LOCATION = \"generator-insert-location\";",
"type": "String",
"var_name": "GENERATOR_INSERT_... | {
"body": "public void addTemplateRootDir(File file) {\n\t\ttemplateRootDirs.add(file);\n\t}",
"class_method_signature": "Generator.addTemplateRootDir(File file)",
"constructor": false,
"full_signature": "public void addTemplateRootDir(File file)",
"identifier": "addTemplateRootDir",
"invocations": [
"a... | {
"created": null,
"fork": null,
"fork_count": 12,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 10856630,
"size": 2664,
"stargazer_count": 9,
"stars": null,
"updates": null,
"url": "https://github.com/jacarrichan/rapid-framework"
} |
10856630_12 | {
"fields": [
{
"declarator": "context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t}",
"modifier": "private",
"original_string": "private Mockery context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t... | {
"body": "@Test\n\tpublic void test_setCopyBinaryFile() throws Throwable {\n\n\t\tboolean isCopyBinaryFile = true;\n\n\t\tgenerator.setCopyBinaryFile(isCopyBinaryFile);\n\n\t}",
"class_method_signature": "GeneratorTest.test_setCopyBinaryFile()",
"constructor": false,
"full_signature": "@Test public void test_s... | {
"fields": [
{
"declarator": "GENERATOR_INSERT_LOCATION = \"generator-insert-location\"",
"modifier": "private static final",
"original_string": "private static final String GENERATOR_INSERT_LOCATION = \"generator-insert-location\";",
"type": "String",
"var_name": "GENERATOR_INSERT_... | {
"body": "public void setCopyBinaryFile(boolean isCopyBinaryFile) {\n\t\tthis.isCopyBinaryFile = isCopyBinaryFile;\n\t}",
"class_method_signature": "Generator.setCopyBinaryFile(boolean isCopyBinaryFile)",
"constructor": false,
"full_signature": "public void setCopyBinaryFile(boolean isCopyBinaryFile)",
"iden... | {
"created": null,
"fork": null,
"fork_count": 12,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 10856630,
"size": 2664,
"stargazer_count": 9,
"stars": null,
"updates": null,
"url": "https://github.com/jacarrichan/rapid-framework"
} |
10856630_68 | {
"fields": [
{
"declarator": "context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t}",
"modifier": "private",
"original_string": "private Mockery context = new JUnit4Mockery() {\n\t\t{\n\t\t\tsetImposteriser(ClassImposteriser.INSTANCE);\n\t\t}\n\t... | {
"body": "@Test\n\tpublic void test_setTemplateRootDir() throws Throwable {\n\n\t\tFile templateRootDir = null;\n\n\t\tgenerator.setTemplateRootDir(templateRootDir);\n\n\t}",
"class_method_signature": "GeneratorTest.test_setTemplateRootDir()",
"constructor": false,
"full_signature": "@Test public void test_set... | {
"fields": [
{
"declarator": "GENERATOR_INSERT_LOCATION = \"generator-insert-location\"",
"modifier": "private static final",
"original_string": "private static final String GENERATOR_INSERT_LOCATION = \"generator-insert-location\";",
"type": "String",
"var_name": "GENERATOR_INSERT_... | {
"body": "public void setTemplateRootDir(File templateRootDir) {\n\t\tsetTemplateRootDirs(new File[]{templateRootDir});\n\t}",
"class_method_signature": "Generator.setTemplateRootDir(File templateRootDir)",
"constructor": false,
"full_signature": "public void setTemplateRootDir(File templateRootDir)",
"ident... | {
"created": null,
"fork": null,
"fork_count": 12,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 10856630,
"size": 2664,
"stargazer_count": 9,
"stars": null,
"updates": null,
"url": "https://github.com/jacarrichan/rapid-framework"
} |
158136158_0 | {
"fields": [
{
"declarator": "sut",
"modifier": "private static",
"original_string": "private static ProfileSubject sut;",
"type": "ProfileSubject",
"var_name": "sut"
},
{
"declarator": "observers",
"modifier": "private static",
"original_string": "private ... | {
"body": "@Test\n\tvoid testAddObserver() {\n\t\tProfileObserver mockObserver = Mockito.mock(ProfileObserver.class);\n\t\tsut.addObserver(mockObserver);\n\t}",
"class_method_signature": "ProfileSubjectTest.testAddObserver()",
"constructor": false,
"full_signature": "@Test void testAddObserver()",
"identifier... | {
"fields": [
{
"declarator": "observers",
"modifier": "private",
"original_string": "private Array<ProfileObserver> observers;",
"type": "Array<ProfileObserver>",
"var_name": "observers"
}
],
"file": "core/src/main/java/com/mygdx/game/Profile/ProfileSubject.java",
"identif... | {
"body": "public void addObserver(ProfileObserver profileObserver){\n observers.add(profileObserver);\n }",
"class_method_signature": "ProfileSubject.addObserver(ProfileObserver profileObserver)",
"constructor": false,
"full_signature": "public void addObserver(ProfileObserver profileObserver)",
"i... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 158136158,
"size": 311096,
"stargazer_count": 22,
"stars": null,
"updates": null,
"url": "https://github.com/jeltedeproft/Norii"
} |
11309044_2 | {
"fields": [],
"file": "lintools-datatypes-fastutil/src/test/java/tl/lin/data/map/Int2IntOpenHashMapWritableTest.java",
"identifier": "Int2IntOpenHashMapWritableTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testLazyPlus() throws IOException {\n Int2IntOpenHashMapWritable m1 = new Int2IntOpenHashMapWritable();\n\n m1.put(1, 5);\n m1.put(2, 22);\n\n Int2IntOpenHashMapWritable m2 = new Int2IntOpenHashMapWritable();\n\n m2.put(1, 4);\n m2.put(3, 5);\n\n Int2IntOpenHashMap... | {
"fields": [
{
"declarator": "serialVersionUID = 1255879065743242L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 1255879065743242L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "LAZY_DECODE... | {
"body": "public void lazyplus(Int2IntOpenHashMapWritable m) {\n int[] k = m.getKeys();\n int[] v = m.getValues();\n\n for (int i = 0; i < k.length; i++) {\n if (this.containsKey(k[i])) {\n this.put(k[i], this.get(k[i]) + v[i]);\n } else {\n this.put(k[i], v[i]);\n }\n }\n }... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_124 | {
"fields": [],
"file": "lintools-datatypes/src/test/java/tl/lin/data/map/HMapKFTest.java",
"identifier": "HMapKFTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testDot() throws IOException {\n HMapKF<Text> m1 = new HMapKF<Text>();\n\n m1.put(new Text(\"hi\"), 2.3f);\n m1.put(new Text(\"there\"), 1.9f);\n m1.put(new Text(\"empty\"), 3.0f);\n\n HMapKF<Text> m2 = new HMapKF<Text>();\n\n m2.put(new Text(\"hi\"), 1.2f);\n m2.p... | {
"fields": [
{
"declarator": "DEFAULT_INITIAL_CAPACITY = 1024",
"modifier": "static final",
"original_string": "static final int DEFAULT_INITIAL_CAPACITY = 1024;",
"type": "int",
"var_name": "DEFAULT_INITIAL_CAPACITY"
},
{
"declarator": "MAXIMUM_CAPACITY = 1 << 30",
... | {
"body": "@Override\n public double dot(MapKF<K> m) {\n double s = 0.0f;\n\n for (MapKF.Entry<K> e : m.entrySet()) {\n K key = e.getKey();\n\n if (this.containsKey(key)) {\n s += this.get(key) * e.getValue();\n }\n }\n\n return s;\n }",
"class_method_signature": "HMapKF.dot(MapK... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_132 | {
"fields": [],
"file": "lintools-datatypes/src/test/java/tl/lin/data/map/HMapISTest.java",
"identifier": "HMapISTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testIncrement() {\n HMapIS m = new HMapIS();\n assertEquals(0, m.get(1));\n\n m.increment(1, (short) 1);\n assertEquals(1, m.get(1));\n\n m.increment(1);\n m.increment(2, (short) 0);\n m.increment(3, (short) -1);\n\n assertEquals(2, m.get(1));\n assertEquals(... | {
"fields": [
{
"declarator": "DEFAULT_INITIAL_CAPACITY = 1024",
"modifier": "static final",
"original_string": "static final int DEFAULT_INITIAL_CAPACITY = 1024;",
"type": "int",
"var_name": "DEFAULT_INITIAL_CAPACITY"
},
{
"declarator": "MAXIMUM_CAPACITY = 1 << 30",
... | {
"body": "@Override\n public void increment(int key) {\n if (this.containsKey(key)) {\n this.put(key, (short) (this.get(key) + 1));\n } else {\n this.put(key, (short) 1);\n }\n }",
"class_method_signature": "HMapIS.increment(int key)",
"constructor": false,
"full_signature": "@Override pub... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_61 | {
"fields": [
{
"declarator": "neg_one = -1",
"modifier": "",
"original_string": "int neg_one = -1, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, six = 6, seven = 7,\n nine = 9;",
"type": "int",
"var_name": "neg_one"
}
],
"file": "lintools-datatypes/src/test... | {
"body": "@Test\n public void testSetSize() {\n ArrayListOfInts list = new ArrayListOfInts();\n\n list.add(5);\n assertEquals(1, list.size);\n assertEquals(5, list.get(0));\n\n list.setSize(5);\n assertEquals(5, list.size);\n assertEquals(0, list.get(1));\n assertEquals(0, list.get(2));\n ... | {
"fields": [
{
"declarator": "array",
"modifier": "protected transient",
"original_string": "protected transient int[] array;",
"type": "int[]",
"var_name": "array"
},
{
"declarator": "size = 0",
"modifier": "protected",
"original_string": "protected int si... | {
"body": "public void setSize(int sz) {\n ensureCapacity(sz);\n size = sz;\n }",
"class_method_signature": "ArrayListOfInts.setSize(int sz)",
"constructor": false,
"full_signature": "public void setSize(int sz)",
"identifier": "setSize",
"invocations": [
"ensureCapacity"
],
"modifiers": "pub... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_36 | {
"fields": [],
"file": "lintools-datatypes/src/test/java/tl/lin/data/array/ArrayListWritableComparableTest.java",
"identifier": "ArrayListWritableComparableTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSorting3() {\n ArrayListWritableComparable<Text> list1 = new ArrayListWritableComparable<Text>();\n ArrayListWritableComparable<Text> list2 = new ArrayListWritableComparable<Text>();\n ArrayListWritableComparable<Text> list3 = new ArrayListWritableComparable<Text>();\n\n ... | {
"fields": [
{
"declarator": "serialVersionUID = 4911321393319821792L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 4911321393319821792L;",
"type": "long",
"var_name": "serialVersionUID"
}
],
"file": "lintools-datatype... | {
"body": "public int compareTo(ArrayListWritableComparable<E> obj) {\n ArrayListWritableComparable<E> that = (ArrayListWritableComparable<E>) obj;\n\n // iterate through the fields\n for (int i = 0; i < this.size(); i++) {\n // sort shorter list first\n if (i >= that.size())\n return 1;\n\n... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_20 | {
"fields": [],
"file": "lintools-datatypes-fastutil/src/test/java/tl/lin/data/map/Int2FloatOpenHashMapWritableTest.java",
"identifier": "Int2FloatOpenHashMapWritableTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testSortedEntries1() {\n Int2FloatOpenHashMapWritable m = new Int2FloatOpenHashMapWritable();\n\n m.put(1, 5.0f);\n m.put(2, 2.0f);\n m.put(3, 3.0f);\n m.put(4, 3.0f);\n m.put(5, 1.0f);\n\n Int2FloatMap.Entry[] e = m.getEntriesSortedByValue();\n assertEquals(5, ... | {
"fields": [
{
"declarator": "serialVersionUID = 674980125439241L",
"modifier": "private static final",
"original_string": "private static final long serialVersionUID = 674980125439241L;",
"type": "long",
"var_name": "serialVersionUID"
},
{
"declarator": "LAZY_DECODE =... | {
"body": "public Int2FloatMap.Entry[] getEntriesSortedByValue() {\n if (this.size() == 0)\n return null;\n\n Int2FloatMap.Entry[] entries = new Int2FloatMap.Entry[this.size()];\n entries = this.int2FloatEntrySet().toArray(entries);\n\n // Sort the entries.\n Arrays.sort(entries, new Comparator<In... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_98 | {
"fields": [
{
"declarator": "neg_one = -1",
"modifier": "",
"original_string": "short neg_one = -1, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, six = 6,\n seven = 7, nine = 9;",
"type": "short",
"var_name": "neg_one"
}
],
"file": "lintools-datatypes/src/... | {
"body": "@Test\n public void testCompare() {\n ArrayListOfShortsWritable a = new ArrayListOfShortsWritable();\n a.add(one).add(three).add(five);\n\n ArrayListOfShortsWritable b = new ArrayListOfShortsWritable();\n\n // [1,3,5] < [1,3,5,7]\n b.add(one).add(three).add(five).add(seven);\n assertTrue... | {
"fields": [],
"file": "lintools-datatypes/src/main/java/tl/lin/data/array/ArrayListOfShortsWritable.java",
"identifier": "ArrayListOfShortsWritable",
"interfaces": "implements\n WritableComparable<ArrayListOfShortsWritable>",
"methods": [
{
"class_method_signature": "ArrayListOfShortsWritable.A... | {
"body": "@Override\n public int compareTo(ArrayListOfShortsWritable obj) {\n ArrayListOfShortsWritable other = (ArrayListOfShortsWritable) obj;\n if (isEmpty()) {\n if (other.isEmpty()) {\n return 0;\n } else {\n return -1;\n }\n }\n\n for (int i = 0; i < size(); i++) {\n ... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_77 | {
"fields": [
{
"declarator": "neg_one = -1",
"modifier": "",
"original_string": "short neg_one = -1, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, six = 6,\n seven = 7, nine = 9;",
"type": "short",
"var_name": "neg_one"
}
],
"file": "lintools-datatypes/src/... | {
"body": "@Test\n public void testInitialSize() {\n ArrayListOfShorts a = new ArrayListOfShorts();\n assertEquals(0, a.size());\n }",
"class_method_signature": "ArrayListOfShortsTest.testInitialSize()",
"constructor": false,
"full_signature": "@Test public void testInitialSize()",
"identifier": "test... | {
"fields": [
{
"declarator": "array",
"modifier": "protected transient",
"original_string": "protected transient short[] array;",
"type": "short[]",
"var_name": "array"
},
{
"declarator": "size",
"modifier": "protected",
"original_string": "protected int si... | {
"body": "public int size() {\n return size;\n }",
"class_method_signature": "ArrayListOfShorts.size()",
"constructor": false,
"full_signature": "public int size()",
"identifier": "size",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "int",
"signature": "int size()",
... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_108 | {
"fields": [],
"file": "lintools-datatypes/src/test/java/tl/lin/data/map/HMapIFWTest.java",
"identifier": "HMapIFWTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testBasic() throws IOException {\n HMapIFW m = new HMapIFW();\n\n m.put(2, 5.0f);\n m.put(1, 22.0f);\n\n float value;\n\n assertEquals(m.size(), 2);\n\n value = m.get(2);\n assertTrue(value == 5.0f);\n\n value = m.remove(2);\n assertEquals(m.size(), 1);\n\n ... | {
"fields": [
{
"declarator": "LazyDecode = false",
"modifier": "private static",
"original_string": "private static boolean LazyDecode = false;",
"type": "boolean",
"var_name": "LazyDecode"
},
{
"declarator": "serialVersionUID = 4760032853L",
"modifier": "private... | {
"body": "@Override\n public int size() {\n if (!isDecoded()) {\n return keys.length;\n }\n\n return super.size();\n }",
"class_method_signature": "HMapIFW.size()",
"constructor": false,
"full_signature": "@Override public int size()",
"identifier": "size",
"invocations": [
"isDecoded",... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_128 | {
"fields": [],
"file": "lintools-datatypes/src/test/java/tl/lin/data/map/HMapIDTest.java",
"identifier": "HMapIDTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testIncrement() {\n HMapID m = new HMapID();\n assertEquals(0.0, m.get(1), 10E-6);\n\n m.increment(1, 0.5);\n assertEquals(0.5, m.get(1), 10E-6);\n\n m.increment(1);\n m.increment(2, 0.0);\n m.increment(3, -0.5);\n\n assertEquals(1.5, m.get(1), 10E-6);\n asse... | {
"fields": [
{
"declarator": "DEFAULT_INITIAL_CAPACITY = 1024",
"modifier": "static final",
"original_string": "static final int DEFAULT_INITIAL_CAPACITY = 1024;",
"type": "int",
"var_name": "DEFAULT_INITIAL_CAPACITY"
},
{
"declarator": "MAXIMUM_CAPACITY = 1 << 30",
... | {
"body": "@Override\n public void increment(int key) {\n if (this.containsKey(key)) {\n this.put(key, this.get(key) + 1.0);\n } else {\n this.put(key, 1.0);\n }\n }",
"class_method_signature": "HMapID.increment(int key)",
"constructor": false,
"full_signature": "@Override public void incre... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_57 | {
"fields": [
{
"declarator": "neg_one = -1",
"modifier": "",
"original_string": "int neg_one = -1, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, six = 6, seven = 7,\n nine = 9;",
"type": "int",
"var_name": "neg_one"
}
],
"file": "lintools-datatypes/src/test... | {
"body": "@Test\n public void testRemove() {\n ArrayListOfInts list = new ArrayListOfInts();\n for (int i = 0; i < 10; i++) {\n list.add(i);\n }\n\n list.remove(list.indexOf(5));\n assertEquals(9, list.size());\n assertEquals(0, list.get(0));\n assertEquals(1, list.get(1));\n assertEqua... | {
"fields": [
{
"declarator": "array",
"modifier": "protected transient",
"original_string": "protected transient int[] array;",
"type": "int[]",
"var_name": "array"
},
{
"declarator": "size = 0",
"modifier": "protected",
"original_string": "protected int si... | {
"body": "public int remove(int index) {\n if (index >= size) {\n throw new ArrayIndexOutOfBoundsException();\n }\n int oldValue = array[index];\n\n int numMoved = size - index - 1;\n if (numMoved > 0) {\n System.arraycopy(array, index + 1, array, index, numMoved);\n }\n\n size--;\n ... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
11309044_41 | {
"fields": [
{
"declarator": "neg_one = -1",
"modifier": "",
"original_string": "float neg_one = -1, zero = 0, one = 1, two = 2, three = 3, four = 4, five = 5, six = 6,\n seven = 7, nine = 9;",
"type": "float",
"var_name": "neg_one"
}
],
"file": "lintools-datatypes/src/... | {
"body": "@Test\n public void testArrayConstructor() {\n float[] arr = new float[] { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f };\n assertEquals(5, arr.length);\n\n ArrayListOfFloats list = new ArrayListOfFloats(arr);\n list.remove(2);\n\n // Make sure the original array remains untouched.\n assertEquals(1.0f,... | {
"fields": [
{
"declarator": "array",
"modifier": "protected transient",
"original_string": "protected transient float[] array;",
"type": "float[]",
"var_name": "array"
},
{
"declarator": "size = 0",
"modifier": "protected",
"original_string": "protected in... | {
"body": "public float remove(int index) {\n if (index >= size) {\n throw new ArrayIndexOutOfBoundsException();\n }\n float oldValue = array[index];\n\n int numMoved = size - index - 1;\n if (numMoved > 0) {\n System.arraycopy(array, index + 1, array, index, numMoved);\n }\n\n size--;\... | {
"created": null,
"fork": null,
"fork_count": 31,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 11309044,
"size": 575,
"stargazer_count": 17,
"stars": null,
"updates": null,
"url": "https://github.com/lintool/tools"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.