id stringlengths 7 14 | test_class dict | test_case dict | focal_class dict | focal_method dict | repository dict |
|---|---|---|---|---|---|
3028163_82 | {
"fields": [],
"file": "spring-boot/starter/src/test/java/org/togglz/spring/boot/actuate/TogglzEndpointTest.java",
"identifier": "TogglzEndpointTest",
"interfaces": "",
"superclass": "extends BaseTest"
} | {
"body": "@Test\n public void shouldDisableAFeature() {\n contextRunner.withConfiguration(AutoConfigurations.of(\n DispatcherServletPathConfig.class,\n TogglzAutoConfiguration.class,\n TogglzEndpointAutoConfiguration.class))\n .withPropertyValues(... | {
"fields": [
{
"declarator": "featureManager",
"modifier": "private final",
"original_string": "private final FeatureManager featureManager;",
"type": "FeatureManager",
"var_name": "featureManager"
}
],
"file": "spring-boot/starter/src/main/java/org/togglz/spring/boot/actuat... | {
"body": "@WriteOperation\n public TogglzFeature setFeatureState(@Selector String name, boolean enabled) {\n final Feature feature = featureManager.getFeatures().stream()\n .filter(f -> f.name().equals(name))\n .findFirst()\n .orElseThrow(() -> new IllegalArgume... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_118 | {
"fields": [],
"file": "core/src/test/java/org/togglz/core/util/FeatureMapTest.java",
"identifier": "FeatureMapTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void shouldSupportLookupByFeatureName() {\n FeatureManager featureManager = mock(FeatureManager.class);\n when(featureManager.isActive(featureNamed(\"test\"))).thenReturn(true);\n\n FeatureMap map = new FeatureMap(featureManager);\n\n assertEquals(true, map.get(\"test... | {
"fields": [
{
"declarator": "manager",
"modifier": "private final",
"original_string": "private final FeatureManager manager;",
"type": "FeatureManager",
"var_name": "manager"
}
],
"file": "core/src/main/java/org/togglz/core/util/FeatureMap.java",
"identifier": "FeatureMa... | {
"body": "@Override\n public Boolean get(Object key) {\n\n Validate.notNull(key, \"The feature must not be null\");\n\n Feature feature = null;\n if (key instanceof Feature) {\n feature = (Feature) key;\n } else {\n feature = new NamedFeature(key.toString());\n ... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_41 | {
"fields": [
{
"declarator": "applicationListener",
"modifier": "private",
"original_string": "private TogglzApplicationContextBinderApplicationListener applicationListener;",
"type": "TogglzApplicationContextBinderApplicationListener",
"var_name": "applicationListener"
},
{... | {
"body": "@Test\n void contextRefreshed() {\n ContextRefreshedEvent contextRefreshedEvent = mock(ContextRefreshedEvent.class);\n when(contextRefreshedEvent.getApplicationContext()).thenReturn(applicationContext);\n\n // Invoke context refreshed event\n applicationListener.onApplication... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(TogglzApplicationContextBinderApplicationListener.class)",
"modifier": "private static final",
"original_string": "private static final Log log = LogFactory.getLog(TogglzApplicationContextBinderApplicationListener.class);",
"type": "Lo... | {
"body": "@Override\n public void onApplicationEvent(ApplicationEvent event) {\n if (event instanceof ContextRefreshedEvent && filter.test((ContextRefreshedEvent) event)) {\n if (ContextClassLoaderApplicationContextHolder.get() != null) {\n log.warn(\"ApplicationContext already bo... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_134 | {
"fields": [
{
"declarator": "strategy = new TestingGradualActivationStrategy()",
"modifier": "private final",
"original_string": "private final ActivationStrategy strategy = new TestingGradualActivationStrategy();",
"type": "ActivationStrategy",
"var_name": "strategy"
}
],
... | {
"body": "@Test\n void shouldWorkCorrectlyForNinetyNinePercent() {\n FeatureState state = new FeatureState(GradualFeature.FEATURE);\n state.setEnabled(true);\n state.setParameter(GradualActivationStrategy.PARAM_PERCENTAGE, \"99\");\n\n // most values result in true\n assertTrue(... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(GradualActivationStrategy.class)",
"modifier": "private final",
"original_string": "private final Log log = LogFactory.getLog(GradualActivationStrategy.class);",
"type": "Log",
"var_name": "log"
},
{
"declarator": "... | {
"body": "@Override\n public boolean isActive(FeatureState state, FeatureUser user) {\n\n if (user != null && Strings.isNotBlank(user.getName())) {\n\n String percentageAsString = state.getParameter(PARAM_PERCENTAGE);\n try {\n\n int percentage = Integer.valueOf(percent... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_163 | {
"fields": [
{
"declarator": "dataSource",
"modifier": "private",
"original_string": "private DataSource dataSource;",
"type": "DataSource",
"var_name": "dataSource"
},
{
"declarator": "repository",
"modifier": "private",
"original_string": "private JDBCSta... | {
"body": "@Test\n void testShouldSaveStateStrategyAndParameters() {\n\n /*\n * WHEN a feature without strategy is persisted\n */\n FeatureState state = new FeatureState(TestFeature.F1)\n .enable()\n .setStrategyId(\"someId\")\n .setParameter(\"param\"... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(JDBCStateRepository.class)",
"modifier": "protected final",
"original_string": "protected final Log log = LogFactory.getLog(JDBCStateRepository.class);",
"type": "Log",
"var_name": "log"
},
{
"declarator": "dataSour... | {
"body": "@Override\n public void setFeatureState(FeatureState featureState) {\n\n try {\n\n Connection connection = dataSource.getConnection();\n try {\n\n int updatedRows = 0;\n\n /*\n * First try to update an existing row\n ... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_16 | {
"fields": [
{
"declarator": "MAX_ENTITY_GROUPS = 25",
"modifier": "public static final",
"original_string": "public static final int MAX_ENTITY_GROUPS = 25;",
"type": "int",
"var_name": "MAX_ENTITY_GROUPS"
},
{
"declarator": "helper = new LocalServiceTestHelper(\n ... | {
"body": "@Test\n public void shouldReturnNullWhenStateDoesntExist() {\n /*\n * GIVEN there is no feature state in the datastore WHEN the repository reads the state\n */\n final FeatureState state = repository.getFeatureState(TestFeature.F1);\n\n /*\n * THEN the proper... | {
"fields": [
{
"declarator": "STRATEGY_PARAMS_VALUES = \"strategyParamsValues\"",
"modifier": "public static final",
"original_string": "public static final String STRATEGY_PARAMS_VALUES = \"strategyParamsValues\";",
"type": "String",
"var_name": "STRATEGY_PARAMS_VALUES"
},
... | {
"body": "@Override\n public FeatureState getFeatureState(final Feature feature) {\n try {\n final Key key = KeyFactory.createKey(kind(), feature.name());\n return createFeatureState(feature, getInsideTransaction(key));\n } catch (final EntityNotFoundException ignored) {\n ... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_122 | {
"fields": [
{
"declarator": "JAVASCRIPT = \"ECMAScript\"",
"modifier": "private static final",
"original_string": "private static final String JAVASCRIPT = \"ECMAScript\";",
"type": "String",
"var_name": "JAVASCRIPT"
},
{
"declarator": "UNKNOWN_LANGUAGE = \"some langu... | {
"body": "@Test\n public void shouldReturnFalseForInvalidJavaScript() {\n ScriptEngineActivationStrategy strategy = new ScriptEngineActivationStrategy();\n\n FeatureState state = aScriptState(JAVASCRIPT, INVALID_JAVASCRIPT);\n boolean active = strategy.isActive(state, aFeatureUser(\"john\"));... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(ScriptEngineActivationStrategy.class)",
"modifier": "private final",
"original_string": "private final Log log = LogFactory.getLog(ScriptEngineActivationStrategy.class);",
"type": "Log",
"var_name": "log"
},
{
"decl... | {
"body": "@Override\n public boolean isActive(FeatureState featureState, FeatureUser user) {\n\n String lang = featureState.getParameter(PARAM_LANG);\n String script = featureState.getParameter(PARAM_SCRIPT);\n\n ScriptEngine engine = engineManager.getEngineByName(lang);\n if (engine =... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_57 | {
"fields": [
{
"declarator": "user",
"modifier": "private",
"original_string": "private FeatureUser user;",
"type": "FeatureUser",
"var_name": "user"
},
{
"declarator": "state",
"modifier": "private",
"original_string": "private FeatureState state;",
... | {
"body": "@Test\n public void shouldNotBeActiveWithANullRequestObject() {\n HttpServletRequestHolder.release();\n\n boolean isActive = strategy.isActive(state, user);\n\n assertFalse(isActive);\n }",
"class_method_signature": "QueryParameterActivationStrategyTest.shouldNotBeActiveWithANu... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(QueryParameterActivationStrategy.class)",
"modifier": "private static final",
"original_string": "private static final Log log = LogFactory.getLog(QueryParameterActivationStrategy.class);",
"type": "Log",
"var_name": "log"
},... | {
"body": "@Override\n public boolean isActive(FeatureState featureState, FeatureUser user) {\n\n HttpServletRequest request = HttpServletRequestHolder.get();\n if (request == null) {\n return false;\n }\n\n String triggerParamsString = featureState.getParameter(PARAM_URL_PAR... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_20 | {
"fields": [
{
"declarator": "helper = new LocalServiceTestHelper(\n new LocalDatastoreServiceTestConfig())",
"modifier": "private final",
"original_string": "private final LocalServiceTestHelper helper = new LocalServiceTestHelper(\n new LocalDatastoreServiceTestConfig());",
... | {
"body": "@Test\n public void getFeatureStateShouldRunWithinGivenNamespaceWhenCurrentNamespaceIsNotDefault() {\n NamespaceManager.set(ORIGINAL_NAMESPACE);\n repository = new FixedNamespaceStateRepository(ACME_NAMESPACE, new StateRepository() {\n @Override\n public void setFeatu... | {
"fields": [
{
"declarator": "namespace",
"modifier": "private final",
"original_string": "private final String namespace;",
"type": "String",
"var_name": "namespace"
},
{
"declarator": "decorated",
"modifier": "private final",
"original_string": "private f... | {
"body": "@Override\n public FeatureState getFeatureState(final Feature feature) {\n return withinNamespace(namespace, () -> decorated.getFeatureState(feature));\n }",
"class_method_signature": "FixedNamespaceStateRepository.getFeatureState(final Feature feature)",
"constructor": false,
"full_sign... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_155 | {
"fields": [
{
"declarator": "FIELD_LEVEL_GROUP_LABEL = \"Field Level Group Label\"",
"modifier": "public static final",
"original_string": "public static final String FIELD_LEVEL_GROUP_LABEL = \"Field Level Group Label\";",
"type": "String",
"var_name": "FIELD_LEVEL_GROUP_LABEL"
... | {
"body": "@Test\n public void constructorWillPopulateDefaultActivationStrategyFromAnnotations() throws Exception {\n // act\n EnumFeatureMetaData metaData = new EnumFeatureMetaData(TestFeatures.FEATURE_WITH_DEFAULT_STATE);\n\n FeatureState featureState = metaData.getDefaultFeatureState();\n\n... | {
"fields": [
{
"declarator": "label",
"modifier": "private final",
"original_string": "private final String label;",
"type": "String",
"var_name": "label"
},
{
"declarator": "defaultFeatureState",
"modifier": "private final",
"original_string": "private fin... | {
"body": "@Override\n public FeatureState getDefaultFeatureState() {\n return defaultFeatureState.copy();\n }",
"class_method_signature": "EnumFeatureMetaData.getDefaultFeatureState()",
"constructor": false,
"full_signature": "@Override public FeatureState getDefaultFeatureState()",
"identifier"... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_98 | {
"fields": [
{
"declarator": "repository",
"modifier": "private",
"original_string": "private StateRepository repository;",
"type": "StateRepository",
"var_name": "repository"
},
{
"declarator": "manager",
"modifier": "private",
"original_string": "private ... | {
"body": "@Test\n public void testGetFeatures() {\n assertTrue(manager.getFeatures().containsAll(Arrays.asList(MyFeatures.DELETE_USERS, MyFeatures.EXPERIMENTAL, MyFeatures.MISSING_STRATEGY)));\n }",
"class_method_signature": "DefaultFeatureManagerTest.testGetFeatures()",
"constructor": false,
"ful... | {
"fields": [
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "stateRepository",
"modifier": "private final",
"original_string": "private final Stat... | {
"body": "@Override\n public Set<Feature> getFeatures() {\n return Collections.unmodifiableSet(featureProvider.getFeatures());\n }",
"class_method_signature": "DefaultFeatureManager.getFeatures()",
"constructor": false,
"full_signature": "@Override public Set<Feature> getFeatures()",
"identifier... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_102 | {
"fields": [],
"file": "core/src/test/java/org/togglz/core/user/SingleUserProviderTest.java",
"identifier": "SingleUserProviderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void canProvideNamedUser() {\n String username = \"named-user\";\n boolean featureAdmin = true;\n UserProvider userProvider = new SingleUserProvider(username, featureAdmin);\n FeatureUser user = userProvider.getCurrentUser();\n assertEquals(username, user.getNa... | {
"fields": [
{
"declarator": "user",
"modifier": "private final",
"original_string": "private final FeatureUser user;",
"type": "FeatureUser",
"var_name": "user"
}
],
"file": "core/src/main/java/org/togglz/core/user/SingleUserProvider.java",
"identifier": "SingleUserProvid... | {
"body": "@Override\n public FeatureUser getCurrentUser() {\n return user;\n }",
"class_method_signature": "SingleUserProvider.getCurrentUser()",
"constructor": false,
"full_signature": "@Override public FeatureUser getCurrentUser()",
"identifier": "getCurrentUser",
"invocations": [],
"modif... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_77 | {
"fields": [
{
"declarator": "stateRepository = HazelcastStateRepository.newBuilder().mapName(\"togglzMap\").build()",
"modifier": "private final",
"original_string": "private final StateRepository stateRepository = HazelcastStateRepository.newBuilder().mapName(\"togglzMap\").build();",
"... | {
"body": "@Test\n\tvoid onlyClientConfigSetBuildsSuccessfully() {\n\t\tHazelcastStateRepository stateRepository = HazelcastStateRepository.newBuilder()\n\t\t\t\t.clientConfig(new ClientConfig())\n\t\t\t\t.build();\n\n\t\tassertNotNull(stateRepository);\n\t}",
"class_method_signature": "HazelcastStateRepositoryTest... | {
"fields": [
{
"declarator": "hazelcastInstance",
"modifier": "protected final",
"original_string": "protected final HazelcastInstance hazelcastInstance;",
"type": "HazelcastInstance",
"var_name": "hazelcastInstance"
},
{
"declarator": "hazelcastConfig",
"modifie... | {
"body": "public static Builder newBuilder() {\n\t\treturn new Builder();\n\t}",
"class_method_signature": "HazelcastStateRepository.newBuilder()",
"constructor": false,
"full_signature": "public static Builder newBuilder()",
"identifier": "newBuilder",
"invocations": [],
"modifiers": "public static",
... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_61 | {
"fields": [
{
"declarator": "user",
"modifier": "private",
"original_string": "private FeatureUser user;",
"type": "FeatureUser",
"var_name": "user"
},
{
"declarator": "state",
"modifier": "private",
"original_string": "private FeatureState state;",
... | {
"body": "@Test\n public void shouldNotBeActiveWhenMatchingParameterRequiringValueDoesNotHaveValue() {\n Map<String, String[]> parameters = new HashMap<>();\n parameters.put(\"toggleFeatureX\", null);\n when(request.getParameterMap()).thenReturn(parameters);\n\n boolean isActive = stra... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(QueryParameterActivationStrategy.class)",
"modifier": "private static final",
"original_string": "private static final Log log = LogFactory.getLog(QueryParameterActivationStrategy.class);",
"type": "Log",
"var_name": "log"
},... | {
"body": "@Override\n public boolean isActive(FeatureState featureState, FeatureUser user) {\n\n HttpServletRequest request = HttpServletRequestHolder.get();\n if (request == null) {\n return false;\n }\n\n String triggerParamsString = featureState.getParameter(PARAM_URL_PAR... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_114 | {
"fields": [],
"file": "core/src/test/java/org/togglz/core/util/StringsTest.java",
"identifier": "StringsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void testTrimToNull() {\n assertNull(Strings.trimToNull(null));\n assertNull(Strings.trimToNull(\"\"));\n assertNull(Strings.trimToNull(\" \"));\n assertEquals(\"foo\", Strings.trimToNull(\" foo \"));\n }",
"class_method_signature": "StringsTest.testTrimToN... | {
"fields": [
{
"declarator": "falseValues = new HashSet<>(4)",
"modifier": "private static final",
"original_string": "private static final Set<String> falseValues = new HashSet<>(4);",
"type": "Set<String>",
"var_name": "falseValues"
},
{
"declarator": "trueValues = n... | {
"body": "public static String trimToNull(String s) {\n s = trim(s);\n return isNotEmpty(s) ? s : null;\n }",
"class_method_signature": "Strings.trimToNull(String s)",
"constructor": false,
"full_signature": "public static String trimToNull(String s)",
"identifier": "trimToNull",
"invocati... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_3 | {
"fields": [
{
"declarator": "helper = new LocalServiceTestHelper(new LocalUserServiceTestConfig())",
"modifier": "private final",
"original_string": "private final LocalServiceTestHelper helper = new LocalServiceTestHelper(new LocalUserServiceTestConfig());",
"type": "LocalServiceTestHel... | {
"body": "@Test\n public void userIsNotLoggedIn() {\n helper.setEnvIsLoggedIn(false);\n FeatureUser user = userProvider.getCurrentUser();\n assertNull(user);\n }",
"class_method_signature": "UserServiceUserProviderTest.userIsNotLoggedIn()",
"constructor": false,
"full_signature": "@T... | {
"fields": [
{
"declarator": "userService",
"modifier": "private",
"original_string": "private UserService userService;",
"type": "UserService",
"var_name": "userService"
}
],
"file": "appengine/src/main/java/org/togglz/appengine/user/UserServiceUserProvider.java",
"identi... | {
"body": "@Override\n public FeatureUser getCurrentUser() {\n SimpleFeatureUser featureUser = null;\n User user = userService.getCurrentUser();\n if (user != null) {\n featureUser = new SimpleFeatureUser(user.getUserId(), userService.isUserAdmin());\n featureUser.setAttr... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_143 | {
"fields": [
{
"declarator": "activationStrategy",
"modifier": "@InjectMocks\n private",
"original_string": "@InjectMocks\n private UserRoleActivationStrategy activationStrategy;",
"type": "UserRoleActivationStrategy",
"var_name": "activationStrategy"
},
{
"decla... | {
"body": "@Test\n void isActiveWillReturnFalseWhenUserHasNoneOfSelectedRoles() {\n when(user.getAttribute(USER_ATTRIBUTE_ROLES)).thenReturn(userRoles);\n when(state.getParameter(PARAM_ROLES_NAME)).thenReturn(\"ROLE_1, ROLE_2, ROLE_3\");\n\n boolean result = activationStrategy.isActive(state, ... | {
"fields": [
{
"declarator": "ID = \"user-role\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"user-role\";",
"type": "String",
"var_name": "ID"
},
{
"declarator": "NAME = \"Users by role\"",
"modifier": "public static... | {
"body": "@Override\n public boolean isActive(FeatureState state, FeatureUser user) {\n\n if (user != null) {\n\n Collection<String> userRoles = \n (Collection<String>) user.getAttribute(USER_ATTRIBUTE_ROLES);\n\n if (userRoles != null) {\n\n String roles... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_36 | {
"fields": [
{
"declarator": "activeProfiles",
"modifier": "private",
"original_string": "private String[] activeProfiles;",
"type": "String[]",
"var_name": "activeProfiles"
},
{
"declarator": "mockApplicationContext",
"modifier": "@Mock\n private",
"ori... | {
"body": "@Test\n void testGetTokenParameterName() {\n assertEquals(SpringProfileActivationStrategy.PARAM_PROFILES, strategy.getTokenParameterName());\n }",
"class_method_signature": "SpringProfileActivationStrategyTest.testGetTokenParameterName()",
"constructor": false,
"full_signature": "@Test v... | {
"fields": [
{
"declarator": "ID = \"spring-profile\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"spring-profile\";",
"type": "String",
"var_name": "ID"
},
{
"declarator": "PARAM_PROFILES = \"profiles\"",
"modifier":... | {
"body": "@Override\n public String getTokenParameterName() {\n return PARAM_PROFILES;\n }",
"class_method_signature": "SpringProfileActivationStrategy.getTokenParameterName()",
"constructor": false,
"full_signature": "@Override public String getTokenParameterName()",
"identifier": "getTokenPara... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_138 | {
"fields": [
{
"declarator": "activationStrategy",
"modifier": "@InjectMocks\n private",
"original_string": "@InjectMocks\n private UserRoleActivationStrategy activationStrategy;",
"type": "UserRoleActivationStrategy",
"var_name": "activationStrategy"
},
{
"decla... | {
"body": "@Test\n void getNameWillReturnConstant() {\n assertEquals(NAME, activationStrategy.getName());\n }",
"class_method_signature": "UserRoleActivationStrategyTest.getNameWillReturnConstant()",
"constructor": false,
"full_signature": "@Test void getNameWillReturnConstant()",
"identifier": "... | {
"fields": [
{
"declarator": "ID = \"user-role\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"user-role\";",
"type": "String",
"var_name": "ID"
},
{
"declarator": "NAME = \"Users by role\"",
"modifier": "public static... | {
"body": "@Override\n public String getName() {\n return NAME;\n }",
"class_method_signature": "UserRoleActivationStrategy.getName()",
"constructor": false,
"full_signature": "@Override public String getName()",
"identifier": "getName",
"invocations": [],
"modifiers": "@Override public",
"... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_139 | {
"fields": [
{
"declarator": "activationStrategy",
"modifier": "@InjectMocks\n private",
"original_string": "@InjectMocks\n private UserRoleActivationStrategy activationStrategy;",
"type": "UserRoleActivationStrategy",
"var_name": "activationStrategy"
},
{
"decla... | {
"body": "@Test\n void isActiveWillReturnFalseWhenThereIsNoUser() {\n boolean result = activationStrategy.isActive(state, null);\n\n assertFalse(result);\n }",
"class_method_signature": "UserRoleActivationStrategyTest.isActiveWillReturnFalseWhenThereIsNoUser()",
"constructor": false,
"full_... | {
"fields": [
{
"declarator": "ID = \"user-role\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"user-role\";",
"type": "String",
"var_name": "ID"
},
{
"declarator": "NAME = \"Users by role\"",
"modifier": "public static... | {
"body": "@Override\n public boolean isActive(FeatureState state, FeatureUser user) {\n\n if (user != null) {\n\n Collection<String> userRoles = \n (Collection<String>) user.getAttribute(USER_ATTRIBUTE_ROLES);\n\n if (userRoles != null) {\n\n String roles... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_142 | {
"fields": [
{
"declarator": "activationStrategy",
"modifier": "@InjectMocks\n private",
"original_string": "@InjectMocks\n private UserRoleActivationStrategy activationStrategy;",
"type": "UserRoleActivationStrategy",
"var_name": "activationStrategy"
},
{
"decla... | {
"body": "@Test\n void isActiveWillReturnFalseWhenRolesParamIsBlank() {\n when(user.getAttribute(USER_ATTRIBUTE_ROLES)).thenReturn(userRoles);\n when(state.getParameter(PARAM_ROLES_NAME)).thenReturn(\" \");\n\n boolean result = activationStrategy.isActive(state, user);\n\n assertFals... | {
"fields": [
{
"declarator": "ID = \"user-role\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"user-role\";",
"type": "String",
"var_name": "ID"
},
{
"declarator": "NAME = \"Users by role\"",
"modifier": "public static... | {
"body": "@Override\n public boolean isActive(FeatureState state, FeatureUser user) {\n\n if (user != null) {\n\n Collection<String> userRoles = \n (Collection<String>) user.getAttribute(USER_ATTRIBUTE_ROLES);\n\n if (userRoles != null) {\n\n String roles... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_37 | {
"fields": [
{
"declarator": "activeProfiles",
"modifier": "private",
"original_string": "private String[] activeProfiles;",
"type": "String[]",
"var_name": "activeProfiles"
},
{
"declarator": "mockApplicationContext",
"modifier": "@Mock\n private",
"ori... | {
"body": "@Test\n void testGetTokenParameterTransformer() {\n TokenTransformer transformer = strategy.getTokenParameterTransformer();\n\n assertNotNull(transformer);\n assertEquals(\"foo\", transformer.transform(\"FOO\"));\n }",
"class_method_signature": "SpringProfileActivationStrategyT... | {
"fields": [
{
"declarator": "ID = \"spring-profile\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"spring-profile\";",
"type": "String",
"var_name": "ID"
},
{
"declarator": "PARAM_PROFILES = \"profiles\"",
"modifier":... | {
"body": "@Override\n public TokenTransformer getTokenParameterTransformer() {\n return new TokenTransformer() {\n @Override\n public String transform(String value) {\n return value.toLowerCase();\n }\n };\n }",
"class_method_signature": "SpringPr... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_2 | {
"fields": [
{
"declarator": "strategy",
"modifier": "private",
"original_string": "private MicroProfileConfigActivationStrategy strategy;",
"type": "MicroProfileConfigActivationStrategy",
"var_name": "strategy"
}
],
"file": "microprofile-config/src/test/java/org/togglz/micr... | {
"body": "@Test\n void getParameters() {\n Parameter[] parameters = strategy.getParameters();\n\n assertEquals(2, parameters.length);\n\n Parameter parameter = parameters[0];\n\n assertNotNull(parameter);\n assertEquals(AbstractPropertyDrivenActivationStrategy.PARAM_NAME, parame... | {
"fields": [
{
"declarator": "ID = \"microprofile-config-property\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"microprofile-config-property\";",
"type": "String",
"var_name": "ID"
}
],
"file": "microprofile-config/src/main/java... | {
"body": "@Override\n public String getName() {\n return \"MicroProfile Config Property\";\n }",
"class_method_signature": "MicroProfileConfigActivationStrategy.getName()",
"constructor": false,
"full_signature": "@Override public String getName()",
"identifier": "getName",
"invocations": [],
... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_60 | {
"fields": [
{
"declarator": "user",
"modifier": "private",
"original_string": "private FeatureUser user;",
"type": "FeatureUser",
"var_name": "user"
},
{
"declarator": "state",
"modifier": "private",
"original_string": "private FeatureState state;",
... | {
"body": "@Test\n public void shouldNotBeActiveWhenMatchingParameterHasANonMatchingValue() {\n Map<String, String[]> parameters = new HashMap<>();\n parameters.put(\"toggleFeatureX\", new String[]{\"false\"});\n parameters.put(\"toggleAll\", new String[]{\"nope\"});\n when(request.getP... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(QueryParameterActivationStrategy.class)",
"modifier": "private static final",
"original_string": "private static final Log log = LogFactory.getLog(QueryParameterActivationStrategy.class);",
"type": "Log",
"var_name": "log"
},... | {
"body": "@Override\n public boolean isActive(FeatureState featureState, FeatureUser user) {\n\n HttpServletRequest request = HttpServletRequestHolder.get();\n if (request == null) {\n return false;\n }\n\n String triggerParamsString = featureState.getParameter(PARAM_URL_PAR... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_115 | {
"fields": [],
"file": "core/src/test/java/org/togglz/core/util/StringsTest.java",
"identifier": "StringsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void testToBoolean() {\n assertNull(Strings.toBoolean(null));\n assertNull(Strings.toBoolean(\"\"));\n assertNull(Strings.toBoolean(\" \"));\n\n assertEquals(Boolean.TRUE, Strings.toBoolean(\"true\"));\n assertEquals(Boolean.TRUE, Strings.toBoolean(\" TRUE ... | {
"fields": [
{
"declarator": "falseValues = new HashSet<>(4)",
"modifier": "private static final",
"original_string": "private static final Set<String> falseValues = new HashSet<>(4);",
"type": "Set<String>",
"var_name": "falseValues"
},
{
"declarator": "trueValues = n... | {
"body": "public static Boolean toBoolean(String s) {\n String value = trimToNull(s);\n if (value == null) {\n return null;\n }\n\n value = value.toLowerCase();\n\n if (trueValues.contains(value)) {\n return Boolean.TRUE;\n }\n if (falseValues.co... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_99 | {
"fields": [
{
"declarator": "repository",
"modifier": "private",
"original_string": "private StateRepository repository;",
"type": "StateRepository",
"var_name": "repository"
},
{
"declarator": "manager",
"modifier": "private",
"original_string": "private ... | {
"body": "@Test\n public void testIsActive() {\n\n // DELETE_USERS disabled for unknown user\n featureUserProvider.setFeatureUser(null);\n assertFalse(manager.isActive(MyFeatures.DELETE_USERS));\n\n // DELETE_USERS enabled for admin user\n featureUserProvider.setFeatureUser(new ... | {
"fields": [
{
"declarator": "name",
"modifier": "private final",
"original_string": "private final String name;",
"type": "String",
"var_name": "name"
},
{
"declarator": "stateRepository",
"modifier": "private final",
"original_string": "private final Stat... | {
"body": "@Override\n public boolean isActive(Feature feature) {\n\n Validate.notNull(feature, \"feature is required\");\n\n FeatureState state = stateRepository.getFeatureState(feature);\n\n if (state == null) {\n state = getMetaData(feature).getDefaultFeatureState();\n }\n... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_103 | {
"fields": [],
"file": "core/src/test/java/org/togglz/core/util/FeatureAnnotationsTest.java",
"identifier": "FeatureAnnotationsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void testGetLabel() {\n assertEquals(\"Some feature with a label\", FeatureAnnotations.getLabel(MyFeature.FEATURE_WITH_LABEL));\n assertEquals(\"FEATURE_WITHOUT_LABEL\", FeatureAnnotations.getLabel(MyFeature.FEATURE_WITHOUT_LABEL));\n }",
"class_method_signature": "FeatureAnno... | {
"fields": [],
"file": "core/src/main/java/org/togglz/core/util/FeatureAnnotations.java",
"identifier": "FeatureAnnotations",
"interfaces": "",
"methods": [
{
"class_method_signature": "FeatureAnnotations.getLabel(Feature feature)",
"constructor": false,
"full_signature": "public static... | {
"body": "public static String getLabel(Feature feature) {\n Label label = getAnnotation(feature, Label.class);\n if (label != null) {\n return label.value();\n }\n return feature.name();\n }",
"class_method_signature": "FeatureAnnotations.getLabel(Feature feature)",
"co... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_76 | {
"fields": [
{
"declarator": "stateRepository = HazelcastStateRepository.newBuilder().mapName(\"togglzMap\").build()",
"modifier": "private final",
"original_string": "private final StateRepository stateRepository = HazelcastStateRepository.newBuilder().mapName(\"togglzMap\").build();",
"... | {
"body": "@Test\n\tvoid onlyConfigSetBuildsSuccessfully() {\n\t\tHazelcastStateRepository stateRepository = HazelcastStateRepository.newBuilder()\n\t\t\t\t.config(new Config())\n\t\t\t\t.build();\n\n\t\tassertNotNull(stateRepository);\n\t}",
"class_method_signature": "HazelcastStateRepositoryTest.onlyConfigSetBuil... | {
"fields": [
{
"declarator": "hazelcastInstance",
"modifier": "protected final",
"original_string": "protected final HazelcastInstance hazelcastInstance;",
"type": "HazelcastInstance",
"var_name": "hazelcastInstance"
},
{
"declarator": "hazelcastConfig",
"modifie... | {
"body": "public static Builder newBuilder() {\n\t\treturn new Builder();\n\t}",
"class_method_signature": "HazelcastStateRepository.newBuilder()",
"constructor": false,
"full_signature": "public static Builder newBuilder()",
"identifier": "newBuilder",
"invocations": [],
"modifiers": "public static",
... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_21 | {
"fields": [
{
"declarator": "helper = new LocalServiceTestHelper(\n new LocalDatastoreServiceTestConfig())",
"modifier": "private final",
"original_string": "private final LocalServiceTestHelper helper = new LocalServiceTestHelper(\n new LocalDatastoreServiceTestConfig());",
... | {
"body": "@Test\n public void setFeatureStateShouldRunWithinGivenNamespaceWhenCurrentNamespaceIsNotDefault() {\n NamespaceManager.set(ORIGINAL_NAMESPACE);\n repository = new FixedNamespaceStateRepository(ACME_NAMESPACE, new StateRepository() {\n @Override\n public void setFeatu... | {
"fields": [
{
"declarator": "namespace",
"modifier": "private final",
"original_string": "private final String namespace;",
"type": "String",
"var_name": "namespace"
},
{
"declarator": "decorated",
"modifier": "private final",
"original_string": "private f... | {
"body": "@Override\n public void setFeatureState(final FeatureState featureState) {\n withinNamespace(namespace, new VoidWork() {\n @Override\n void vrun() {\n decorated.setFeatureState(featureState);\n }\n });\n }",
"class_method_signature": "Fi... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_154 | {
"fields": [
{
"declarator": "FIELD_LEVEL_GROUP_LABEL = \"Field Level Group Label\"",
"modifier": "public static final",
"original_string": "public static final String FIELD_LEVEL_GROUP_LABEL = \"Field Level Group Label\";",
"type": "String",
"var_name": "FIELD_LEVEL_GROUP_LABEL"
... | {
"body": "@Test\n public void constructorWillPopulateGroupsFromAnnotations() throws Exception {\n // act\n EnumFeatureMetaData metaData = new EnumFeatureMetaData(TestFeatures.FEATURE);\n\n // assert\n Set<FeatureGroup> groups = metaData.getGroups();\n\n assertNotNull(groups);\n ... | {
"fields": [
{
"declarator": "label",
"modifier": "private final",
"original_string": "private final String label;",
"type": "String",
"var_name": "label"
},
{
"declarator": "defaultFeatureState",
"modifier": "private final",
"original_string": "private fin... | {
"body": "@Override\n public Set<FeatureGroup> getGroups() {\n return groups;\n }",
"class_method_signature": "EnumFeatureMetaData.getGroups()",
"constructor": false,
"full_signature": "@Override public Set<FeatureGroup> getGroups()",
"identifier": "getGroups",
"invocations": [],
"modifiers"... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_123 | {
"fields": [
{
"declarator": "JAVASCRIPT = \"ECMAScript\"",
"modifier": "private static final",
"original_string": "private static final String JAVASCRIPT = \"ECMAScript\";",
"type": "String",
"var_name": "JAVASCRIPT"
},
{
"declarator": "UNKNOWN_LANGUAGE = \"some langu... | {
"body": "@Test\n public void shouldReturnSameResultAsScriptForLiterals() {\n ScriptEngineActivationStrategy strategy = new ScriptEngineActivationStrategy();\n\n FeatureState stateAlwaysTrue = aScriptState(JAVASCRIPT, \"1 == 1\");\n assertTrue(strategy.isActive(stateAlwaysTrue, aFeatureUser(\... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(ScriptEngineActivationStrategy.class)",
"modifier": "private final",
"original_string": "private final Log log = LogFactory.getLog(ScriptEngineActivationStrategy.class);",
"type": "Log",
"var_name": "log"
},
{
"decl... | {
"body": "@Override\n public boolean isActive(FeatureState featureState, FeatureUser user) {\n\n String lang = featureState.getParameter(PARAM_LANG);\n String script = featureState.getParameter(PARAM_SCRIPT);\n\n ScriptEngine engine = engineManager.getEngineByName(lang);\n if (engine =... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_56 | {
"fields": [
{
"declarator": "user",
"modifier": "private",
"original_string": "private FeatureUser user;",
"type": "FeatureUser",
"var_name": "user"
},
{
"declarator": "state",
"modifier": "private",
"original_string": "private FeatureState state;",
... | {
"body": "@Test\n public void shouldBeActiveWhenRequestHeaderIncludesFeatureToggle() {\n when(request.getHeader(\"X-Features\")).thenReturn(\"FEATURE,ANOTHERFEATURE\");\n\n boolean isActive = strategy.isActive(state, user);\n\n assertTrue(isActive);\n }",
"class_method_signature": "HeaderActivationStrat... | {
"fields": [
{
"declarator": "ID = \"header\"",
"modifier": "static final",
"original_string": "static final String ID = \"header\";",
"type": "String",
"var_name": "ID"
}
],
"file": "servlet/src/main/java/org/togglz/servlet/activation/HeaderActivationStrategy.java",
"iden... | {
"body": "@Override\n public boolean isActive(FeatureState featureState, FeatureUser user) {\n HttpServletRequest request = HttpServletRequestHolder.get();\n if (request == null || featureState == null || featureState.getFeature() == null) {\n return false;\n }\n String head... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_162 | {
"fields": [
{
"declarator": "dataSource",
"modifier": "private",
"original_string": "private DataSource dataSource;",
"type": "DataSource",
"var_name": "dataSource"
},
{
"declarator": "repository",
"modifier": "private",
"original_string": "private JDBCSta... | {
"body": "@Test\n void testShouldSaveStateWithoutStrategyOrParameters() {\n\n /*\n * WHEN a feature without strategy is persisted\n */\n FeatureState state = new FeatureState(TestFeature.F1).disable();\n repository.setFeatureState(state);\n\n /*\n * THEN there s... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(JDBCStateRepository.class)",
"modifier": "protected final",
"original_string": "protected final Log log = LogFactory.getLog(JDBCStateRepository.class);",
"type": "Log",
"var_name": "log"
},
{
"declarator": "dataSour... | {
"body": "@Override\n public void setFeatureState(FeatureState featureState) {\n\n try {\n\n Connection connection = dataSource.getConnection();\n try {\n\n int updatedRows = 0;\n\n /*\n * First try to update an existing row\n ... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_17 | {
"fields": [
{
"declarator": "MAX_ENTITY_GROUPS = 25",
"modifier": "public static final",
"original_string": "public static final int MAX_ENTITY_GROUPS = 25;",
"type": "int",
"var_name": "MAX_ENTITY_GROUPS"
},
{
"declarator": "helper = new LocalServiceTestHelper(\n ... | {
"body": "@Test\n public void testShouldReadStateWithoutStrategyAndParameters() {\n\n /*\n * GIVEN a database row containing a simple feature state\n */\n update(\"F1\", false, null, null, null);\n\n /*\n * WHEN the repository reads the state\n */\n fina... | {
"fields": [
{
"declarator": "STRATEGY_PARAMS_VALUES = \"strategyParamsValues\"",
"modifier": "public static final",
"original_string": "public static final String STRATEGY_PARAMS_VALUES = \"strategyParamsValues\";",
"type": "String",
"var_name": "STRATEGY_PARAMS_VALUES"
},
... | {
"body": "@Override\n public FeatureState getFeatureState(final Feature feature) {\n try {\n final Key key = KeyFactory.createKey(kind(), feature.name());\n return createFeatureState(feature, getInsideTransaction(key));\n } catch (final EntityNotFoundException ignored) {\n ... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_40 | {
"fields": [
{
"declarator": "mockApplicationContext",
"modifier": "@Mock\n private",
"original_string": "@Mock\n private ApplicationContext mockApplicationContext;",
"type": "ApplicationContext",
"var_name": "mockApplicationContext"
},
{
"declarator": "mockEnvir... | {
"body": "@Test\n void testGetParameters() {\n Parameter[] parameters = strategy.getParameters();\n\n assertEquals(2, parameters.length);\n\n Parameter parameter = parameters[0];\n\n assertNotNull(parameter);\n assertEquals(AbstractPropertyDrivenActivationStrategy.PARAM_NAME, pa... | {
"fields": [
{
"declarator": "ID = \"spring-environment-property\"",
"modifier": "public static final",
"original_string": "public static final String ID = \"spring-environment-property\";",
"type": "String",
"var_name": "ID"
}
],
"file": "spring-core/src/main/java/org/toggl... | {
"body": "@Override\n public String getName() {\n return \"Spring Environment Property\";\n }",
"class_method_signature": "SpringEnvironmentPropertyActivationStrategy.getName()",
"constructor": false,
"full_signature": "@Override public String getName()",
"identifier": "getName",
"invocations"... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_135 | {
"fields": [
{
"declarator": "strategy = new TestingGradualActivationStrategy()",
"modifier": "private final",
"original_string": "private final ActivationStrategy strategy = new TestingGradualActivationStrategy();",
"type": "ActivationStrategy",
"var_name": "strategy"
}
],
... | {
"body": "@Test\n void shouldFindCorrectDecisionForIntermediateValues() {\n FeatureState state = new FeatureState(GradualFeature.FEATURE);\n state.setEnabled(true);\n state.setParameter(GradualActivationStrategy.PARAM_PERCENTAGE, \"50\");\n\n // for hash values 0-49 the feature is acti... | {
"fields": [
{
"declarator": "log = LogFactory.getLog(GradualActivationStrategy.class)",
"modifier": "private final",
"original_string": "private final Log log = LogFactory.getLog(GradualActivationStrategy.class);",
"type": "Log",
"var_name": "log"
},
{
"declarator": "... | {
"body": "@Override\n public boolean isActive(FeatureState state, FeatureUser user) {\n\n if (user != null && Strings.isNotBlank(user.getName())) {\n\n String percentageAsString = state.getParameter(PARAM_PERCENTAGE);\n try {\n\n int percentage = Integer.valueOf(percent... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_83 | {
"fields": [],
"file": "spring-boot/starter/src/test/java/org/togglz/spring/boot/actuate/TogglzEndpointTest.java",
"identifier": "TogglzEndpointTest",
"interfaces": "",
"superclass": "extends BaseTest"
} | {
"body": "@Test\n public void shouldThrowAnIllegalArgumentExceptionIfTheFeatureDoesNotExist() {\n contextRunner.withConfiguration(AutoConfigurations.of(\n DispatcherServletPathConfig.class,\n TogglzAutoConfiguration.class,\n TogglzEndpointAutoConfiguration.class... | {
"fields": [
{
"declarator": "featureManager",
"modifier": "private final",
"original_string": "private final FeatureManager featureManager;",
"type": "FeatureManager",
"var_name": "featureManager"
}
],
"file": "spring-boot/starter/src/main/java/org/togglz/spring/boot/actuat... | {
"body": "@WriteOperation\n public TogglzFeature setFeatureState(@Selector String name, boolean enabled) {\n final Feature feature = featureManager.getFeatures().stream()\n .filter(f -> f.name().equals(name))\n .findFirst()\n .orElseThrow(() -> new IllegalArgume... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_119 | {
"fields": [],
"file": "core/src/test/java/org/togglz/core/util/FeatureMapTest.java",
"identifier": "FeatureMapTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n void shouldSupportLookupByFeatureInstance() {\n\n FeatureManager featureManager = mock(FeatureManager.class);\n when(featureManager.isActive(featureNamed(\"test\"))).thenReturn(true);\n\n FeatureMap map = new FeatureMap(featureManager);\n\n assertEquals(true, map.get(... | {
"fields": [
{
"declarator": "manager",
"modifier": "private final",
"original_string": "private final FeatureManager manager;",
"type": "FeatureManager",
"var_name": "manager"
}
],
"file": "core/src/main/java/org/togglz/core/util/FeatureMap.java",
"identifier": "FeatureMa... | {
"body": "@Override\n public Boolean get(Object key) {\n\n Validate.notNull(key, \"The feature must not be null\");\n\n Feature feature = null;\n if (key instanceof Feature) {\n feature = (Feature) key;\n } else {\n feature = new NamedFeature(key.toString());\n ... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_95 | {
"fields": [],
"file": "core/src/test/java/org/togglz/core/manager/EnumBasedFeatureProviderTest.java",
"identifier": "EnumBasedFeatureProviderTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void shouldNotAllowTheDefaultFeatureStateToBeChangedByExternalClasses() {\n FeatureProvider provider = new EnumBasedFeatureProvider(ValidFeatureEnum.class, OtherFeatureEnum.class);\n\n FeatureMetaData metaData = provider.getMetaData(ValidFeatureEnum.FEATURE1);\n asser... | {
"fields": [
{
"declarator": "metaDataCache = null",
"modifier": "private",
"original_string": "private Map<String, FeatureMetaData> metaDataCache = null;",
"type": "Map<String, FeatureMetaData>",
"var_name": "metaDataCache"
},
{
"declarator": "features = null",
... | {
"body": "@Override\n public FeatureMetaData getMetaData(Feature feature) {\n if (metaDataCache == null) {\n throw new IllegalStateException(\"There are no features added in this provider instance.\");\n }\n return metaDataCache.get(feature.name());\n }",
"class_method_signatu... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
3028163_158 | {
"fields": [
{
"declarator": "delegate",
"modifier": "private",
"original_string": "private StateRepository delegate;",
"type": "StateRepository",
"var_name": "delegate"
}
],
"file": "core/src/test/java/org/togglz/core/repository/cache/CachingStateRepositoryTest.java",
"id... | {
"body": "@Test\n void testCacheWithDifferentFeatureImplementations() throws InterruptedException {\n\n StateRepository repository = new CachingStateRepository(delegate, 0);\n\n // do some lookups\n for (int i = 0; i < 10; i++) {\n Feature feature = (i % 2 == 0) ? DummyFeature.TEST... | {
"fields": [
{
"declarator": "delegate",
"modifier": "private final",
"original_string": "private final StateRepository delegate;",
"type": "StateRepository",
"var_name": "delegate"
},
{
"declarator": "cache = new ConcurrentHashMap<String, CacheEntry>()",
"modifi... | {
"body": "@Override\n public FeatureState getFeatureState(Feature feature) {\n\n // first try to find it from the cache\n CacheEntry entry = cache.get(feature.name());\n if (entry != null && !isExpired(entry)) {\n return entry.getState() != null ? entry.getState().copy() : null;\n ... | {
"created": "12/21/2011 4:49:03 PM +00:00",
"fork": "False",
"fork_count": null,
"is_fork": null,
"language": null,
"license": "licensed",
"repo_id": 3028163,
"size": null,
"stargazer_count": null,
"stars": 570,
"updates": "2020-01-24T21:03:21+00:00",
"url": "https://github.com/togglz/togglz"
} |
9737832_6 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodReferenceAContainingTypeTrickQuestion() {\n List<Integer> numbers = Arrays.asList(2, 4, 5, 1, 9, 15, 19,\n 21, 33, 78, 93, 10);\n System.out.println(Functions.myMap(numbers, Object::toString));\n }",
"class_method_signature": "FunctionsTest.tes... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myMap(List<T> list, MyFunction<T, R> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n result.add(myFunction.apply(t));\n }\n return result;\n }",
"class_method_signature": "Functions.myMap(List<T> list, ... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_7 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testTwoOrMoreItemsInALambda() {\n List<Integer> numbers = Arrays.asList(2, 4, 5, 1, 9, 15, 19,\n 21, 33, 78, 93, 10);\n System.out.println(Functions.myMap(numbers, x -> {\n int y = 100;\n int z = 10;\n return y + z + x;\n ... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myMap(List<T> list, MyFunction<T, R> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n result.add(myFunction.apply(t));\n }\n return result;\n }",
"class_method_signature": "Functions.myMap(List<T> list, ... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_0 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMyFilter() {\n List<Integer> numbers = Arrays.asList(4, 5, 7, 8, 10, 11, 14, 15);\n List<Integer> result = Functions.myFilter(numbers,\n item -> item % 2 == 0);\n assertEquals(Arrays.asList(4, 8, 10, 14), result);\n }",
"class_method_signature... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T> List<T> myFilter(List<T> list, MyPredicate<T> myPredicate) {\n ArrayList<T> result = new ArrayList<>();\n for (T t : list) {\n if (myPredicate.test(t)) result.add(t);\n }\n return result;\n }",
"class_method_signature": "Functions.myFilter(List<... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_10 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMyGenerate() {\n List<LocalDateTime> localDateTimes =\n Functions.myGenerate(() -> {\n try {\n Thread.sleep(1000);\n } catch (InterruptedException e) {\n //Ignore the exception\n ... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T> List<T> myGenerate(MySupplier<T> supplier, int count) {\n List<T> result = new ArrayList<>();\n for (int i = 0; i < count; i++) {\n result.add(supplier.get());\n }\n return result;\n }",
"class_method_signature": "Functions.myGenerate(MySupplier... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_11 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testClosuresAvoidRepeats() {\n List<String> names = Arrays.asList(\"Foo\", \"Ramen\", \"Naan\", \"Ravioli\");\n System.out.println(Functions.myFilter(names, stringHasSizeOf(4)));\n System.out.println(Functions.myFilter(names, stringHasSizeOf(2)));\n }",
"cla... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T> List<T> myFilter(List<T> list, MyPredicate<T> myPredicate) {\n ArrayList<T> result = new ArrayList<>();\n for (T t : list) {\n if (myPredicate.test(t)) result.add(t);\n }\n return result;\n }",
"class_method_signature": "Functions.myFilter(List<... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_1 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMyMap() {\n List<Integer> numbers = Arrays.asList(4, 5, 7, 8);\n List<Integer> mapped = Functions.myMap(numbers, t -> t + 2);\n assertEquals(Arrays.asList(6, 7, 9, 10), mapped);\n }",
"class_method_signature": "FunctionsTest.testMyMap()",
"constructor"... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myMap(List<T> list, MyFunction<T, R> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n result.add(myFunction.apply(t));\n }\n return result;\n }",
"class_method_signature": "Functions.myMap(List<T> list, ... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_2 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMyFlatMap() {\n List<Integer> numbers = Arrays.asList(4, 5, 7, 8);\n List<Integer> mapped = Functions.myFlatMap(numbers,\n t -> List.of(t - 1, t, t + 1));\n assertEquals(Arrays.asList(3, 4, 5, 4, 5, 6, 6, 7, 8, 7, 8, 9), mapped);\n }",
"class_... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myFlatMap(List<T> list, MyFunction<T, List<R>> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n List<R> application = myFunction.apply(t);\n result.addAll(application);\n }\n return result;\n }"... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_3 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMyForEach() {\n List<Integer> numbers = Arrays.asList(4, 5, 7, 8);\n Functions.myForEach(numbers, new MyConsumer<Integer>() {\n @Override\n public void accept(Integer x) {\n System.out.println(x);\n }\n });\n ... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T> void myForEach(List<T> list, MyConsumer<T> myConsumer) {\n for (T t : list) {\n myConsumer.accept(t);\n }\n }",
"class_method_signature": "Functions.myForEach(List<T> list, MyConsumer<T> myConsumer)",
"constructor": false,
"full_signature": "public static... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_4 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodReferenceAStaticMethod() {\n List<Integer> numbers = Arrays.asList(2, 4, 5, 1, 9, 15, 19,\n 21, 33, 78, 93, 10);\n System.out.println(Functions.myMap(numbers, Math::abs));\n }",
"class_method_signature": "FunctionsTest.testMethodReferenceAStati... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myMap(List<T> list, MyFunction<T, R> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n result.add(myFunction.apply(t));\n }\n return result;\n }",
"class_method_signature": "Functions.myMap(List<T> list, ... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_8 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodReferenceAnInstance() {\n List<Integer> numbers = Arrays.asList(2, 4, 5, 1, 9, 15, 19,\n 21, 33, 78, 93, 10);\n TaxRate taxRate2016 = new TaxRate(2016, .085);\n System.out.println(Functions.myMap(numbers, taxRate2016::apply));\n }",
"cla... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myMap(List<T> list, MyFunction<T, R> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n result.add(myFunction.apply(t));\n }\n return result;\n }",
"class_method_signature": "Functions.myMap(List<T> list, ... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_9 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodReferenceANewType() {\n List<Integer> numbers = Arrays.asList(2, 4, 5, 1, 9, 15, 19,\n 21, 33, 78, 93, 10);\n System.out.println(Functions.myMap(numbers, Double::new));\n }",
"class_method_signature": "FunctionsTest.testMethodReferenceANewType(... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myMap(List<T> list, MyFunction<T, R> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n result.add(myFunction.apply(t));\n }\n return result;\n }",
"class_method_signature": "Functions.myMap(List<T> list, ... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
9737832_5 | {
"fields": [],
"file": "java-maven/src/test/java/com/evolutionnext/functions/FunctionsTest.java",
"identifier": "FunctionsTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testMethodReferenceAContainingType() {\n List<String> words = Arrays.asList(\"One\", \"Two\", \"Three\", \"Four\");\n List<Integer> result = Functions.myMap(words, String::length);\n System.out.println(result);\n }",
"class_method_signature": "FunctionsTest.... | {
"fields": [],
"file": "java-maven/src/main/java/com/evolutionnext/functions/Functions.java",
"identifier": "Functions",
"interfaces": "",
"methods": [
{
"class_method_signature": "Functions.myFilter(List<T> list, MyPredicate<T> myPredicate)",
"constructor": false,
"full_signature": "pu... | {
"body": "public static <T, R> List<R> myMap(List<T> list, MyFunction<T, R> myFunction) {\n ArrayList<R> result = new ArrayList<>();\n for (T t : list) {\n result.add(myFunction.apply(t));\n }\n return result;\n }",
"class_method_signature": "Functions.myMap(List<T> list, ... | {
"created": null,
"fork": null,
"fork_count": 5,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 9737832,
"size": 3200,
"stargazer_count": 13,
"stars": null,
"updates": null,
"url": "https://github.com/dhinojosa/language-matrix"
} |
25569063_0 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testCatchException_ObjExc_missingArgument_Exception() {\n\n // test validation of the arguments\n try {\n catchException(() -> list.get(0), null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n ... | {
"fields": [],
"file": "catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java",
"identifier": "CatchException",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchException.caughtException()",
"constructor": false,
"full_signature": "public static... | {
"body": "public static void catchException(com.googlecode.catchexception.ThrowingCallable actor) {\n validateArguments(actor, Exception.class);\n catchException(actor, Exception.class, false);\n }",
"class_method_signature": "CatchException.catchException(com.googlecode.catchexception.ThrowingCal... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_1 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testCatchException_ObjExc_missingArgument_Object() {\n\n try {\n catchException(null, IllegalArgumentException.class);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n assertEquals(\"obj must ... | {
"fields": [],
"file": "catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java",
"identifier": "CatchException",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchException.caughtException()",
"constructor": false,
"full_signature": "public static... | {
"body": "public static void catchException(com.googlecode.catchexception.ThrowingCallable actor) {\n validateArguments(actor, Exception.class);\n catchException(actor, Exception.class, false);\n }",
"class_method_signature": "CatchException.catchException(com.googlecode.catchexception.ThrowingCal... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_10 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testverifyThrowable_Obj_missingArgument_Object() {\n\n // test validation of the arguments\n try {\n verifyThrowable(null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n assertEquals(... | {
"fields": [],
"file": "catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java",
"identifier": "CatchThrowable",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchThrowable.caughtThrowable()",
"constructor": false,
"full_signature": "pub... | {
"body": "public static void verifyThrowable(ThrowingCallable actor) {\n verifyThrowable(actor, Throwable.class);\n }",
"class_method_signature": "CatchThrowable.verifyThrowable(ThrowingCallable actor)",
"constructor": false,
"full_signature": "public static void verifyThrowable(ThrowingCallable acto... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_6 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testCatchException_ObjExc_missingArgument_Exception() {\n\n // test validation of the arguments\n try {\n catchThrowable(list::size, null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n ... | {
"fields": [],
"file": "catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java",
"identifier": "CatchThrowable",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchThrowable.caughtThrowable()",
"constructor": false,
"full_signature": "pub... | {
"body": "public static void catchThrowable(ThrowingCallable actor) {\n validateArguments(actor, Throwable.class);\n catchThrowable(actor, Throwable.class, false);\n }",
"class_method_signature": "CatchThrowable.catchThrowable(ThrowingCallable actor)",
"constructor": false,
"full_signature": "... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_7 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testCatchException_ObjExc_missingArgument_Object() {\n\n try {\n catchThrowable(null, IllegalArgumentException.class);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n assertEquals(\"obj must n... | {
"fields": [],
"file": "catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java",
"identifier": "CatchThrowable",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchThrowable.caughtThrowable()",
"constructor": false,
"full_signature": "pub... | {
"body": "public static void catchThrowable(ThrowingCallable actor) {\n validateArguments(actor, Throwable.class);\n catchThrowable(actor, Throwable.class, false);\n }",
"class_method_signature": "CatchThrowable.catchThrowable(ThrowingCallable actor)",
"constructor": false,
"full_signature": "... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_11 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testCatchException_Obj_missingArgument_Object() {\n\n // test validation of the arguments\n try {\n catchThrowable(null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n assertEquals(\"... | {
"fields": [],
"file": "catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java",
"identifier": "CatchThrowable",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchThrowable.caughtThrowable()",
"constructor": false,
"full_signature": "pub... | {
"body": "public static void catchThrowable(ThrowingCallable actor) {\n validateArguments(actor, Throwable.class);\n catchThrowable(actor, Throwable.class, false);\n }",
"class_method_signature": "CatchThrowable.catchThrowable(ThrowingCallable actor)",
"constructor": false,
"full_signature": "... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_8 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testverifyThrowable_ObjExc_missingArgument_Exception() {\n\n // test validation of the arguments\n try {\n verifyThrowable(list::size, null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n ... | {
"fields": [],
"file": "catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java",
"identifier": "CatchThrowable",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchThrowable.caughtThrowable()",
"constructor": false,
"full_signature": "pub... | {
"body": "public static void verifyThrowable(ThrowingCallable actor) {\n verifyThrowable(actor, Throwable.class);\n }",
"class_method_signature": "CatchThrowable.verifyThrowable(ThrowingCallable actor)",
"constructor": false,
"full_signature": "public static void verifyThrowable(ThrowingCallable acto... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_4 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testVerifyException_Obj_missingArgument_Object()\n {\n\n // test validation of the arguments\n try {\n verifyException(null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n ... | {
"fields": [],
"file": "catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java",
"identifier": "CatchException",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchException.caughtException()",
"constructor": false,
"full_signature": "public static... | {
"body": "public static void verifyException(ThrowingCallable actor) {\n verifyException(actor, Exception.class);\n }",
"class_method_signature": "CatchException.verifyException(ThrowingCallable actor)",
"constructor": false,
"full_signature": "public static void verifyException(ThrowingCallable acto... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_5 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testCatchException_Obj_missingArgument_Object()\n {\n\n // test validation of the arguments\n try {\n catchException(null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n a... | {
"fields": [],
"file": "catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java",
"identifier": "CatchException",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchException.caughtException()",
"constructor": false,
"full_signature": "public static... | {
"body": "public static void catchException(com.googlecode.catchexception.ThrowingCallable actor) {\n validateArguments(actor, Exception.class);\n catchException(actor, Exception.class, false);\n }",
"class_method_signature": "CatchException.catchException(com.googlecode.catchexception.ThrowingCal... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_9 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testverifyThrowable_ObjExc_missingArgument_Object() {\n\n try {\n verifyThrowable(null, IllegalArgumentException.class);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n assertEquals(\"obj must... | {
"fields": [],
"file": "catch-throwable/src/main/java/com/googlecode/catchexception/throwable/CatchThrowable.java",
"identifier": "CatchThrowable",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchThrowable.caughtThrowable()",
"constructor": false,
"full_signature": "pub... | {
"body": "public static void verifyThrowable(ThrowingCallable actor) {\n verifyThrowable(actor, Throwable.class);\n }",
"class_method_signature": "CatchThrowable.verifyThrowable(ThrowingCallable actor)",
"constructor": false,
"full_signature": "public static void verifyThrowable(ThrowingCallable acto... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_2 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testVerifyException_ObjExc_missingArgument_Exception()\n {\n\n // test validation of the arguments\n try {\n verifyException(() -> list.get(0), null);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentEx... | {
"fields": [],
"file": "catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java",
"identifier": "CatchException",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchException.caughtException()",
"constructor": false,
"full_signature": "public static... | {
"body": "public static void verifyException(ThrowingCallable actor) {\n verifyException(actor, Exception.class);\n }",
"class_method_signature": "CatchException.verifyException(ThrowingCallable actor)",
"constructor": false,
"full_signature": "public static void verifyException(ThrowingCallable acto... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
25569063_3 | {
"fields": [
{
"declarator": "list = new ArrayList<>()",
"modifier": "private final",
"original_string": "private final List<String> list = new ArrayList<>();",
"type": "List<String>",
"var_name": "list"
},
{
"declarator": "expectedMessage = \"Index: 0, Size: 0\"",
... | {
"body": "@Test\n public void testVerifyException_ObjExc_missingArgument_Object()\n {\n\n try {\n verifyException(null, IllegalArgumentException.class);\n fail(\"IllegalArgumentException is expected\");\n } catch (IllegalArgumentException e) {\n assertEqu... | {
"fields": [],
"file": "catch-exception/src/main/java/com/googlecode/catchexception/CatchException.java",
"identifier": "CatchException",
"interfaces": "",
"methods": [
{
"class_method_signature": "CatchException.caughtException()",
"constructor": false,
"full_signature": "public static... | {
"body": "public static void verifyException(ThrowingCallable actor) {\n verifyException(actor, Exception.class);\n }",
"class_method_signature": "CatchException.verifyException(ThrowingCallable actor)",
"constructor": false,
"full_signature": "public static void verifyException(ThrowingCallable acto... | {
"created": null,
"fork": null,
"fork_count": 18,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 25569063,
"size": 1115,
"stargazer_count": 134,
"stars": null,
"updates": null,
"url": "https://github.com/Codearte/catch-exception"
} |
20707395_16 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testIsOutside2() {\n Position p = new Position(-10, 110);\n assertTrue(p.isOutside(squareRegion, MIN_DISTANCE_KM));\n }",
"class_method_signature": "PositionTest.testIsOutside2()",
"constructor": false,
"full_signature": "@Test public void testIsOutside2()",
... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public boolean isOutside(List<Position> path, double minDistanceKm) {\n if (isWithin(path))\n return false;\n else {\n double distance = getDistanceToPathKm(path);\n return distance >= minDistanceKm;\n }\n }",
"class_method_signature": "Position.is... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_20 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testLongitudeDiff() {\n assertEquals(10, longitudeDiff(15, 5), PRECISION);\n assertEquals(10, longitudeDiff(-175, 175), PRECISION);\n assertEquals(10, longitudeDiff(175, -175), PRECISION);\n assertEquals(5, longitudeDiff(149, 154), PRECISION);\n }",
"... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public static double longitudeDiff(double a, double b) {\n a = to180(a);\n b = to180(b);\n return Math.abs(to180(a - b));\n }",
"class_method_signature": "Position.longitudeDiff(double a, double b)",
"constructor": false,
"full_signature": "public static double longitudeDiff(d... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_7 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public final void testEnsureContinuous() {\n {\n Position a = new Position(-35, 179);\n Position b = new Position(-35, -178);\n Position c = b.ensureContinuous(a);\n Assert.assertEquals(182, c.getLon(), 0.0001);\n Assert.assertEquals(... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final Position ensureContinuous(Position lastPosition) {\n double lon = this.lon;\n if (abs(lon - lastPosition.lon) > 180) {\n if (lastPosition.lon < 0)\n lon -= 360;\n else\n lon += 360;\n return new Position(lat, lon);\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_6 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test(expected = NullPointerException.class)\n public final void testGetPositionAlongPathExceptionsNull() {\n // Create new position objects\n Position p1 = new Position(36.12, -86.67);\n\n p1.getPositionAlongPath(null, 0.7);\n\n }",
"class_method_signature": "PositionTest.test... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final Position getPositionAlongPath(Position position, double proportion) {\n\n if (proportion >= 0 && proportion <= 1) {\n\n // Get bearing degrees for course\n double courseDegrees = this.getBearingDegrees(position);\n\n // Get distance from position arg and... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_21 | {
"fields": [],
"file": "grumpy-ogc/src/test/java/com/github/davidmoten/grumpy/wms/RendererUtilTest.java",
"identifier": "RendererUtilTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetCircle() {\n ProjectorTarget target = new ProjectorTarget(300, 200);\n // 14288114.828624,-6061227.593083,18907357.32131,-2348222.5076192\n ProjectorBounds bounds = new ProjectorBounds(\"EPSG:3857\", 14288114.828624, -6061227.593083, 18907357.32131,\n ... | {
"fields": [],
"file": "grumpy-ogc/src/main/java/com/github/davidmoten/grumpy/wms/RendererUtil.java",
"identifier": "RendererUtil",
"interfaces": "",
"methods": [
{
"class_method_signature": "RendererUtil.useAntialiasing(Graphics2D g)",
"constructor": false,
"full_signature": "public st... | {
"body": "public static List<Position> getCircle(Position position, double radiusKm, double numPoints) {\n\n List<Position> positions = new ArrayList<Position>();\n for (int i = 0; i < numPoints; i++) {\n double bearing = 360.0 * i / numPoints;\n Position p = position.predict(radi... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_17 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testIsOutside3() {\n Position p = new Position(20.07030897931526, 24.999999999999996);\n assertFalse(p.isOutside(squareRegion, MIN_DISTANCE_KM));\n }",
"class_method_signature": "PositionTest.testIsOutside3()",
"constructor": false,
"full_signature": "@Test pub... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public boolean isOutside(List<Position> path, double minDistanceKm) {\n if (isWithin(path))\n return false;\n else {\n double distance = getDistanceToPathKm(path);\n return distance >= minDistanceKm;\n }\n }",
"class_method_signature": "Position.is... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_1 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public final void testDistance() {\n\n Position p1 = new Position(36.12, -86.67);\n Position p2 = new Position(33.94, -118.4);\n Assert.assertEquals(2886.45, p1.getDistanceToKm(p2), 0.01);\n }",
"class_method_signature": "PositionTest.testDistance()",
"constructor": f... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final double getDistanceToKm(Position position) {\n double lat1 = toRadians(lat);\n double lat2 = toRadians(position.lat);\n double lon1 = toRadians(lon);\n double lon2 = toRadians(position.lon);\n double deltaLon = lon2 - lon1;\n double cosLat2 = cos(lat2);... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_10 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testGetDistanceToPathKm2() {\n // positions to test\n Position p = new Position(-10, 80);\n\n // segment positions constituting a path\n Position sp1 = new Position(-30, 100);\n Position sp2 = new Position(-20, 120);\n Position sp3 = new Posi... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final double getDistanceToPathKm(List<Position> positions) {\n if (positions.size() == 0)\n throw new RuntimeException(\"positions must not be empty\");\n else if (positions.size() == 1)\n return this.getDistanceToKm(positions.get(0));\n else {\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_11 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testGetDistanceToPathKm4() {\n // positions to test\n Position p = new Position(-10, 150);\n\n // segment positions constituting a path\n Position sp1 = new Position(-30, 100);\n Position sp2 = new Position(-20, 120);\n Position sp3 = new Pos... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final double getDistanceToPathKm(List<Position> positions) {\n if (positions.size() == 0)\n throw new RuntimeException(\"positions must not be empty\");\n else if (positions.size() == 1)\n return this.getDistanceToKm(positions.get(0));\n else {\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_0 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public final void testPredict() {\n Position p = new Position(53, 3);\n Position p2 = p.predict(100, 30);\n Assert.assertEquals(53.77644258276322, p2.getLat(), 0.01);\n Assert.assertEquals(3.7609191005595877, p2.getLon(), 0.01);\n\n // large distance tests arou... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final Position predict(double distanceKm, double courseDegrees) {\n assertWithMsg(alt == 0.0, \"Predictions only valid for Earth's surface\");\n double dr = distanceKm / EARTH_RADIUS_KM;\n double latR = toRadians(lat);\n double lonR = toRadians(lon);\n double cours... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_3 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public final void testGetPositionAlongPath() {\n\n // Create new position objects\n Position p1 = new Position(36.12, -86.67);\n Position p2 = new Position(33.94, -118.4);\n\n {\n double distanceKm = p1.getDistanceToKm(p2);\n double bearingDegree... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final Position getPositionAlongPath(Position position, double proportion) {\n\n if (proportion >= 0 && proportion <= 1) {\n\n // Get bearing degrees for course\n double courseDegrees = this.getBearingDegrees(position);\n\n // Get distance from position arg and... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_12 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test(expected = RuntimeException.class)\n public void testGetDistanceToPathKm5() {\n // empty initialized list\n List<Position> path = new ArrayList<Position>();\n\n // positions to test\n Position p = new Position(-10, 150);\n\n p.getDistanceToPathKm(path);\n\n }"... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final double getDistanceToPathKm(List<Position> positions) {\n if (positions.size() == 0)\n throw new RuntimeException(\"positions must not be empty\");\n else if (positions.size() == 1)\n return this.getDistanceToKm(positions.get(0));\n else {\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_13 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test(expected = NullPointerException.class)\n public void testGetDistanceToPathKm6() {\n // empty initialized list\n List<Position> path = null;\n\n // positions to test\n Position p = new Position(-10, 150);\n\n p.getDistanceToPathKm(path);\n\n }",
"class_method... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final double getDistanceToPathKm(List<Position> positions) {\n if (positions.size() == 0)\n throw new RuntimeException(\"positions must not be empty\");\n else if (positions.size() == 1)\n return this.getDistanceToKm(positions.get(0));\n else {\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_2 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public final void testBearingDifference() {\n double precision = 0.00001;\n Assert.assertEquals(15.0, Position.getBearingDifferenceDegrees(20, 5), precision);\n Assert.assertEquals(15.0, Position.getBearingDifferenceDegrees(20, 365), precision);\n Assert.assertEquals(... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public static double getBearingDifferenceDegrees(double bearing1, double bearing2) {\n if (bearing1 < 0)\n bearing1 += 360;\n if (bearing2 > 180)\n bearing2 -= 360;\n double result = bearing1 - bearing2;\n if (result > 180)\n result -= 360;\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_9 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testGetDistanceToSegmentKm4() {\n Position p = new Position(-10, 150);\n\n // Segment made of two points\n Position sp1 = new Position(-20, 120);\n Position sp2 = new Position(-20, 120);\n\n double r = p.getDistanceToSegmentKm(sp1, sp2);\n lo... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final double getDistanceToSegmentKm(Position p1, Position p2) {\n return getDistanceToKm(getClosestIntersectionWithSegment(p1, p2));\n }",
"class_method_signature": "Position.getDistanceToSegmentKm(Position p1, Position p2)",
"constructor": false,
"full_signature": "public final doub... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_14 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testGetDistanceToPathKm7() {\n // empty initialized list\n List<Position> path = new ArrayList<Position>();\n path.add(new Position(-30, 100));\n\n // positions to test\n Position p = new Position(-30, 120);\n\n double r = p.getDistanceToPath... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final double getDistanceToPathKm(List<Position> positions) {\n if (positions.size() == 0)\n throw new RuntimeException(\"positions must not be empty\");\n else if (positions.size() == 1)\n return this.getDistanceToKm(positions.get(0));\n else {\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_5 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test(expected = RuntimeException.class)\n public final void testGetPositionAlongPathExceptionsLess() {\n // Create new position objects\n Position p1 = new Position(36.12, -86.67);\n Position p2 = new Position(33.94, -118.4);\n\n p1.getPositionAlongPath(p2, -0.1);\n }",
... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final Position getPositionAlongPath(Position position, double proportion) {\n\n if (proportion >= 0 && proportion <= 1) {\n\n // Get bearing degrees for course\n double courseDegrees = this.getBearingDegrees(position);\n\n // Get distance from position arg and... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_18 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testIsOutside4() {\n Position p = new Position(30, 30);\n assertFalse(p.isOutside(squareRegion, MIN_DISTANCE_KM));\n }",
"class_method_signature": "PositionTest.testIsOutside4()",
"constructor": false,
"full_signature": "@Test public void testIsOutside4()",
"... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public boolean isOutside(List<Position> path, double minDistanceKm) {\n if (isWithin(path))\n return false;\n else {\n double distance = getDistanceToPathKm(path);\n return distance >= minDistanceKm;\n }\n }",
"class_method_signature": "Position.is... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_19 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testTo180() {\n assertEquals(0, to180(0), PRECISION);\n assertEquals(10, to180(10), PRECISION);\n assertEquals(-10, to180(-10), PRECISION);\n assertEquals(180, to180(180), PRECISION);\n assertEquals(-180, to180(-180), PRECISION);\n assertEqua... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public static double to180(double d) {\n if (d < 0)\n return -to180(abs(d));\n else {\n if (d > 180) {\n long n = round(floor((d + 180) / 360.0));\n return d - n * 360;\n } else\n return d;\n }\n }",
"cl... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_4 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test(expected = RuntimeException.class)\n public final void testGetPositionAlongPathExceptionsGreater() {\n // Create new position objects\n Position p1 = new Position(36.12, -86.67);\n Position p2 = new Position(33.94, -118.4);\n\n p1.getPositionAlongPath(p2, 1.1);\n\n }... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final Position getPositionAlongPath(Position position, double proportion) {\n\n if (proportion >= 0 && proportion <= 1) {\n\n // Get bearing degrees for course\n double courseDegrees = this.getBearingDegrees(position);\n\n // Get distance from position arg and... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_15 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public void testIsOutside1() {\n Position p = new Position(30, 19.99);\n\n assertFalse(p.isOutside(squareRegion, MIN_DISTANCE_KM));\n }",
"class_method_signature": "PositionTest.testIsOutside1()",
"constructor": false,
"full_signature": "@Test public void testIsOutside1()"... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public boolean isOutside(List<Position> path, double minDistanceKm) {\n if (isWithin(path))\n return false;\n else {\n double distance = getDistanceToPathKm(path);\n return distance >= minDistanceKm;\n }\n }",
"class_method_signature": "Position.is... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
20707395_8 | {
"fields": [
{
"declarator": "ACCEPTABLE_DISTANCE_PRECISION = 3",
"modifier": "private static final",
"original_string": "private static final int ACCEPTABLE_DISTANCE_PRECISION = 3;",
"type": "int",
"var_name": "ACCEPTABLE_DISTANCE_PRECISION"
},
{
"declarator": "PRECIS... | {
"body": "@Test\n public final void testIsWithin() {\n final List<Position> testRegion;\n // square polygon with v cut out shape\n testRegion = new ArrayList<Position>();\n testRegion.add(new Position(-20, 130));\n testRegion.add(new Position(-20, 140));\n testRegion.add(... | {
"fields": [
{
"declarator": "DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25",
"modifier": "private static final",
"original_string": "private static final double DEFAULT_INTERPOLATION_LONGITUDE_THRESHOLD = 0.25;",
"type": "double",
"var_name": "DEFAULT_INTERPOLATION_LONGITUDE_THR... | {
"body": "public final boolean isWithin(List<Position> positions) {\n Polygon polygon = new Polygon();\n for (Position p : positions) {\n polygon.addPoint(degreesToArbitraryInteger(p.lon), degreesToArbitraryInteger(p.lat));\n }\n int x = degreesToArbitraryInteger(this.lon);\n ... | {
"created": null,
"fork": null,
"fork_count": 7,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 20707395,
"size": 1358,
"stargazer_count": 16,
"stars": null,
"updates": null,
"url": "https://github.com/davidmoten/grumpy"
} |
1554165_2 | {
"fields": [
{
"declarator": "mpi",
"modifier": "static",
"original_string": "static Mpi mpi;",
"type": "Mpi",
"var_name": "mpi"
},
{
"declarator": "SIMPLE_DATE_TIME_FORMAT = new SimpleDateFormat(\"yyyy-MM-dd\")",
"modifier": "private static final",
"origin... | {
"body": "@Ignore\n @Test\n public void testModifyPerson() {\n MpiTest.logger.fine(\"testModifyPerson\");\n\n int requestTypeId;\n PersonRequest requestData = new PersonRequest();\n Person p;\n List<Person> pList;\n int pCount;\n Object result;\n PersonRe... | {
"fields": [
{
"declarator": "siteList = new SiteList()",
"modifier": "private",
"original_string": "private SiteList siteList = new SiteList();",
"type": "SiteList",
"var_name": "siteList"
},
{
"declarator": "personList = null",
"modifier": "private",
"ori... | {
"body": "public synchronized Object getData(int requestTypeId, Object requestData) {\n Object returnData = null;\n switch (requestTypeId) {\n case RequestTypeId.FIND_PERSON_MPI:\n case RequestTypeId.FIND_PERSON_LPI:\n Mediator.getLogger(Mpi.class.getName()).log(Lev... | {
"created": null,
"fork": null,
"fork_count": 21,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 1554165,
"size": 10519,
"stargazer_count": 23,
"stars": null,
"updates": null,
"url": "https://github.com/I-TECH/OpenEMRConnect"
} |
1554165_0 | {
"fields": [],
"file": "mpi/src/test/java/ke/go/moh/oec/mpi/ValueMapTest.java",
"identifier": "ValueMapTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetDb() {\n System.out.println(\"getDb\");\n ValueMap instance = ValueMap.FINGERPRINT_TYPE;\n HashMap<Enum, String> result = instance.getDb();\n assertNotNull(result);\n String dbValue = result.get(Fingerprint.Type.leftIndexFinger);\n ass... | {
"fields": [
{
"declarator": "db = new HashMap<Enum, String>()",
"modifier": "private",
"original_string": "private HashMap<Enum, String> db = new HashMap<Enum, String>();",
"type": "HashMap<Enum, String>",
"var_name": "db"
},
{
"declarator": "val = new HashMap<String,... | {
"body": "public HashMap<Enum, String> getDb() {\n return db;\n }",
"class_method_signature": "ValueMap.getDb()",
"constructor": false,
"full_signature": "public HashMap<Enum, String> getDb()",
"identifier": "getDb",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return": "H... | {
"created": null,
"fork": null,
"fork_count": 21,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 1554165,
"size": 10519,
"stargazer_count": 23,
"stars": null,
"updates": null,
"url": "https://github.com/I-TECH/OpenEMRConnect"
} |
1554165_1 | {
"fields": [],
"file": "mpi/src/test/java/ke/go/moh/oec/mpi/ValueMapTest.java",
"identifier": "ValueMapTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void testGetVal() {\n System.out.println(\"getVal\");\n ValueMap instance = ValueMap.CONSENT_SIGNED;\n HashMap expResult = null;\n HashMap<String, Enum> result = instance.getVal();\n assertNotNull(result);\n Enum enumVal = result.get(\"0\");\n ... | {
"fields": [
{
"declarator": "db = new HashMap<Enum, String>()",
"modifier": "private",
"original_string": "private HashMap<Enum, String> db = new HashMap<Enum, String>();",
"type": "HashMap<Enum, String>",
"var_name": "db"
},
{
"declarator": "val = new HashMap<String,... | {
"body": "public HashMap<String, Enum> getVal() {\n return val;\n }",
"class_method_signature": "ValueMap.getVal()",
"constructor": false,
"full_signature": "public HashMap<String, Enum> getVal()",
"identifier": "getVal",
"invocations": [],
"modifiers": "public",
"parameters": "()",
"return... | {
"created": null,
"fork": null,
"fork_count": 21,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 1554165,
"size": 10519,
"stargazer_count": 23,
"stars": null,
"updates": null,
"url": "https://github.com/I-TECH/OpenEMRConnect"
} |
14305692_146 | {
"fields": [
{
"declarator": "chargePointService",
"modifier": "private",
"original_string": "private ChargePointService chargePointService;",
"type": "ChargePointService",
"var_name": "chargePointService"
},
{
"declarator": "client",
"modifier": "private",
... | {
"body": "@Test\n public void stopTransactionRejectedVerifyReturnValue() {\n when(chargePointService.remoteStopTransaction(any(RemoteStopTransactionRequest.class), anyString())).thenReturn(getRemoteStopTransactionResponse(RemoteStartStopStatus.REJECTED));\n\n boolean willTransactionStop = client.sto... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(ChargingStationOcpp15SoapClient.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(ChargingStationOcpp15SoapClient.class);",
"type": "Logger",
"var_nam... | {
"body": "@Override\n public boolean stopTransaction(ChargingStationId id, int transactionId) {\n LOG.debug(\"Stopping transaction {} on {}\", transactionId, id);\n\n ChargePointService chargePointService = this.createChargingStationService(id);\n\n RemoteStopTransactionRequest request = new ... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_453 | {
"fields": [
{
"declarator": "commandAuthorizationEventHandler",
"modifier": "private",
"original_string": "private CommandAuthorizationEventHandler commandAuthorizationEventHandler;",
"type": "CommandAuthorizationEventHandler",
"var_name": "commandAuthorizationEventHandler"
},
... | {
"body": "@Test\n public void handlePermissionRevokedEvent() {\n commandAuthorizationEventHandler.handle(new PermissionRevokedEvent(CHARGING_STATION_ID, USER_IDENTITY, COMMAND_CLASS, IDENTITY_CONTEXT));\n\n verify(commandAuthorizationRepository).remove(CHARGING_STATION_ID.getId(), USER_IDENTITY.getI... | {
"fields": [
{
"declarator": "commandAuthorizationRepository",
"modifier": "private",
"original_string": "private CommandAuthorizationRepository commandAuthorizationRepository;",
"type": "CommandAuthorizationRepository",
"var_name": "commandAuthorizationRepository"
}
],
"fil... | {
"body": "@EventHandler\n public void handle(ChargingStationCreatedEvent event) {\n for (UserIdentity userIdentity : event.getUserIdentitiesWithAllPermissions()) {\n commandAuthorizationRepository.createOrUpdate(event.getChargingStationId().getId(), userIdentity.getId(), AllPermissions.class);\n... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_280 | {
"fields": [
{
"declarator": "service",
"modifier": "private",
"original_string": "private MotownVasPublisherService service;",
"type": "MotownVasPublisherService",
"var_name": "service"
},
{
"declarator": "chargingStationRepository",
"modifier": "@Autowired\n ... | {
"body": "@Test\n public void getChargePointInfoSubscriptionValidateResponse() {\n subscribeTestSubscriber();\n chargingStationRepository.createOrUpdate(new ChargingStation(CHARGING_STATION_ID.getId()));\n chargingStationRepository.createOrUpdate(new ChargingStation(\"SECOND_CS\"));\n ... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(MotownVasPublisherService.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(MotownVasPublisherService.class);",
"type": "Logger",
"var_name": "LOG"
... | {
"body": "@Override\n public GetChargePointInfoResponse getChargePointInfo(@WebParam(partName = \"parameters\", name = \"getChargePointInfoRequest\", targetNamespace = VAS_NAMESPACE) GetChargePointInfoRequest parameters, @WebParam(partName = \"SubscriberIdentity\", name = \"subscriberIdentity\", targetNamespace =... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_48 | {
"fields": [
{
"declarator": "VENDOR = \"MOTOWN\"",
"modifier": "public static final",
"original_string": "public static final String VENDOR = \"MOTOWN\";",
"type": "String",
"var_name": "VENDOR"
},
{
"declarator": "MODEL = \"MODEL1\"",
"modifier": "public static... | {
"body": "@Test\n public void deleteEvse() {\n ChargingStationType chargingStationType = getChargingStationTypeNonTransient(entityManagerFactory);\n Long evseId = Iterables.get(chargingStationType.getEvses(), 0).getId();\n\n domainService.deleteEvse(chargingStationType.getId(), evseId);\n ... | {
"fields": [
{
"declarator": "chargingStationTypeRepository",
"modifier": "private",
"original_string": "private ChargingStationTypeRepository chargingStationTypeRepository;",
"type": "ChargingStationTypeRepository",
"var_name": "chargingStationTypeRepository"
},
{
"de... | {
"body": "public void deleteEvse(Long chargingStationTypeId, Long id) {\n ChargingStationType chargingStationType = chargingStationTypeRepository.findOne(chargingStationTypeId);\n\n chargingStationType.getEvses().remove(getEvseById(chargingStationType, id));\n\n updateChargingStationType(chargin... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_111 | {
"fields": [],
"file": "ocpp/soap-utils/src/test/java/io/motown/ocpp/utils/soap/async/AuthorizationFutureEventCallbackTest.java",
"identifier": "AuthorizationFutureEventCallbackTest",
"interfaces": "",
"superclass": ""
} | {
"body": "@Test\n public void onEventInvalidEventNoExceptions() {\n AuthorizationFutureEventCallback callback = new AuthorizationFutureEventCallback();\n EventMessage eventMessage = asEventMessage(new AuthorizationRequestedEvent(CHARGING_STATION_ID, IDENTIFYING_TOKEN, NULL_USER_IDENTITY_CONTEXT));\n... | {
"fields": [
{
"declarator": "continuation",
"modifier": "private",
"original_string": "private Continuation continuation;",
"type": "Continuation",
"var_name": "continuation"
}
],
"file": "ocpp/soap-utils/src/main/java/io/motown/ocpp/utils/soap/async/AuthorizationFutureEven... | {
"body": "@Override\n public boolean onEvent(EventMessage<?> event) {\n AuthorizationResultEvent resultEvent;\n\n if (event.getPayload() instanceof AuthorizationResultEvent) {\n resultEvent = (AuthorizationResultEvent) event.getPayload();\n\n this.setResult(new AuthorizationRes... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_404 | {
"fields": [
{
"declarator": "MOCK_OBJECT_JSON = \"{\\\"name\\\":\\\"TEST\\\",\\\"age\\\":1}\"",
"modifier": "private static final",
"original_string": "private static final String MOCK_OBJECT_JSON = \"{\\\"name\\\":\\\"TEST\\\",\\\"age\\\":1}\";",
"type": "String",
"var_name": "MOC... | {
"body": "@Test\n public void testGetSize() {\n assertEquals(-1, provider.getSize(new MockObject(), MockObject.class, MockObject.class.getGenericSuperclass(), new Annotation[]{}, MediaType.APPLICATION_JSON_TYPE));\n }",
"class_method_signature": "GsonMessageBodyWriterTest.testGetSize()",
"constructo... | {
"fields": [
{
"declarator": "UTF_8 = \"UTF-8\"",
"modifier": "private static final",
"original_string": "private static final String UTF_8 = \"UTF-8\";",
"type": "String",
"var_name": "UTF_8"
},
{
"declarator": "gson",
"modifier": "private",
"original_stri... | {
"body": "@Override\n public long getSize(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType) {\n return -1;\n }",
"class_method_signature": "GsonMessageBodyWriter.getSize(Object src, Class<?> aClass, Type type, Annotation[] annotations, MediaType mediaType)",
"con... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_392 | {
"fields": [
{
"declarator": "gson",
"modifier": "private",
"original_string": "private Gson gson;",
"type": "Gson",
"var_name": "gson"
},
{
"declarator": "handler = new PlaceChargingStationJsonCommandHandler()",
"modifier": "private",
"original_string": "p... | {
"body": "@Test(expected = NumberFormatException.class)\n public void testInvalidCoordinatesNumber() throws UserIdentityUnauthorizedException {\n JsonObject commandObject = gson.fromJson(\"{coordinates:{latitude:'center',longitude:'0.0'},accessibility:'PUBLIC'}\", JsonObject.class);\n handler.handle... | {
"fields": [
{
"declarator": "COMMAND_NAME = \"PlaceChargingStation\"",
"modifier": "private static final",
"original_string": "private static final String COMMAND_NAME = \"PlaceChargingStation\";",
"type": "String",
"var_name": "COMMAND_NAME"
}
],
"file": "operator-api/json... | {
"body": "@Override\n public void handle(String chargingStationId, JsonObject commandObject, IdentityContext identityContext) throws UserIdentityUnauthorizedException {\n ChargingStationId csId = new ChargingStationId(chargingStationId);\n\n if (!commandAuthorizationService.isAuthorized(csId, identi... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_238 | {
"fields": [
{
"declarator": "gson = new Gson()",
"modifier": "private",
"original_string": "private Gson gson = new Gson();",
"type": "Gson",
"var_name": "gson"
}
],
"file": "ocpp/websocket-json/src/test/java/io/motown/ocpp/websocketjson/WebSocketWrapperTest.java",
"ident... | {
"body": "@Test\n public void isOpenShouldReturnWebSocketStatus() {\n WebSocket mockWebSocket = getMockWebSocket();\n WebSocketWrapper wrapper = new WebSocketWrapper(CHARGING_STATION_ID, mockWebSocket, mock(WampMessageHandler.class), gson);\n\n when(mockWebSocket.isOpen()).thenReturn(false);\... | {
"fields": [
{
"declarator": "LOG = LoggerFactory.getLogger(WebSocketWrapper.class)",
"modifier": "private static final",
"original_string": "private static final Logger LOG = LoggerFactory.getLogger(WebSocketWrapper.class);",
"type": "Logger",
"var_name": "LOG"
},
{
"... | {
"body": "public boolean isOpen() {\n return webSocket != null && webSocket.isOpen();\n }",
"class_method_signature": "WebSocketWrapper.isOpen()",
"constructor": false,
"full_signature": "public boolean isOpen()",
"identifier": "isOpen",
"invocations": [
"isOpen"
],
"modifiers": "public",... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_107 | {
"fields": [
{
"declarator": "requestHandler",
"modifier": "private",
"original_string": "private Ocpp12RequestHandler requestHandler;",
"type": "Ocpp12RequestHandler",
"var_name": "requestHandler"
},
{
"declarator": "client",
"modifier": "private",
"origin... | {
"body": "@Test\n public void testChangeConfigurationServiceShouldNotBeCalledIfClientReturnsFalse() {\n when(client.changeConfiguration(CHARGING_STATION_ID, CONFIGURATION_ITEM)).thenReturn(false);\n\n requestHandler.handle(new ChangeConfigurationItemRequestedEvent(CHARGING_STATION_ID, PROTOCOL, CONF... | {
"fields": [
{
"declarator": "ADD_ON_TYPE = \"OCPPS12\"",
"modifier": "public static final",
"original_string": "public static final String ADD_ON_TYPE = \"OCPPS12\";",
"type": "String",
"var_name": "ADD_ON_TYPE"
},
{
"declarator": "LOG = LoggerFactory.getLogger(Ocpp12... | {
"body": "@Override\n public void handle(ConfigurationItemsRequestedEvent event) {\n throw new UnsupportedOperationException(\"GetConfigurationItems not supported in OCPP/S 1.2\");\n }",
"class_method_signature": "Ocpp12RequestHandler.handle(ConfigurationItemsRequestedEvent event)",
"constructor": f... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_412 | {
"fields": [
{
"declarator": "adapter = new OpeningTimeTypeAdapterDeserializer()",
"modifier": "private final",
"original_string": "private final OpeningTimeTypeAdapterDeserializer adapter = new OpeningTimeTypeAdapterDeserializer();",
"type": "OpeningTimeTypeAdapterDeserializer",
"v... | {
"body": "@Test(expected = JsonParseException.class)\n public void testOpeningTimeAsJsonPrimitive() {\n JsonPrimitive jsonPrimitive = new JsonPrimitive(\"12:00\");\n adapter.deserialize(jsonPrimitive, OpeningTime.class, null);\n }",
"class_method_signature": "OpeningTimeTypeAdapterDeserializerT... | {
"fields": [
{
"declarator": "TIME_OF_DAY = Pattern.compile(\"^([01]?[0-9]|2[0-3]):([0-5][0-9])$\")",
"modifier": "private static final",
"original_string": "private static final Pattern TIME_OF_DAY = Pattern.compile(\"^([01]?[0-9]|2[0-3]):([0-5][0-9])$\");",
"type": "Pattern",
"var... | {
"body": "@Override\n public OpeningTime deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext jsonDeserializationContext) {\n JsonObject obj;\n\n try {\n obj = jsonElement.getAsJsonObject();\n if (obj == null) {\n return null;\n }... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
14305692_4 | {
"fields": [
{
"declarator": "NUMBER_OF_EVSES = 3",
"modifier": "public static final",
"original_string": "public static final int NUMBER_OF_EVSES = 3;",
"type": "int",
"var_name": "NUMBER_OF_EVSES"
},
{
"declarator": "eventListener",
"modifier": "private",
... | {
"body": "@Test\n public void testConfigurationFound() {\n String manufacturer = \"MOTOWN\";\n String model = \"MODEL1\";\n IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity());\n when(domainService.getEvses(manufacturer, model)).thenReturn(getEv... | {
"fields": [
{
"declarator": "ADD_ON_TYPE = \"CHARGINGSTATION-CONFIGURATION\"",
"modifier": "public static final",
"original_string": "public static final String ADD_ON_TYPE = \"CHARGINGSTATION-CONFIGURATION\";",
"type": "String",
"var_name": "ADD_ON_TYPE"
},
{
"declar... | {
"body": "@EventHandler\n protected void onEvent(UnconfiguredChargingStationBootedEvent event) {\n LOG.info(\"Handling UnconfiguredChargingStationBootedEvent\");\n\n Map<String, String> attributes = event.getAttributes();\n Set<Evse> evses = domainService.getEvses(attributes.get(AttributeMapK... | {
"created": null,
"fork": null,
"fork_count": 11,
"is_fork": false,
"language": "Java",
"license": "licensed",
"repo_id": 14305692,
"size": 4944,
"stargazer_count": 37,
"stars": null,
"updates": null,
"url": "https://github.com/motown-io/motown"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.