id
stringlengths
7
14
test_class
dict
test_case
dict
focal_class
dict
focal_method
dict
repository
dict
128393918_336
{ "fields": [ { "declarator": "ROWS = Arrays.asList(\n new Bean(0),\n new Bean(0),\n new Bean(0)\n )", "modifier": "private static final", "original_string": "private static final List<Bean> ROWS = Arrays.asList(\n new Bean(0),\n new Bean(0),\n new Be...
{ "body": "@Test\n public void buildSequenceFromCount_Contents() {\n int n = 100;\n VertexLabel vertexName = new VertexLabel(\"vertexName\");\n Sequence sequence = new SequenceBuilder<>()\n .count(n)\n .withFactory((item) -> item.add(vertexName, new BernoulliVertex(0.5)))...
{ "fields": [ { "declarator": "PROXY_LABEL_MARKER = \"proxy_for\"", "modifier": "private static final", "original_string": "private static final String PROXY_LABEL_MARKER = \"proxy_for\";", "type": "String", "var_name": "PROXY_LABEL_MARKER" }, { "declarator": "initialSt...
{ "body": "public FromCount count(int count) {\n return new FromCount(count, initialState);\n }", "class_method_signature": "SequenceBuilder.count(int count)", "constructor": false, "full_signature": "public FromCount count(int count)", "identifier": "count", "invocations": [], "modifiers": "pub...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_22
{ "fields": [ { "declarator": "scalar1 = new long[0]", "modifier": "private", "original_string": "private long[] scalar1 = new long[0];", "type": "long[]", "var_name": "scalar1" }, { "declarator": "scalar2 = new long[0]", "modifier": "private", "original_str...
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void rejectsMoreThanSingleNonScalarParent() {\n TensorShapeValidation.checkTensorsMatchNonLengthOneShapeOrAreLengthOne(new long[]{2, 2}, twoByTwo1, twoByThree);\n }", "class_method_signature": "TensorShapeValidationTest.rejectsMoreTha...
{ "fields": [], "file": "keanu-project/src/main/java/io/improbable/keanu/tensor/TensorShapeValidation.java", "identifier": "TensorShapeValidation", "interfaces": "", "methods": [ { "class_method_signature": "TensorShapeValidation.TensorShapeValidation()", "constructor": true, "full_signa...
{ "body": "public static void checkTensorsMatchNonLengthOneShapeOrAreLengthOne(long[] proposalShape, long[]... shapes) {\n\n Set<TensorShape> nonLengthOneShapes = getNonLengthOneShapes(shapes);\n\n if (!nonLengthOneShapes.isEmpty()) {\n\n boolean moreThanOneNonLengthOneShape = nonLengthOneSha...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_273
{ "fields": [ { "declarator": "AReference", "modifier": "private", "original_string": "private VariableReference AReference;", "type": "VariableReference", "var_name": "AReference" }, { "declarator": "BReference", "modifier": "private", "original_string": "p...
{ "body": "@Test\n public void canDotProductTwoMapsOfValues() {\n\n double result = VariableValues.dotProduct(left, right);\n\n double expected = 1 * 5 + 2 * 6 + 3 * 7 + 4 * 8;\n\n assertEquals(expected, result, 1e-6);\n }", "class_method_signature": "VariableValuesTest.canDotProductTwoMa...
{ "fields": [], "file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/mcmc/nuts/VariableValues.java", "identifier": "VariableValues", "interfaces": "", "methods": [ { "class_method_signature": "VariableValues.VariableValues()", "constructor": true, "full_signature": "privat...
{ "body": "public static double dotProduct(Map<? extends VariableReference, DoubleTensor> left, Map<? extends VariableReference, DoubleTensor> right) {\n double dotProduct = 0.0;\n for (VariableReference v : left.keySet()) {\n dotProduct += left.get(v).times(right.get(v)).sumNumber();\n ...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_224
{ "fields": [ { "declarator": "rule = new DeterministicRule()", "modifier": "@Rule\n public", "original_string": "@Rule\n public DeterministicRule rule = new DeterministicRule();", "type": "DeterministicRule", "var_name": "rule" }, { "declarator": "thrown = Expect...
{ "body": "@Test\n public void whenKNEqualsOneItsCategorical() {\n IntegerTensor n = IntegerTensor.scalar(1);\n DoubleTensor p = DoubleTensor.create(0.2, .3, 0.5);\n DiscreteDistribution multinomial = Multinomial.withParameters(n, p);\n\n Map<Color, DoubleVertex> selectableValues = Immu...
{ "fields": [ { "declarator": "p", "modifier": "private final", "original_string": "private final DoubleVertex p;", "type": "DoubleVertex", "var_name": "p" }, { "declarator": "n", "modifier": "private final", "original_string": "private final IntegerVertex n...
{ "body": "@Override\n public double logProb(IntegerTensor x) {\n return Multinomial.withParameters(n.getValue(), p.getValue(), validationEnabled).logProb(x).sumNumber();\n }", "class_method_signature": "MultinomialVertex.logProb(IntegerTensor x)", "constructor": false, "full_signature": "@Override...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_75
{ "fields": [ { "declarator": "samples", "modifier": "private", "original_string": "private NetworkSamples samples;", "type": "NetworkSamples", "var_name": "samples" }, { "declarator": "rowTensors = new ArrayList<>()", "modifier": "private", "original_string...
{ "body": "@Test\n public void writeRowOfScalarsToCsvWithHeader() throws IOException {\n File file = WriteCsv.asColumns(scalarTensors).withDefaultHeader().toFile(File.createTempFile(\"test\", \".csv\"));\n\n CsvReader reader = ReadCsv.fromFile(file).expectHeader(true);\n List<List<String>> lin...
{ "fields": [], "file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/WriteCsv.java", "identifier": "WriteCsv", "interfaces": "", "methods": [ { "class_method_signature": "WriteCsv.asSamples(NetworkSamples samples, List<? extends Vertex<? extends Tensor, ?>> vertices)", "constructo...
{ "body": "public static ColumnWriter asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices) {\n return new ColumnWriter(vertices);\n }", "class_method_signature": "WriteCsv.asColumns(List<? extends Vertex<? extends Tensor, ?>> vertices)", "constructor": false, "full_signature": "public stati...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_63
{ "fields": [ { "declarator": "csv = \"a,b,c\\nhel,lo,world\"", "modifier": "", "original_string": "String csv = \"a,b,c\\nhel,lo,world\";", "type": "String", "var_name": "csv" } ], "file": "keanu-project/src/test/java/io/improbable/keanu/util/csv/ReadCsvTest.java", "identi...
{ "body": "@Test\n public void canReadFromResource() {\n canRead(ReadCsv.fromResources(\"data/simple_data.csv\"));\n }", "class_method_signature": "ReadCsvTest.canReadFromResource()", "constructor": false, "full_signature": "@Test public void canReadFromResource()", "identifier": "canReadFromReso...
{ "fields": [], "file": "keanu-project/src/main/java/io/improbable/keanu/util/csv/ReadCsv.java", "identifier": "ReadCsv", "interfaces": "", "methods": [ { "class_method_signature": "ReadCsv.ReadCsv()", "constructor": true, "full_signature": "private ReadCsv()", "identifier": "Read...
{ "body": "public static CsvReader fromResources(String fileOnClassPath) {\n return new CsvReader(() -> getFileFromResources(fileOnClassPath));\n }", "class_method_signature": "ReadCsv.fromResources(String fileOnClassPath)", "constructor": false, "full_signature": "public static CsvReader fromResource...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_232
{ "fields": [ { "declarator": "expectedException = ExpectedException.none()", "modifier": "@Rule\n public", "original_string": "@Rule\n public ExpectedException expectedException = ExpectedException.none();", "type": "ExpectedException", "var_name": "expectedException" } ...
{ "body": "@Test\n public void vertexLabelsWithTheSameNamespaceDifferentNamesAreNotEqual() {\n VertexLabel foo = new VertexLabel(\"namespace\", \"foo\");\n VertexLabel bar = new VertexLabel(\"namespace\", \"bar\");\n assertThat(foo, not(equalTo(bar)));\n assertThat(foo.hashCode(), not(e...
{ "fields": [ { "declarator": "NAMESPACE_SEPARATOR = '.'", "modifier": "private static final", "original_string": "private static final char NAMESPACE_SEPARATOR = '.';", "type": "char", "var_name": "NAMESPACE_SEPARATOR" }, { "declarator": "namespace", "modifier": ...
{ "body": "@Override\n public int hashCode() {\n\n return Objects.hash(namespace, name);\n }", "class_method_signature": "VertexLabel.hashCode()", "constructor": false, "full_signature": "@Override public int hashCode()", "identifier": "hashCode", "invocations": [ "hash" ], "modifiers":...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_320
{ "fields": [ { "declarator": "thrown = ExpectedException.none()", "modifier": "@Rule\n public", "original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();", "type": "ExpectedException", "var_name": "thrown" }, { "declarator": "qDist",...
{ "body": "@Test\n public void throwsExceptionIfNetworkStateHasMoreThanOneVertexAndQIsProbabilisticDouble() {\n GaussianVertex v1 = new GaussianVertex(0., 1.);\n ConstantDoubleVertex v2 = new ConstantDoubleVertex(0.1);\n DoubleVertex v3 = v1.plus(v2);\n\n KeanuProbabilisticModel model =...
{ "fields": [], "file": "keanu-project/src/main/java/io/improbable/keanu/algorithms/variational/KLDivergence.java", "identifier": "KLDivergence", "interfaces": "", "methods": [ { "class_method_signature": "KLDivergence.compute(QDistribution q, NetworkSamples p)", "constructor": false, "f...
{ "body": "public static double compute(QDistribution q, NetworkSamples p) {\n return compute(p, q::getLogOfMasterP);\n }", "class_method_signature": "KLDivergence.compute(QDistribution q, NetworkSamples p)", "constructor": false, "full_signature": "public static double compute(QDistribution q, Networ...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_265
{ "fields": [], "file": "keanu-project/src/test/java/io/improbable/keanu/algorithms/mcmc/NetworkSamplesGeneratorTest.java", "identifier": "NetworkSamplesGeneratorTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void doesCreateNewStatusBarOnGenerationFinish() {\n AtomicInteger stepCount = new AtomicInteger(0);\n AtomicInteger sampleCount = new AtomicInteger(0);\n\n StatusBar statusBar1 = mock(StatusBar.class);\n StatusBar statusBar2 = mock(StatusBar.class);\n\n ...
{ "fields": [ { "declarator": "algorithm", "modifier": "private final", "original_string": "private final SamplingAlgorithm algorithm;", "type": "SamplingAlgorithm", "var_name": "algorithm" }, { "declarator": "dropCount = 0", "modifier": "private", "original...
{ "body": "public NetworkSamples generate(final int totalSampleCount) {\n Preconditions.checkArgument(dropCount < totalSampleCount,\n \"Cannot drop more samples than requested or all of the samples. Samples requested %s and dropping %s\",\n totalSampleCount, dropCount\n );\n\n ...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
128393918_34
{ "fields": [ { "declarator": "thrown = ExpectedException.none()", "modifier": "@Rule\n public", "original_string": "@Rule\n public ExpectedException thrown = ExpectedException.none();", "type": "ExpectedException", "var_name": "thrown" } ], "file": "keanu-project/src/t...
{ "body": "@Test\n public void canGetRandomAccessValue() {\n BooleanTensor matrixA = BooleanTensor.create(new boolean[]{true, false, true, false}, new long[]{2, 2});\n assertTrue(matrixA.getValue(0, 0));\n assertFalse(matrixA.getValue(0, 1));\n assertTrue(matrixA.getValue(1, 0));\n ...
{ "fields": [ { "declarator": "factory = BooleanBuffer.factory", "modifier": "private static final", "original_string": "private static final BooleanBuffer.BooleanArrayWrapperFactory factory = BooleanBuffer.factory;", "type": "BooleanBuffer.BooleanArrayWrapperFactory", "var_name": "f...
{ "body": "@Override\n protected JVMBooleanTensor create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape, long[] stride) {\n return new JVMBooleanTensor(buffer, shape, stride);\n }", "class_method_signature": "JVMBooleanTensor.create(BooleanBuffer.PrimitiveBooleanWrapper buffer, long[] shape...
{ "created": null, "fork": null, "fork_count": 33, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 128393918, "size": 15461, "stargazer_count": 146, "stars": null, "updates": null, "url": "https://github.com/improbable-research/keanu" }
56423934_1
{ "fields": [], "file": "hangar-api/src/test/java/com/spedge/hangar/index/TestIndexKey.java", "identifier": "TestIndexKey", "interfaces": "", "superclass": "" }
{ "body": "@Test\n\tpublic void testIndexKey()\n\t{\n\t\tIndexKey ik = new IndexKey(RepositoryType.UNKNOWN, \"thingsandstuff\");\n\t\tassertEquals(\"UNKNOWN:thingsandstuff\", ik.toString());\n\t\tassertEquals(\"thingsandstuff\", ik.toPath());\n\t\tassertEquals(\"UNKNOWN\", ik.getType().toString());\n\t}", "class_me...
{ "fields": [ { "declarator": "key", "modifier": "private", "original_string": "private String key;", "type": "String", "var_name": "key" }, { "declarator": "type = RepositoryType.UNKNOWN", "modifier": "private", "original_string": "private RepositoryType ty...
{ "body": "public IndexKey(RepositoryType type, String key)\n {\n this.key = key;\n this.type = type;\n }", "class_method_signature": "IndexKey.IndexKey(RepositoryType type, String key)", "constructor": true, "full_signature": "public IndexKey(RepositoryType type, String key)", "identifie...
{ "created": null, "fork": null, "fork_count": 0, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 56423934, "size": 390, "stargazer_count": 12, "stars": null, "updates": null, "url": "https://github.com/Spedge/hangar" }
56423934_0
{ "fields": [], "file": "hangar-api/src/test/java/com/spedge/hangar/repo/java/TestJavaIndexArtifact.java", "identifier": "TestJavaIndexArtifact", "interfaces": "", "superclass": "" }
{ "body": "@Test\n\tpublic void testFileTypes()\n\t{\n\t\tJavaIndexArtifact jia = new JavaIndexArtifact(\"\");\n\t\t\n\t\tMap<String, Boolean> types = jia.getFileTypes();\n\t\tassertFalse(types.get(\"jar\"));\n\t\tassertFalse(types.get(\"jar.sha1\"));\n\t\tassertFalse(types.get(\"jar.md5\"));\n\t\tassertFalse(types.g...
{ "fields": [ { "declarator": "serialVersionUID = -37333974652565977L", "modifier": "private static final", "original_string": "private static final long serialVersionUID = -37333974652565977L;", "type": "long", "var_name": "serialVersionUID" }, { "declarator": "fileTyp...
{ "body": "@Override\n protected Map<String, Boolean> getFileTypes()\n {\n return fileTypes;\n }", "class_method_signature": "JavaIndexArtifact.getFileTypes()", "constructor": false, "full_signature": "@Override protected Map<String, Boolean> getFileTypes()", "identifier": "getFileTypes", "i...
{ "created": null, "fork": null, "fork_count": 0, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 56423934, "size": 390, "stargazer_count": 12, "stars": null, "updates": null, "url": "https://github.com/Spedge/hangar" }
56423934_3
{ "fields": [ { "declarator": "index", "modifier": "", "original_string": "ZooKeeperIndex index;", "type": "ZooKeeperIndex", "var_name": "index" } ], "file": "hangar-api/src/test/java/com/spedge/hangar/index/zookeeper/TestZookeeperIndex.java", "identifier": "TestZookeeperIn...
{ "body": "@Test\n\tpublic void testAddArtifact() throws Exception\n\t{\n\t\tTestingServer testingServer = new TestingServer();\n\t\tindex.startClient(testingServer.getConnectString());\n\t\t\n\t\ttry\n\t\t{\n\t\t\t// Add an artifact.\n\t\t\tindex.addArtifact(IndexUtils.TEST1.getKey(), IndexUtils.TEST1.getArtifact())...
{ "fields": [ { "declarator": "logger = LoggerFactory.getLogger(ZooKeeperIndex.class)", "modifier": "protected final", "original_string": "protected final Logger logger = LoggerFactory.getLogger(ZooKeeperIndex.class);", "type": "Logger", "var_name": "logger" }, { "decla...
{ "body": "@Override\n public void addArtifact(IndexKey key, IndexArtifact artifact)\n throws IndexException, IndexConfictException\n {\n String path = convertPath(key);\n if (isArtifact(key))\n {\n if (!(getArtifact(key) instanceof ReservedArtifact))\n {\n ...
{ "created": null, "fork": null, "fork_count": 0, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 56423934, "size": 390, "stargazer_count": 12, "stars": null, "updates": null, "url": "https://github.com/Spedge/hangar" }
56423934_2
{ "fields": [ { "declarator": "index", "modifier": "", "original_string": "InMemoryIndex index;", "type": "InMemoryIndex", "var_name": "index" } ], "file": "hangar-api/src/test/java/com/spedge/hangar/index/memory/TestInMemoryIndex.java", "identifier": "TestInMemoryIndex", ...
{ "body": "@Test\n\tpublic void testAddArtifact() throws IndexConfictException\n\t{\n\t\t// Add an artifact.\n\t\tindex.addArtifact(IndexUtils.TEST1.getKey(), IndexUtils.TEST1.getArtifact());\n\t\t\n\t\t// Is there an artifact?\n\t\tAssert.assertTrue(index.isArtifact(IndexUtils.TEST1.getKey()));\n\t\t\n\t\t// Get the...
{ "fields": [ { "declarator": "index", "modifier": "private", "original_string": "private Map<String, IndexArtifact> index;", "type": "Map<String, IndexArtifact>", "var_name": "index" }, { "declarator": "logger = LoggerFactory.getLogger(InMemoryIndex.class)", "mod...
{ "body": "public void addArtifact(IndexKey key, IndexArtifact artifact) throws IndexConfictException\n {\n if (index.containsKey(key.toString()))\n {\n if (!(index.get(key.toString()) instanceof ReservedArtifact))\n {\n index.put(key.toString(), artifact);\n ...
{ "created": null, "fork": null, "fork_count": 0, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 56423934, "size": 390, "stargazer_count": 12, "stars": null, "updates": null, "url": "https://github.com/Spedge/hangar" }
49317403_31
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock DrawerActivityView view;", "type": "DrawerActivityView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private DrawerPresente...
{ "body": "@Test\n public void should_go_back_when_pressing_back_while_navigation_drawer_is_already_closed_and_category_is_schedule() {\n // Given\n presenter.toolbarTitle = R.string.drawer_nav_schedule;\n when(view.isNavigationDrawerOpen()).thenReturn(false);\n\n // When\n boole...
{ "fields": [ { "declarator": "toolbarTitle", "modifier": "@State @StringRes", "original_string": "@State @StringRes int toolbarTitle;", "type": "int", "var_name": "toolbarTitle" }, { "declarator": "selectedItemId", "modifier": "@State @IdRes", "original_str...
{ "body": "@Override\n public boolean onBackPressed() {\n if (view.isNavigationDrawerOpen()) {\n view.closeNavigationDrawer();\n return true;\n } else if (toolbarTitle != R.string.drawer_nav_schedule) {\n int firstItem = R.id.drawer_nav_schedule;\n onNaviga...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_27
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock DrawerActivityView view;", "type": "DrawerActivityView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private DrawerPresente...
{ "body": "@Test\n public void should_do_nothing_when_selecting_a_category_which_is_already_selected() {\n // Given\n presenter.selectedItemId = R.id.drawer_nav_speakers;\n\n // When\n presenter.onNavigationItemSelected(R.id.drawer_nav_speakers);\n\n // Then\n verify(view,...
{ "fields": [ { "declarator": "toolbarTitle", "modifier": "@State @StringRes", "original_string": "@State @StringRes int toolbarTitle;", "type": "int", "var_name": "toolbarTitle" }, { "declarator": "selectedItemId", "modifier": "@State @IdRes", "original_str...
{ "body": "@Override\n public void onNavigationItemSelected(@IdRes int itemId) {\n if (itemId != selectedItemId) {\n switch (itemId) {\n case R.id.drawer_nav_schedule:\n view.showFragment(new SchedulePagerFragmentBuilder(false).build());\n tool...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_0
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/data/database/model/SpeakerTest.java", "identifier": "SpeakerTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_create_content_values_for_sqlite() {\n // Given\n Speaker speaker = new Speaker(3, \"name\", \"title\", \"bio\", \"website\", \"twitter\", \"github\", \"photo\");\n\n // When\n ContentValues result = Speaker.createContentValues(speaker);\n\n ...
{ "fields": [ { "declarator": "TABLE = \"speakers\"", "modifier": "public static final", "original_string": "public static final String TABLE = \"speakers\";", "type": "String", "var_name": "TABLE" }, { "declarator": "ID = \"_id\"", "modifier": "public static fina...
{ "body": "public static ContentValues createContentValues(Speaker speaker) {\n ContentValues values = new ContentValues();\n values.put(ID, speaker.id);\n values.put(NAME, speaker.name);\n values.put(TITLE, speaker.title);\n values.put(BIO, speaker.bio);\n values.put(WEBSITE...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_11
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/data/app/model/ScheduleDayTest.java", "identifier": "ScheduleDayTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_restore_from_parcelable() {\n // Given\n LocalDate day = LocalDate.of(1985, 5, 15);\n List<ScheduleSlot> slots = singletonList(new ScheduleSlot(null, null));\n ScheduleDay scheduleDay = new ScheduleDay(day, slots);\n\n // When\n Parcel...
{ "fields": [ { "declarator": "CREATOR = new Parcelable.Creator<ScheduleDay>() {\n public ScheduleDay createFromParcel(Parcel source) {\n return new ScheduleDay(source);\n }\n\n public ScheduleDay[] newArray(int size) {\n return new ScheduleDay[size];\n }\n ...
{ "body": "@Override\n public void writeToParcel(Parcel dest, int flags) {\n dest.writeSerializable(day);\n dest.writeTypedList(slots);\n }", "class_method_signature": "ScheduleDay.writeToParcel(Parcel dest, int flags)", "constructor": false, "full_signature": "@Override public void writeToP...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_10
{ "fields": [ { "declarator": "appMapper = new AppMapper()", "modifier": "private final", "original_string": "private final AppMapper appMapper = new AppMapper();", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "speaker1 = new Speaker(10, \"Gautier\", ...
{ "body": "@Test\n public void should_convert_sessions_list_into_schedule() {\n // Given\n LocalDateTime slot1 = LocalDateTime.of(2016, 3, 15, 8, 10);\n LocalDateTime slot2 = slot1.plusHours(1);\n LocalDateTime slot3 = slot2.plusHours(1);\n LocalDateTime slot4 = slot1.plusDays(1)...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/data/app/AppMapper.java", "identifier": "AppMapper", "interfaces": "", "methods": [ { "class_method_signature": "AppMapper.AppMapper()", "constructor": true, "full_signature": "@Inject public AppMapper()", "identifi...
{ "body": "public Schedule toSchedule(@NonNull List<Session> sessions) {\n // Map and sort Session per start date\n Collections.sort(sessions, (lhs, rhs) -> lhs.getFromTime().compareTo(rhs.getFromTime()));\n\n // Gather Sessions per ScheduleSlot\n List<ScheduleSlot> scheduleSlots = mapToSc...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_1
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/data/database/model/SessionTest.java", "identifier": "SessionTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_create_content_values_for_sqlite() {\n // Given\n Session session = new Session(10, \"startAt\", 45, 3, \"[3, 4]\", \"title\", \"description\");\n\n // When\n ContentValues result = Session.createContentValues(session);\n\n // Then\n a...
{ "fields": [ { "declarator": "TABLE = \"sessions\"", "modifier": "public static final", "original_string": "public static final String TABLE = \"sessions\";", "type": "String", "var_name": "TABLE" }, { "declarator": "ID = \"_id\"", "modifier": "public static fina...
{ "body": "public static ContentValues createContentValues(Session session) {\n ContentValues values = new ContentValues();\n values.put(ID, session.id);\n values.put(START_AT, session.startAt);\n values.put(DURATION, session.duration);\n values.put(ROOM_ID, session.roomId);\n ...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_26
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock DrawerActivityView view;", "type": "DrawerActivityView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private DrawerPresente...
{ "body": "@Test\n public void should_automatically_select_my_schedule_when_starting_the_app() {\n // When\n presenter.onPostCreate(null);\n\n // Then\n verify(view).showFragment(any(SchedulePagerFragment.class));\n }", "class_method_signature": "DrawerPresenterTest.should_automati...
{ "fields": [ { "declarator": "toolbarTitle", "modifier": "@State @StringRes", "original_string": "@State @StringRes int toolbarTitle;", "type": "int", "var_name": "toolbarTitle" }, { "declarator": "selectedItemId", "modifier": "@State @IdRes", "original_str...
{ "body": "@Override\n public void onPostCreate(Bundle savedInstanceState) {\n super.onPostCreate(savedInstanceState);\n if (savedInstanceState == null) {\n onNavigationItemSelected(R.id.drawer_nav_schedule);\n }\n }", "class_method_signature": "DrawerPresenter.onPostCreate(Bun...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_30
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock DrawerActivityView view;", "type": "DrawerActivityView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private DrawerPresente...
{ "body": "@Test\n public void should_go_back_to_agenda_when_pressing_back_while_navigation_drawer_is_already_closed_and_category_is_not_schedule() {\n // Given\n presenter.toolbarTitle = R.string.drawer_nav_speakers;\n when(view.isNavigationDrawerOpen()).thenReturn(false);\n\n // When\...
{ "fields": [ { "declarator": "toolbarTitle", "modifier": "@State @StringRes", "original_string": "@State @StringRes int toolbarTitle;", "type": "int", "var_name": "toolbarTitle" }, { "declarator": "selectedItemId", "modifier": "@State @IdRes", "original_str...
{ "body": "@Override\n public boolean onBackPressed() {\n if (view.isNavigationDrawerOpen()) {\n view.closeNavigationDrawer();\n return true;\n } else if (toolbarTitle != R.string.drawer_nav_schedule) {\n int firstItem = R.id.drawer_nav_schedule;\n onNaviga...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_6
{ "fields": [ { "declarator": "appMapper = new AppMapper()", "modifier": "private final", "original_string": "private final AppMapper appMapper = new AppMapper();", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "networkMapper = new NetworkMapper(appMap...
{ "body": "@Test\n public void should_convert_network_speakers_to_app_speakers() {\n // Given\n Speaker speaker1 = new Speaker(1, \"speaker1\", \"title1\", \"bio1\", \"website1\", \"twitter1\", \"github1\", \"photo1\");\n Speaker speaker2 = new Speaker(2, \"speaker2\", \"title2\", \"bio2\", \"...
{ "fields": [ { "declarator": "appMapper", "modifier": "private final", "original_string": "private final AppMapper appMapper;", "type": "AppMapper", "var_name": "appMapper" } ], "file": "app/src/main/java/com/nilhcem/droidcontn/data/network/NetworkMapper.java", "identifier...
{ "body": "public List<com.nilhcem.droidcontn.data.app.model.Speaker> toAppSpeakers(@Nullable List<Speaker> from) {\n if (from == null) {\n return null;\n }\n\n return stream(from).map(speaker -> new com.nilhcem.droidcontn.data.app.model.Speaker(\n speaker.getId(), speak...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_40
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/AppTest.java", "identifier": "AppTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_return_formatted_string_version() {\n // Given\n assume().withFailureMessage(\"Do not test internal builds\").that(BuildConfig.INTERNAL_BUILD).isFalse();\n String expected = BuildConfig.VERSION_NAME + \" (#\" + BuildConfig.VERSION_CODE + \")\";\n\n ...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/App.java", "identifier": "App", "interfaces": "", "methods": [ { "class_method_signature": "App.App()", "constructor": true, "full_signature": "private App()", "identifier": "App", "modifiers": "private"...
{ "body": "public static String getVersion() {\n String version = String.format(Locale.US, \"%s (#%d)\", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE);\n if (BuildConfig.INTERNAL_BUILD) {\n version = String.format(Locale.US, \"%s — commit %s\", version, BuildConfig.GIT_SHA);\n }\...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_17
{ "fields": [ { "declarator": "cache = new DataProviderCache()", "modifier": "private final", "original_string": "private final DataProviderCache cache = new DataProviderCache();", "type": "DataProviderCache", "var_name": "cache" }, { "declarator": "session1 = new Sessi...
{ "body": "@Test\n public void should_return_sessions_when_cache_time_is_still_active() {\n // Given\n cache.sessionsFetchedTime = LocalDateTime.now();\n cache.sessions = sessions;\n\n // When\n List<Session> result = cache.getSessions();\n\n // Then\n assertThat(re...
{ "fields": [ { "declarator": "CACHE_DURATION_MN = 10", "modifier": "private static final", "original_string": "private static final long CACHE_DURATION_MN = 10;", "type": "long", "var_name": "CACHE_DURATION_MN" }, { "declarator": "sessions", "modifier": "", ...
{ "body": "public List<Session> getSessions() {\n if (sessionsFetchedTime != null && sessionsFetchedTime.plusMinutes(CACHE_DURATION_MN).isAfter(LocalDateTime.now())) {\n Timber.d(\"Get sessions from cache\");\n return sessions;\n }\n return null;\n }", "class_method_sig...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_37
{ "fields": [ { "declarator": "activity", "modifier": "private", "original_string": "private Activity activity;", "type": "Activity", "var_name": "activity" } ], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/IntentsTest.java", "identifier": "IntentsTest", "inter...
{ "body": "@Test\n public void should_start_external_uri() {\n // Given\n String url = \"http://www.google.com\";\n RobolectricPackageManager rpm = (RobolectricPackageManager) RuntimeEnvironment.application.getPackageManager();\n rpm.addResolveInfoForIntent(new Intent(Intent.ACTION_VIEW...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Intents.java", "identifier": "Intents", "interfaces": "", "methods": [ { "class_method_signature": "Intents.Intents()", "constructor": true, "full_signature": "private Intents()", "identifier": "Intents", ...
{ "body": "public static void startExternalUrl(@NonNull Activity activity, @NonNull String url) {\n CustomTabsIntent intent = new CustomTabsIntent.Builder()\n .setShowTitle(true)\n .setToolbarColor(ContextCompat.getColor(activity, R.color.primary))\n .build();\n ...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_21
{ "fields": [ { "declarator": "cache = new DataProviderCache()", "modifier": "private final", "original_string": "private final DataProviderCache cache = new DataProviderCache();", "type": "DataProviderCache", "var_name": "cache" }, { "declarator": "session1 = new Sessi...
{ "body": "@Test\n public void should_return_null_speakers_when_cache_has_expired() {\n // Given\n cache.speakersFetchedTime = LocalDateTime.now().minusYears(1);\n cache.speakers = speakers;\n\n // When\n List<Speaker> result = cache.getSpeakers();\n\n // Then\n ass...
{ "fields": [ { "declarator": "CACHE_DURATION_MN = 10", "modifier": "private static final", "original_string": "private static final long CACHE_DURATION_MN = 10;", "type": "long", "var_name": "CACHE_DURATION_MN" }, { "declarator": "sessions", "modifier": "", ...
{ "body": "public List<Speaker> getSpeakers() {\n if (speakersFetchedTime != null && speakersFetchedTime.plusMinutes(CACHE_DURATION_MN).isAfter(LocalDateTime.now())) {\n Timber.d(\"Get speakers from cache\");\n return speakers;\n }\n return null;\n }", "class_method_sig...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_20
{ "fields": [ { "declarator": "cache = new DataProviderCache()", "modifier": "private final", "original_string": "private final DataProviderCache cache = new DataProviderCache();", "type": "DataProviderCache", "var_name": "cache" }, { "declarator": "session1 = new Sessi...
{ "body": "@Test\n public void should_return_speakers_when_cache_time_is_still_active() {\n // Given\n cache.speakersFetchedTime = LocalDateTime.now();\n cache.speakers = speakers;\n\n // When\n List<Speaker> result = cache.getSpeakers();\n\n // Then\n assertThat(re...
{ "fields": [ { "declarator": "CACHE_DURATION_MN = 10", "modifier": "private static final", "original_string": "private static final long CACHE_DURATION_MN = 10;", "type": "long", "var_name": "CACHE_DURATION_MN" }, { "declarator": "sessions", "modifier": "", ...
{ "body": "public List<Speaker> getSpeakers() {\n if (speakersFetchedTime != null && speakersFetchedTime.plusMinutes(CACHE_DURATION_MN).isAfter(LocalDateTime.now())) {\n Timber.d(\"Get speakers from cache\");\n return speakers;\n }\n return null;\n }", "class_method_sig...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_36
{ "fields": [ { "declarator": "activity", "modifier": "private", "original_string": "private Activity activity;", "type": "Activity", "var_name": "activity" } ], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/IntentsTest.java", "identifier": "IntentsTest", "inter...
{ "body": "@Test\n public void should_return_false_when_nothing_on_the_device_can_open_the_uri() {\n // Given\n String url = \"http://www.google.com\";\n RobolectricPackageManager rpm = (RobolectricPackageManager) RuntimeEnvironment.application.getPackageManager();\n rpm.addResolveInfoF...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Intents.java", "identifier": "Intents", "interfaces": "", "methods": [ { "class_method_signature": "Intents.Intents()", "constructor": true, "full_signature": "private Intents()", "identifier": "Intents", ...
{ "body": "public static boolean startUri(@NonNull Context context, @NonNull String url) {\n Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));\n if (intent.resolveActivity(context.getPackageManager()) != null) {\n context.startActivity(intent);\n return true;\n ...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_16
{ "fields": [ { "declarator": "cache = new DataProviderCache()", "modifier": "private final", "original_string": "private final DataProviderCache cache = new DataProviderCache();", "type": "DataProviderCache", "var_name": "cache" }, { "declarator": "session1 = new Sessi...
{ "body": "@Test\n public void should_save_sessions_in_memory_keeping_save_time() {\n // Given When\n LocalDateTime before = LocalDateTime.now();\n cache.saveSessions(sessions);\n LocalDateTime after = LocalDateTime.now();\n\n // Then\n assertThat(cache.sessions).hasSize(2...
{ "fields": [ { "declarator": "CACHE_DURATION_MN = 10", "modifier": "private static final", "original_string": "private static final long CACHE_DURATION_MN = 10;", "type": "long", "var_name": "CACHE_DURATION_MN" }, { "declarator": "sessions", "modifier": "", ...
{ "body": "public void saveSessions(List<Session> sessions) {\n this.sessions = sessions;\n sessionsFetchedTime = LocalDateTime.now();\n }", "class_method_signature": "DataProviderCache.saveSessions(List<Session> sessions)", "constructor": false, "full_signature": "public void saveSessions(List...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_7
{ "fields": [ { "declarator": "appMapper = new AppMapper()", "modifier": "private final", "original_string": "private final AppMapper appMapper = new AppMapper();", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "networkMapper = new NetworkMapper(appMap...
{ "body": "@Test\n public void should_convert_network_sessions_to_app_sessions() {\n // Given\n LocalDateTime startAt = LocalDateTime.now();\n Session session = new Session(1, startAt, 20, Room.CESAR_1.id, singletonList(10), \"title\", \"description\");\n Map<Integer, com.nilhcem.droidc...
{ "fields": [ { "declarator": "appMapper", "modifier": "private final", "original_string": "private final AppMapper appMapper;", "type": "AppMapper", "var_name": "appMapper" } ], "file": "app/src/main/java/com/nilhcem/droidcontn/data/network/NetworkMapper.java", "identifier...
{ "body": "public List<com.nilhcem.droidcontn.data.app.model.Session> toAppSessions(@Nullable List<Session> from, @NonNull Map<Integer, com.nilhcem.droidcontn.data.app.model.Speaker> speakersMap) {\n if (from == null) {\n return null;\n }\n\n return stream(from).map(session -> new com....
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_41
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/AppTest.java", "identifier": "AppTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_return_null_photourl_when_giving_invalid_data() {\n // Given\n Session session1 = null;\n Session session2 = new Session(3, \"room1\", null, \"title\", \"description\", null, null);\n Session session3 = new Session(3, \"room1\", new ArrayList<>(), \...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/App.java", "identifier": "App", "interfaces": "", "methods": [ { "class_method_signature": "App.App()", "constructor": true, "full_signature": "private App()", "identifier": "App", "modifiers": "private"...
{ "body": "@Nullable\n public static String getPhotoUrl(@Nullable Session session) {\n String photoUrl = null;\n if (session != null) {\n List<Speaker> speakers = session.getSpeakers();\n if (speakers != null && !speakers.isEmpty()) {\n photoUrl = speakers.get(0)....
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_39
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/AppTest.java", "identifier": "AppTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_return_false_when_api_is_incompatible() {\n // Given\n int apiLevelIncompatible = android.os.Build.VERSION.SDK_INT + 1;\n\n // When\n boolean result = App.isCompatible(apiLevelIncompatible);\n\n // Then\n assertThat(result).isFalse();\...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/App.java", "identifier": "App", "interfaces": "", "methods": [ { "class_method_signature": "App.App()", "constructor": true, "full_signature": "private App()", "identifier": "App", "modifiers": "private"...
{ "body": "public static boolean isCompatible(int apiLevel) {\n return android.os.Build.VERSION.SDK_INT >= apiLevel;\n }", "class_method_signature": "App.isCompatible(int apiLevel)", "constructor": false, "full_signature": "public static boolean isCompatible(int apiLevel)", "identifier": "isCompatib...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_15
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/data/app/model/ScheduleSlotTest.java", "identifier": "ScheduleSlotTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_restore_from_parcelable() {\n // Given\n LocalDateTime time = LocalDateTime.now();\n List<Session> sessions = Arrays.asList(new Session(1, null, null, null, null, null, null), new Session(2, null, null, null, null, null, null), new Session(3, null, null, n...
{ "fields": [ { "declarator": "CREATOR = new Parcelable.Creator<ScheduleSlot>() {\n public ScheduleSlot createFromParcel(Parcel source) {\n return new ScheduleSlot(source);\n }\n\n public ScheduleSlot[] newArray(int size) {\n return new ScheduleSlot[size];\n ...
{ "body": "@Override\n public void writeToParcel(Parcel dest, int flags) {\n dest.writeSerializable(time);\n dest.writeTypedList(sessions);\n }", "class_method_signature": "ScheduleSlot.writeToParcel(Parcel dest, int flags)", "constructor": false, "full_signature": "@Override public void wri...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_42
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/AppTest.java", "identifier": "AppTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_return_photo_url_of_first_speaker() {\n // Given\n Speaker speaker1 = new Speaker(1, null, null, null, null, null, null, \"photo1\");\n Speaker speaker2 = new Speaker(2, null, null, null, null, null, null, \"photo2\");\n Session session = new Sessio...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/App.java", "identifier": "App", "interfaces": "", "methods": [ { "class_method_signature": "App.App()", "constructor": true, "full_signature": "private App()", "identifier": "App", "modifiers": "private"...
{ "body": "@Nullable\n public static String getPhotoUrl(@Nullable Session session) {\n String photoUrl = null;\n if (session != null) {\n List<Speaker> speakers = session.getSpeakers();\n if (speakers != null && !speakers.isEmpty()) {\n photoUrl = speakers.get(0)....
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_4
{ "fields": [ { "declarator": "dbMapper", "modifier": "private", "original_string": "private DbMapper dbMapper;", "type": "DbMapper", "var_name": "dbMapper" }, { "declarator": "moshi = new Moshi.Builder().build()", "modifier": "private final", "original_stri...
{ "body": "@Test\n public void should_convert_app_speaker_to_db_speaker() {\n // Given\n Speaker speaker = new Speaker(10, \"name\", \"title\", \"bio\", \"website\", \"twitter\", \"github\", \"photo\");\n\n // When\n com.nilhcem.droidcontn.data.database.model.Speaker result = dbMapper.f...
{ "fields": [ { "declarator": "appMapper", "modifier": "private final", "original_string": "private final AppMapper appMapper;", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "localDateTimeAdapter", "modifier": "private final", "original_st...
{ "body": "public Speaker fromAppSpeaker(@Nullable com.nilhcem.droidcontn.data.app.model.Speaker from) {\n if (from == null) {\n return null;\n }\n\n return new Speaker(from.getId(), from.getName(), from.getTitle(), from.getBio(),\n from.getWebsite(), from.getTwitter(), ...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_23
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock ScheduleDayView view;", "type": "ScheduleDayView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private ScheduleDayPresenter...
{ "body": "@Test\n public void should_refresh_slots_when_view_is_resuming() {\n // When\n presenter.onResume();\n\n // Then\n verify(view).refreshSlotsList();\n }", "class_method_signature": "ScheduleDayPresenterTest.should_refresh_slots_when_view_is_resuming()", "constructor": f...
{ "fields": [ { "declarator": "scheduleDay", "modifier": "private final", "original_string": "private final ScheduleDay scheduleDay;", "type": "ScheduleDay", "var_name": "scheduleDay" } ], "file": "app/src/main/java/com/nilhcem/droidcontn/ui/schedule/day/ScheduleDayPresenter....
{ "body": "@Override\n public void onResume() {\n super.onResume();\n view.refreshSlotsList();\n }", "class_method_signature": "ScheduleDayPresenter.onResume()", "constructor": false, "full_signature": "@Override public void onResume()", "identifier": "onResume", "invocations": [ "on...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_35
{ "fields": [ { "declarator": "activity", "modifier": "private", "original_string": "private Activity activity;", "type": "Activity", "var_name": "activity" } ], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/IntentsTest.java", "identifier": "IntentsTest", "inter...
{ "body": "@Test\n public void should_start_url_intent() {\n // Given\n String url = \"geo:22.5430883,114.1043205\";\n RobolectricPackageManager rpm = (RobolectricPackageManager) RuntimeEnvironment.application.getPackageManager();\n rpm.addResolveInfoForIntent(new Intent(Intent.ACTION_V...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Intents.java", "identifier": "Intents", "interfaces": "", "methods": [ { "class_method_signature": "Intents.Intents()", "constructor": true, "full_signature": "private Intents()", "identifier": "Intents", ...
{ "body": "public static boolean startUri(@NonNull Context context, @NonNull String url) {\n Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));\n if (intent.resolveActivity(context.getPackageManager()) != null) {\n context.startActivity(intent);\n return true;\n ...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_19
{ "fields": [ { "declarator": "cache = new DataProviderCache()", "modifier": "private final", "original_string": "private final DataProviderCache cache = new DataProviderCache();", "type": "DataProviderCache", "var_name": "cache" }, { "declarator": "session1 = new Sessi...
{ "body": "@Test\n public void should_save_speakers_in_memory_keeping_save_time() {\n // Given When\n LocalDateTime before = LocalDateTime.now();\n cache.saveSpeakers(speakers);\n LocalDateTime after = LocalDateTime.now();\n\n // Then\n assertThat(cache.speakers).hasSize(2...
{ "fields": [ { "declarator": "CACHE_DURATION_MN = 10", "modifier": "private static final", "original_string": "private static final long CACHE_DURATION_MN = 10;", "type": "long", "var_name": "CACHE_DURATION_MN" }, { "declarator": "sessions", "modifier": "", ...
{ "body": "public void saveSpeakers(List<Speaker> speakers) {\n this.speakers = speakers;\n speakersFetchedTime = LocalDateTime.now();\n }", "class_method_signature": "DataProviderCache.saveSpeakers(List<Speaker> speakers)", "constructor": false, "full_signature": "public void saveSpeakers(List...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_8
{ "fields": [ { "declarator": "appMapper = new AppMapper()", "modifier": "private final", "original_string": "private final AppMapper appMapper = new AppMapper();", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "speaker1 = new Speaker(10, \"Gautier\", ...
{ "body": "@Test\n public void should_create_map_of_speakers_with_id_as_speakerId_and_value_as_speaker() {\n // Given When\n Map<Integer, Speaker> map = appMapper.speakersToMap(speakers);\n\n // Then\n assertThat(map.get(10)).isEqualTo(speaker1);\n assertThat(map.get(20)).isEqual...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/data/app/AppMapper.java", "identifier": "AppMapper", "interfaces": "", "methods": [ { "class_method_signature": "AppMapper.AppMapper()", "constructor": true, "full_signature": "@Inject public AppMapper()", "identifi...
{ "body": "public Map<Integer, Speaker> speakersToMap(@NonNull List<Speaker> from) {\n return stream(from).collect(Collectors.toMap(Speaker::getId, speaker -> speaker));\n }", "class_method_signature": "AppMapper.speakersToMap(@NonNull List<Speaker> from)", "constructor": false, "full_signature": "pub...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_9
{ "fields": [ { "declarator": "appMapper = new AppMapper()", "modifier": "private final", "original_string": "private final AppMapper appMapper = new AppMapper();", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "speaker1 = new Speaker(10, \"Gautier\", ...
{ "body": "@Test\n public void should_return_list_of_ids() {\n // Given\n List<Speaker> speakers = Arrays.asList(speaker3, speaker5);\n\n // When\n List<Integer> result = appMapper.toSpeakersIds(speakers);\n\n // Then\n assertThat(result).hasSize(2);\n assertThat(re...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/data/app/AppMapper.java", "identifier": "AppMapper", "interfaces": "", "methods": [ { "class_method_signature": "AppMapper.AppMapper()", "constructor": true, "full_signature": "@Inject public AppMapper()", "identifi...
{ "body": "public List<Integer> toSpeakersIds(@Nullable List<Speaker> speakers) {\n if (speakers == null) {\n return null;\n }\n return stream(speakers).map(Speaker::getId).collect(Collectors.toList());\n }", "class_method_signature": "AppMapper.toSpeakersIds(@Nullable List<Speake...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_18
{ "fields": [ { "declarator": "cache = new DataProviderCache()", "modifier": "private final", "original_string": "private final DataProviderCache cache = new DataProviderCache();", "type": "DataProviderCache", "var_name": "cache" }, { "declarator": "session1 = new Sessi...
{ "body": "@Test\n public void should_return_null_sessions_when_cache_has_expired() {\n // Given\n cache.sessionsFetchedTime = LocalDateTime.now().minusYears(1);\n cache.sessions = sessions;\n\n // When\n List<Session> result = cache.getSessions();\n\n // Then\n ass...
{ "fields": [ { "declarator": "CACHE_DURATION_MN = 10", "modifier": "private static final", "original_string": "private static final long CACHE_DURATION_MN = 10;", "type": "long", "var_name": "CACHE_DURATION_MN" }, { "declarator": "sessions", "modifier": "", ...
{ "body": "public List<Session> getSessions() {\n if (sessionsFetchedTime != null && sessionsFetchedTime.plusMinutes(CACHE_DURATION_MN).isAfter(LocalDateTime.now())) {\n Timber.d(\"Get sessions from cache\");\n return sessions;\n }\n return null;\n }", "class_method_sig...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_34
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/PreconditionsTest.java", "identifier": "PreconditionsTest", "interfaces": "", "superclass": "" }
{ "body": "@Test(expected = IllegalArgumentException.class)\n public void should_throw_IllegalArgumentException_when_argument_is_invalid() {\n // Given\n boolean argument = false;\n\n // When\n Preconditions.checkArgument(argument);\n }", "class_method_signature": "PreconditionsTes...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Preconditions.java", "identifier": "Preconditions", "interfaces": "", "methods": [ { "class_method_signature": "Preconditions.Preconditions()", "constructor": true, "full_signature": "private Preconditions()", ...
{ "body": "public static void checkArgument(boolean expression) {\n if (!expression) {\n throw new IllegalArgumentException();\n }\n }", "class_method_signature": "Preconditions.checkArgument(boolean expression)", "constructor": false, "full_signature": "public static void checkArgum...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_22
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock ScheduleDayView view;", "type": "ScheduleDayView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private ScheduleDayPresenter...
{ "body": "@Test\n public void should_init_view_slots_when_view_is_created() {\n // When\n presenter.onViewCreated(null, null);\n\n // Then\n verify(view).initSlotsList(slots);\n }", "class_method_signature": "ScheduleDayPresenterTest.should_init_view_slots_when_view_is_created()",...
{ "fields": [ { "declarator": "scheduleDay", "modifier": "private final", "original_string": "private final ScheduleDay scheduleDay;", "type": "ScheduleDay", "var_name": "scheduleDay" } ], "file": "app/src/main/java/com/nilhcem/droidcontn/ui/schedule/day/ScheduleDayPresenter....
{ "body": "@Override\n public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n super.onViewCreated(view, savedInstanceState);\n this.view.initSlotsList(scheduleDay.getSlots());\n }", "class_method_signature": "ScheduleDayPresenter.onViewCreated(View view, @Nullable Bundle s...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_43
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/StringsTest.java", "identifier": "StringsTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_capitalize_first_letter() {\n // Given\n String src = \"hello\";\n\n // When\n String result = Strings.capitalizeFirstLetter(src);\n\n // Then\n assertThat(result).isEqualTo(\"Hello\");\n }", "class_method_signature": "StringsTest...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Strings.java", "identifier": "Strings", "interfaces": "", "methods": [ { "class_method_signature": "Strings.Strings()", "constructor": true, "full_signature": "private Strings()", "identifier": "Strings", ...
{ "body": "public static String capitalizeFirstLetter(@NonNull String src) {\n return src.substring(0, 1).toUpperCase(Locale.getDefault()) + src.substring(1);\n }", "class_method_signature": "Strings.capitalizeFirstLetter(@NonNull String src)", "constructor": false, "full_signature": "public static St...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_5
{ "fields": [ { "declarator": "dbMapper", "modifier": "private", "original_string": "private DbMapper dbMapper;", "type": "DbMapper", "var_name": "dbMapper" }, { "declarator": "moshi = new Moshi.Builder().build()", "modifier": "private final", "original_stri...
{ "body": "@Test\n public void should_convert_db_speakers_to_app_speakers() {\n // Given\n com.nilhcem.droidcontn.data.database.model.Speaker speaker = new com.nilhcem.droidcontn.data.database.model.Speaker(58, \"nilh\", \"dev\", \"bio\", \"nilhcem.com\", \"Nilhcem\", \"nilhcem\", \"photo\");\n\n ...
{ "fields": [ { "declarator": "appMapper", "modifier": "private final", "original_string": "private final AppMapper appMapper;", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "localDateTimeAdapter", "modifier": "private final", "original_st...
{ "body": "public List<com.nilhcem.droidcontn.data.app.model.Speaker> toAppSpeakers(@Nullable List<Speaker> from) {\n if (from == null) {\n return null;\n }\n\n return stream(from).map(speaker -> new com.nilhcem.droidcontn.data.app.model.Speaker(speaker.id,\n speaker.nam...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_14
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/data/app/model/SessionTest.java", "identifier": "SessionTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_restore_from_parcelable() {\n // Given\n List<Speaker> speakers = singletonList(new Speaker(1, null, null, null, null, null, null, null));\n LocalDateTime fromTime = LocalDateTime.now().minusDays(1);\n LocalDateTime toTime = fromTime.plusMinutes(45)...
{ "fields": [ { "declarator": "CREATOR = new Parcelable.Creator<Session>() {\n public Session createFromParcel(Parcel source) {\n return new Session(source);\n }\n\n public Session[] newArray(int size) {\n return new Session[size];\n }\n }", "modifi...
{ "body": "@Override\n public void writeToParcel(Parcel dest, int flags) {\n dest.writeInt(id);\n dest.writeString(room);\n dest.writeTypedList(speakers);\n dest.writeString(title);\n dest.writeString(description);\n dest.writeSerializable(fromTime);\n dest.writeSer...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_38
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/AppTest.java", "identifier": "AppTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_return_true_when_api_is_compatible() {\n // Given\n int apiLevelCompatible = android.os.Build.VERSION.SDK_INT;\n int apiLevelBelow = android.os.Build.VERSION.SDK_INT - 1;\n\n // When\n boolean result1 = App.isCompatible(apiLevelCompatible);\n...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/App.java", "identifier": "App", "interfaces": "", "methods": [ { "class_method_signature": "App.App()", "constructor": true, "full_signature": "private App()", "identifier": "App", "modifiers": "private"...
{ "body": "public static boolean isCompatible(int apiLevel) {\n return android.os.Build.VERSION.SDK_INT >= apiLevel;\n }", "class_method_signature": "App.isCompatible(int apiLevel)", "constructor": false, "full_signature": "public static boolean isCompatible(int apiLevel)", "identifier": "isCompatib...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_25
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock SchedulePagerView view;", "type": "SchedulePagerView", "var_name": "view" }, { "declarator": "dataProvider", "modifier": "@Mock", "original_string": "@Mock DataProvider data...
{ "body": "@Test\n public void should_restore_schedule_when_state_changes() {\n // Given\n Schedule schedule = new Schedule();\n presenter.schedule = schedule;\n\n // When\n presenter.onViewCreated(null, new Bundle());\n\n // Then\n verify(view).displaySchedule(sche...
{ "fields": [ { "declarator": "schedule", "modifier": "@State", "original_string": "@State Schedule schedule;", "type": "Schedule", "var_name": "schedule" }, { "declarator": "dataProvider", "modifier": "private final", "original_string": "private final DataP...
{ "body": "@Override\n public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n super.onViewCreated(view, savedInstanceState);\n if (schedule == null) {\n loadData();\n } else {\n this.view.displaySchedule(schedule);\n }\n }", "class_metho...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_33
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/PreconditionsTest.java", "identifier": "PreconditionsTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_do_nothing_when_argument_is_valid() {\n // Given\n boolean argument = true;\n\n // When\n Preconditions.checkArgument(argument);\n }", "class_method_signature": "PreconditionsTest.should_do_nothing_when_argument_is_valid()", "constructor": fa...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Preconditions.java", "identifier": "Preconditions", "interfaces": "", "methods": [ { "class_method_signature": "Preconditions.Preconditions()", "constructor": true, "full_signature": "private Preconditions()", ...
{ "body": "public static void checkArgument(boolean expression) {\n if (!expression) {\n throw new IllegalArgumentException();\n }\n }", "class_method_signature": "Preconditions.checkArgument(boolean expression)", "constructor": false, "full_signature": "public static void checkArgum...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_29
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock DrawerActivityView view;", "type": "DrawerActivityView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private DrawerPresente...
{ "body": "@Test\n public void should_close_navigation_drawer_when_pressing_back_if_already_opened() {\n // Given\n when(view.isNavigationDrawerOpen()).thenReturn(true);\n\n // When\n boolean result = presenter.onBackPressed();\n\n // Then\n assertThat(result).isTrue();\n ...
{ "fields": [ { "declarator": "toolbarTitle", "modifier": "@State @StringRes", "original_string": "@State @StringRes int toolbarTitle;", "type": "int", "var_name": "toolbarTitle" }, { "declarator": "selectedItemId", "modifier": "@State @IdRes", "original_str...
{ "body": "@Override\n public boolean onBackPressed() {\n if (view.isNavigationDrawerOpen()) {\n view.closeNavigationDrawer();\n return true;\n } else if (toolbarTitle != R.string.drawer_nav_schedule) {\n int firstItem = R.id.drawer_nav_schedule;\n onNaviga...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_13
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/data/app/model/SpeakerTest.java", "identifier": "SpeakerTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_restore_from_parcelable() {\n // Given\n Speaker speaker = new Speaker(24, \"Name\", \"Title\", \"Bio\", \"website\", \"Twitter\", \"Github\", \"photoUrl\");\n\n // When\n Parcel parcel = Parcel.obtain();\n speaker.writeToParcel(parcel, 0);\n...
{ "fields": [ { "declarator": "CREATOR = new Parcelable.Creator<Speaker>() {\n public Speaker createFromParcel(Parcel source) {\n return new Speaker(source);\n }\n\n public Speaker[] newArray(int size) {\n return new Speaker[size];\n }\n }", "modifi...
{ "body": "@Override\n public void writeToParcel(Parcel dest, int flags) {\n dest.writeInt(id);\n dest.writeString(name);\n dest.writeString(title);\n dest.writeString(bio);\n dest.writeString(website);\n dest.writeString(twitter);\n dest.writeString(github);\n ...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_2
{ "fields": [ { "declarator": "dbMapper", "modifier": "private", "original_string": "private DbMapper dbMapper;", "type": "DbMapper", "var_name": "dbMapper" }, { "declarator": "moshi = new Moshi.Builder().build()", "modifier": "private final", "original_stri...
{ "body": "@Test\n public void should_convert_db_sessions_to_app_sessions() {\n // Given\n when(adapter.fromText(\"now\")).thenReturn(now);\n com.nilhcem.droidcontn.data.database.model.Session session = new com.nilhcem.droidcontn.data.database.model.Session(2, \"now\", 10, 3, \"[1]\", \"title\...
{ "fields": [ { "declarator": "appMapper", "modifier": "private final", "original_string": "private final AppMapper appMapper;", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "localDateTimeAdapter", "modifier": "private final", "original_st...
{ "body": "public List<com.nilhcem.droidcontn.data.app.model.Session> toAppSessions(@NonNull List<Session> from, @NonNull Map<Integer, com.nilhcem.droidcontn.data.app.model.Speaker> speakersMap) {\n return stream(from).map(session -> {\n LocalDateTime fromTime = localDateTimeAdapter.fromText(session...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_44
{ "fields": [ { "declarator": "cursor", "modifier": "@Mock", "original_string": "@Mock Cursor cursor;", "type": "Cursor", "var_name": "cursor" } ], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/DatabaseTest.java", "identifier": "DatabaseTest", "interfaces": "", ...
{ "body": "@Test\n public void should_return_string_cursor_data() {\n // Given\n when(cursor.getColumnIndexOrThrow(\"column_name\")).thenReturn(42);\n when(cursor.getString(42)).thenReturn(\"string-data\");\n\n // When\n String result = Database.getString(cursor, \"column_name\")...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Database.java", "identifier": "Database", "interfaces": "", "methods": [ { "class_method_signature": "Database.getString(Cursor cursor, String columnName)", "constructor": false, "full_signature": "public static Stri...
{ "body": "public static String getString(Cursor cursor, String columnName) {\n return cursor.getString(cursor.getColumnIndexOrThrow(columnName));\n }", "class_method_signature": "Database.getString(Cursor cursor, String columnName)", "constructor": false, "full_signature": "public static String getSt...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_3
{ "fields": [ { "declarator": "dbMapper", "modifier": "private", "original_string": "private DbMapper dbMapper;", "type": "DbMapper", "var_name": "dbMapper" }, { "declarator": "moshi = new Moshi.Builder().build()", "modifier": "private final", "original_stri...
{ "body": "@Test\n public void should_convert_app_session_to_db_session() {\n // Given\n List<Speaker> speakers = singletonList(new Speaker(7, null, null, null, null, null, null, null));\n Session session = new Session(11, Room.CESAR_1.name, speakers, \"title\", \"description\", now, now.plusM...
{ "fields": [ { "declarator": "appMapper", "modifier": "private final", "original_string": "private final AppMapper appMapper;", "type": "AppMapper", "var_name": "appMapper" }, { "declarator": "localDateTimeAdapter", "modifier": "private final", "original_st...
{ "body": "public Session fromAppSession(@Nullable com.nilhcem.droidcontn.data.app.model.Session from) {\n if (from == null) {\n return null;\n }\n\n return new Session(from.getId(), localDateTimeAdapter.toText(from.getFromTime()),\n (int) ChronoUnit.MINUTES.between(from...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_45
{ "fields": [ { "declarator": "cursor", "modifier": "@Mock", "original_string": "@Mock Cursor cursor;", "type": "Cursor", "var_name": "cursor" } ], "file": "app/src/test/java/com/nilhcem/droidcontn/utils/DatabaseTest.java", "identifier": "DatabaseTest", "interfaces": "", ...
{ "body": "@Test\n public void should_return_int_cursor_data() {\n // Given\n when(cursor.getColumnIndexOrThrow(\"column_name\")).thenReturn(21);\n when(cursor.getInt(21)).thenReturn(10);\n\n // When\n int result = Database.getInt(cursor, \"column_name\");\n\n // Then\n ...
{ "fields": [], "file": "app/src/main/java/com/nilhcem/droidcontn/utils/Database.java", "identifier": "Database", "interfaces": "", "methods": [ { "class_method_signature": "Database.getString(Cursor cursor, String columnName)", "constructor": false, "full_signature": "public static Stri...
{ "body": "public static int getInt(Cursor cursor, String columnName) {\n return cursor.getInt(cursor.getColumnIndexOrThrow(columnName));\n }", "class_method_signature": "Database.getInt(Cursor cursor, String columnName)", "constructor": false, "full_signature": "public static int getInt(Cursor cursor...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_12
{ "fields": [], "file": "app/src/test/java/com/nilhcem/droidcontn/data/app/model/ScheduleTest.java", "identifier": "ScheduleTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void should_restore_from_parcelable() {\n // Given\n Schedule schedule = new Schedule();\n ScheduleDay day1 = new ScheduleDay(null, null);\n ScheduleDay day2 = new ScheduleDay(null, null);\n schedule.add(day1);\n schedule.add(day2);\n\n // ...
{ "fields": [ { "declarator": "CREATOR = new Parcelable.Creator<Schedule>() {\n public Schedule createFromParcel(Parcel source) {\n return new Schedule(source);\n }\n\n public Schedule[] newArray(int size) {\n return new Schedule[size];\n }\n }", "m...
{ "body": "@Override\n public void writeToParcel(Parcel dest, int flags) {\n dest.writeTypedList(this);\n }", "class_method_signature": "Schedule.writeToParcel(Parcel dest, int flags)", "constructor": false, "full_signature": "@Override public void writeToParcel(Parcel dest, int flags)", "identif...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_28
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock DrawerActivityView view;", "type": "DrawerActivityView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private DrawerPresente...
{ "body": "@Test\n public void should_show_speakers_fragment_when_selecting_speakers_from_the_navigation() {\n // Given\n presenter.selectedItemId = 0;\n\n // When\n presenter.onNavigationItemSelected(R.id.drawer_nav_speakers);\n\n // Then\n verify(view).showFragment(any(S...
{ "fields": [ { "declarator": "toolbarTitle", "modifier": "@State @StringRes", "original_string": "@State @StringRes int toolbarTitle;", "type": "int", "var_name": "toolbarTitle" }, { "declarator": "selectedItemId", "modifier": "@State @IdRes", "original_str...
{ "body": "@Override\n public void onNavigationItemSelected(@IdRes int itemId) {\n if (itemId != selectedItemId) {\n switch (itemId) {\n case R.id.drawer_nav_schedule:\n view.showFragment(new SchedulePagerFragmentBuilder(false).build());\n tool...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_32
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock DrawerActivityView view;", "type": "DrawerActivityView", "var_name": "view" }, { "declarator": "presenter", "modifier": "private", "original_string": "private DrawerPresente...
{ "body": "@Test\n public void should_restore_toolbar_title_when_state_changes() {\n // Given\n presenter.toolbarTitle = R.string.drawer_nav_speakers;\n\n // When\n presenter.onRestoreInstanceState(null);\n\n // Then\n verify(view).updateToolbarTitle(R.string.drawer_nav_sp...
{ "fields": [ { "declarator": "toolbarTitle", "modifier": "@State @StringRes", "original_string": "@State @StringRes int toolbarTitle;", "type": "int", "var_name": "toolbarTitle" }, { "declarator": "selectedItemId", "modifier": "@State @IdRes", "original_str...
{ "body": "@Override\n public void onRestoreInstanceState(Bundle savedInstanceState) {\n super.onRestoreInstanceState(savedInstanceState);\n view.updateToolbarTitle(toolbarTitle);\n }", "class_method_signature": "DrawerPresenter.onRestoreInstanceState(Bundle savedInstanceState)", "constructor"...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
49317403_24
{ "fields": [ { "declarator": "view", "modifier": "@Mock", "original_string": "@Mock SchedulePagerView view;", "type": "SchedulePagerView", "var_name": "view" }, { "declarator": "dataProvider", "modifier": "@Mock", "original_string": "@Mock DataProvider data...
{ "body": "@Test\n public void should_load_schedule_when_view_is_created() {\n // Given\n Schedule schedule = new Schedule();\n when(dataProvider.getSchedule()).thenReturn(Observable.just(schedule));\n\n // When\n presenter.onViewCreated(null, null);\n schedulerProxy.advan...
{ "fields": [ { "declarator": "schedule", "modifier": "@State", "original_string": "@State Schedule schedule;", "type": "Schedule", "var_name": "schedule" }, { "declarator": "dataProvider", "modifier": "private final", "original_string": "private final DataP...
{ "body": "@Override\n public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {\n super.onViewCreated(view, savedInstanceState);\n if (schedule == null) {\n loadData();\n } else {\n this.view.displaySchedule(schedule);\n }\n }", "class_metho...
{ "created": null, "fork": null, "fork_count": 2, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 49317403, "size": 1751, "stargazer_count": 28, "stars": null, "updates": null, "url": "https://github.com/Nilhcem/droidcontn-2016" }
6090885_0
{ "fields": [], "file": "degraphmalizer-core/src/test/java/dgm/streaming/requestmapper/RequestHandlerUtilTest.java", "identifier": "RequestHandlerUtilTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void testCreateStreamUrlPatternWithTwoValues() throws Exception {\n List<String> result = RequestHandlerUtil.getGroups(\"/createStream/1/abc\", CreateStreamRequestHandler.PATH_REGEX);\n assertEquals(\"two captures expected\", 2, result.size());\n assertEquals(\"First ...
{ "fields": [], "file": "degraphmalizer-core/src/main/java/dgm/streaming/requestmapper/RequestHandlerUtil.java", "identifier": "RequestHandlerUtil", "interfaces": "", "methods": [ { "class_method_signature": "RequestHandlerUtil.RequestHandlerUtil()", "constructor": true, "full_signature"...
{ "body": "public static List<String> getGroups(String path, String regex) {\n List<String> captures = new ArrayList<String>();\n Matcher m = Pattern.compile(regex).matcher(path);\n\n if (m.lookingAt()) {\n for (int i = 1; i <= m.groupCount(); i++) {\n if (m.group(i) != ...
{ "created": null, "fork": null, "fork_count": 8, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 6090885, "size": 928, "stargazer_count": 13, "stars": null, "updates": null, "url": "https://github.com/wires/degraphmalizer" }
6090885_1
{ "fields": [], "file": "degraphmalizer-core/src/test/java/dgm/streaming/requestmapper/RequestHandlerUtilTest.java", "identifier": "RequestHandlerUtilTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void testCreateStreamUrlPatternWithOneValues() throws Exception {\n List<String> result = RequestHandlerUtil.getGroups(\"/createStream/2\", CreateStreamRequestHandler.PATH_REGEX);\n assertEquals(\"one captures expected\", 1, result.size());\n assertEquals(\"First is '...
{ "fields": [], "file": "degraphmalizer-core/src/main/java/dgm/streaming/requestmapper/RequestHandlerUtil.java", "identifier": "RequestHandlerUtil", "interfaces": "", "methods": [ { "class_method_signature": "RequestHandlerUtil.RequestHandlerUtil()", "constructor": true, "full_signature"...
{ "body": "public static List<String> getGroups(String path, String regex) {\n List<String> captures = new ArrayList<String>();\n Matcher m = Pattern.compile(regex).matcher(path);\n\n if (m.lookingAt()) {\n for (int i = 1; i <= m.groupCount(); i++) {\n if (m.group(i) != ...
{ "created": null, "fork": null, "fork_count": 8, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 6090885, "size": 928, "stargazer_count": 13, "stars": null, "updates": null, "url": "https://github.com/wires/degraphmalizer" }
36268631_1
{ "fields": [], "file": "Profiles-Blog-Sender/src/test/java/org/jdw/blog/sender/SenderControllerTest.java", "identifier": "SenderControllerTest", "interfaces": "", "superclass": "extends BaseWebMvcJUnitTest" }
{ "body": "@Test\n public void testFindSendCount() throws Exception {\n // Relies on pre-existing mock data injected via Liquibase in the \"test\" profile\n\n ResultActions actions = mockMvc.perform(\n get(\"/\" + PayloadType.TEST1 + \"/count\"));\n MvcResult result = actions.an...
{ "fields": [ { "declarator": "sendCountService", "modifier": "@Autowired\n private", "original_string": "@Autowired\n private SendCountService sendCountService;", "type": "SendCountService", "var_name": "sendCountService" }, { "declarator": "payloadSender", ...
{ "body": "@RequestMapping(\"/{payloadType}/count\")\n public SendCount findSendCount(@PathVariable(\"payloadType\") PayloadType payloadType) {\n return sendCountService.findSendCount(payloadType);\n }", "class_method_signature": "SenderController.findSendCount(@PathVariable(\"payloadType\") PayloadTyp...
{ "created": null, "fork": null, "fork_count": 20, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 36268631, "size": 79, "stargazer_count": 29, "stars": null, "updates": null, "url": "https://github.com/jwilsoncredera/Profiles-Blog" }
36268631_0
{ "fields": [], "file": "Profiles-Blog-Receiver/src/test/java/org/jdw/blog/receiver/ReceiverControllerTest.java", "identifier": "ReceiverControllerTest", "interfaces": "", "superclass": "extends BaseWebMvcJUnitTest" }
{ "body": "@Test\n public void testFindReceiveCount() throws Exception {\n // Relies on pre-existing mock data injected via Liquibase in the \"test\" profile\n\n ResultActions actions = mockMvc.perform(\n get(\"/\" + PayloadType.TEST1 + \"/count\"));\n MvcResult result = actions...
{ "fields": [ { "declarator": "receiveCountService", "modifier": "@Autowired\n private", "original_string": "@Autowired\n private ReceiveCountService receiveCountService;", "type": "ReceiveCountService", "var_name": "receiveCountService" } ], "file": "Profiles-Blog-Rece...
{ "body": "@RequestMapping(\"/{payloadType}/count\")\n public ReceiveCount findReceiveCount(@PathVariable(\"payloadType\") PayloadType payloadType) {\n return receiveCountService.findReceiveCount(payloadType);\n }", "class_method_signature": "ReceiverController.findReceiveCount(@PathVariable(\"payloadT...
{ "created": null, "fork": null, "fork_count": 20, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 36268631, "size": 79, "stargazer_count": 29, "stars": null, "updates": null, "url": "https://github.com/jwilsoncredera/Profiles-Blog" }
11144122_0
{ "fields": [], "file": "its/plugin/projects/cobertura-example/src/test/java/HelloTest.java", "identifier": "HelloTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void shouldSayHello() throws InterruptedException {\n assertEquals(\"hi\", new Hello(\"hi\").say());\n Thread.sleep(1000); // This guarantees that execution time of test will not be too close to zero\n }", "class_method_signature": "HelloTest.shouldSayHello()", "constructor": fal...
{ "fields": [ { "declarator": "hello", "modifier": "private", "original_string": "private String hello;", "type": "String", "var_name": "hello" } ], "file": "its/plugin/projects/cobertura-example/src/main/java/Hello.java", "identifier": "Hello", "interfaces": "", "metho...
{ "body": "public String say() {\n return hello;\n }", "class_method_signature": "Hello.say()", "constructor": false, "full_signature": "public String say()", "identifier": "say", "invocations": [], "modifiers": "public", "parameters": "()", "return": "String", "signature": "String say()", "te...
{ "created": null, "fork": null, "fork_count": 24, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 11144122, "size": 243, "stargazer_count": 27, "stars": null, "updates": null, "url": "https://github.com/galexandre/sonar-cobertura" }
87590893_51
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/xfcc/XfccParserTest.java", "identifier": "XfccParserTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void parseCompoundHeaderWorks() {\n String header = \"By=http://frontend.lyft.com;Hash=468ed33be74eee6556d90c0149c1309e9ba61d6425303443c0748a02dd8de688;SAN=http://testclient.lyft.com,\" +\n \"By=http://backend.lyft.com;Hash=9ba61d6425303443c0748a02dd8de688468ed33be74...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/xfcc/XfccParser.java", "identifier": "XfccParser", "interfaces": "", "methods": [ { "class_method_signature": "XfccParser.XfccParser()", "constructor": true, "full_signature": "private XfccParser()",...
{ "body": "static List<XForwardedClientCert> parse(String header) {\n List<XForwardedClientCert> certs = new ArrayList<>();\n\n for (String element : quoteAwareSplit(header, ',')) {\n XForwardedClientCert cert = new XForwardedClientCert();\n List<String> substrings = quoteAwareSpli...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_7
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/ServersTest.java", "identifier": "ServersTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void shutdownGracefullyThrowsIfServerIsNull() {\n final long maxWaitTimeInMillis = ThreadLocalRandom.current().nextLong(1, Long.MAX_VALUE);\n\n assertThatThrownBy(() -> Servers.shutdownGracefully(null, maxWaitTimeInMillis))\n .isInstanceOf(NullPointerException...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Servers.java", "identifier": "Servers", "interfaces": "", "methods": [ { "class_method_signature": "Servers.shutdownGracefully(Server server, long maxWaitTimeInMillis)", "constructor": false, "full_si...
{ "body": "public static Server shutdownGracefully(Server server, long maxWaitTimeInMillis) throws InterruptedException {\n return shutdownGracefully(server, maxWaitTimeInMillis, TimeUnit.MILLISECONDS);\n }", "class_method_signature": "Servers.shutdownGracefully(Server server, long maxWaitTimeInMillis)", ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_47
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/xfcc/XfccParserTest.java", "identifier": "XfccParserTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void parseLegacySanHeaderWorks() {\n String header = \"By=http://frontend.lyft.com;Hash=468ed33be74eee6556d90c0149c1309e9ba61d6425303443c0748a02dd8de688;\" +\n \"SAN=http://testclient.lyft.com\";\n List<XForwardedClientCert> certs = XfccParser.parse(header);\n...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/xfcc/XfccParser.java", "identifier": "XfccParser", "interfaces": "", "methods": [ { "class_method_signature": "XfccParser.XfccParser()", "constructor": true, "full_signature": "private XfccParser()",...
{ "body": "static List<XForwardedClientCert> parse(String header) {\n List<XForwardedClientCert> certs = new ArrayList<>();\n\n for (String element : quoteAwareSplit(header, ',')) {\n XForwardedClientCert cert = new XForwardedClientCert();\n List<String> substrings = quoteAwareSpli...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_10
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/ServersTest.java", "identifier": "ServersTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void shutdownGracefullyCausesServerToProperlyShutdown() throws Exception {\n final Server server = mock(Server.class);\n final long maxWaitTimeInMillis = ThreadLocalRandom.current().nextLong(1, 10000);\n\n // Also assert that chaining works as expected.\n asser...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Servers.java", "identifier": "Servers", "interfaces": "", "methods": [ { "class_method_signature": "Servers.shutdownGracefully(Server server, long maxWaitTimeInMillis)", "constructor": false, "full_si...
{ "body": "public static Server shutdownGracefully(Server server, long maxWaitTimeInMillis) throws InterruptedException {\n return shutdownGracefully(server, maxWaitTimeInMillis, TimeUnit.MILLISECONDS);\n }", "class_method_signature": "Servers.shutdownGracefully(Server server, long maxWaitTimeInMillis)", ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_67
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/StatusesTest.java", "identifier": "StatusesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void hasStatusCodeReturnsFalseWrongType() {\n Throwable t = new IllegalStateException();\n assertThat(Statuses.hasStatusCode(t, Status.Code.UNAUTHENTICATED)).isFalse();\n }", "class_method_signature": "StatusesTest.hasStatusCodeReturnsFalseWrongType()", "constructor":...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Statuses.java", "identifier": "Statuses", "interfaces": "", "methods": [ { "class_method_signature": "Statuses.Statuses()", "constructor": true, "full_signature": "private Statuses()", "identif...
{ "body": "public static boolean hasStatusCode(Throwable t, Status.Code code) {\n if (!hasStatus(t)) {\n return false;\n } else {\n return doWithStatus(t, (status, metadata) -> status.getCode() == code);\n }\n }", "class_method_signature": "Statuses.hasStatusCode(Throwa...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_30
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/interceptor/DefaultCallOptionsClientInterceptorTest.java", "identifier": "DefaultCallOptionsClientInterceptorTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void simpleValueTransfers() {\n CallOptions baseOptions = CallOptions.DEFAULT;\n CallOptions defaultOptions = CallOptions.DEFAULT.withAuthority(\"FOO\");\n\n DefaultCallOptionsClientInterceptor interceptor = new DefaultCallOptionsClientInterceptor(defaultOptions);\n\n...
{ "fields": [ { "declarator": "CUSTOM_OPTIONS_FIELD = getCustomOptionsField()", "modifier": "private static final", "original_string": "private static final Field CUSTOM_OPTIONS_FIELD = getCustomOptionsField();", "type": "Field", "var_name": "CUSTOM_OPTIONS_FIELD" }, { ...
{ "body": "@VisibleForTesting\n CallOptions patchOptions(CallOptions baseOptions) {\n CallOptions patchedOptions = baseOptions;\n\n patchedOptions = patchOption(patchedOptions, CallOptions::getAuthority, CallOptions::withAuthority);\n patchedOptions = patchOption(patchedOptions, CallOptions::g...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_26
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/interceptor/AggregateServerInterceptorTest.java", "identifier": "AggregateServerInterceptorTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void TwoInterceptorsAreCalledInOrder() {\n AtomicBoolean interceptorOneCalled = new AtomicBoolean(false);\n AtomicBoolean interceptorTwoCalled = new AtomicBoolean(false);\n\n ServerInterceptor interceptorOne = new ServerInterceptor() {\n @Override\n ...
{ "fields": [ { "declarator": "interceptors", "modifier": "private final", "original_string": "private final List<ServerInterceptor> interceptors;", "type": "List<ServerInterceptor>", "var_name": "interceptors" } ], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/g...
{ "body": "@Override\n public <ReqT, RespT> ServerCall.Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call, Metadata headers, ServerCallHandler<ReqT, RespT> next) {\n // reverse the interceptors list so that the last interceptor to call is the most nested interceptor\n for (ServerInterceptor in...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_71
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/StatusesTest.java", "identifier": "StatusesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void doWithStatusThrowsWrongTypeFunction() {\n Throwable t = new IllegalStateException();\n assertThatThrownBy(() -> Statuses.doWithStatus(t, (status, metadata) -> true))\n .isInstanceOf(IllegalArgumentException.class);\n }", "class_method_signature": "St...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Statuses.java", "identifier": "Statuses", "interfaces": "", "methods": [ { "class_method_signature": "Statuses.Statuses()", "constructor": true, "full_signature": "private Statuses()", "identif...
{ "body": "public static void doWithStatus(Throwable t, BiConsumer<Status, Metadata> action) {\n doWithStatus(t, (status, metadata) -> {\n action.accept(status, metadata);\n return true;\n });\n }", "class_method_signature": "Statuses.doWithStatus(Throwable t, BiConsumer<Statu...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_70
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/StatusesTest.java", "identifier": "StatusesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void doWithStatusCallsFunction() {\n Metadata trailers = new Metadata();\n Throwable t = Status.NOT_FOUND.asRuntimeException(trailers);\n\n boolean called = Statuses.doWithStatus(t, (status, metadata) -> {\n assertThat(status.getCode()).isEqualTo(Status.Cod...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Statuses.java", "identifier": "Statuses", "interfaces": "", "methods": [ { "class_method_signature": "Statuses.Statuses()", "constructor": true, "full_signature": "private Statuses()", "identif...
{ "body": "public static void doWithStatus(Throwable t, BiConsumer<Status, Metadata> action) {\n doWithStatus(t, (status, metadata) -> {\n action.accept(status, metadata);\n return true;\n });\n }", "class_method_signature": "Statuses.doWithStatus(Throwable t, BiConsumer<Statu...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_27
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/interceptor/DefaultDeadlineInterceptorTest.java", "identifier": "DefaultDeadlineInterceptorTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void interceptorShouldAddDeadlineWhenAbsent() {\n AtomicBoolean called = new AtomicBoolean(false);\n\n DefaultDeadlineInterceptor interceptor = new DefaultDeadlineInterceptor(Duration.ofHours(1));\n\n interceptor.interceptCall(null, CallOptions.DEFAULT, new Channel() ...
{ "fields": [ { "declarator": "duration", "modifier": "private", "original_string": "private Duration duration;", "type": "Duration", "var_name": "duration" } ], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/interceptor/DefaultDeadlineInterceptor.jav...
{ "body": "@Override\n public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {\n // Only add a deadline if no other deadline has been set.\n if (callOptions.getDeadline() == null && Context.current().getDeadline() == nu...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_31
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/interceptor/DefaultCallOptionsClientInterceptorTest.java", "identifier": "DefaultCallOptionsClientInterceptorTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void clientStreamTracerTransfers() {\n ClientStreamTracer.Factory factory1 = new ClientStreamTracer.Factory() {};\n ClientStreamTracer.Factory factory2 = new ClientStreamTracer.Factory() {};\n\n CallOptions baseOptions = CallOptions.DEFAULT.withStreamTracerFactory(fac...
{ "fields": [ { "declarator": "CUSTOM_OPTIONS_FIELD = getCustomOptionsField()", "modifier": "private static final", "original_string": "private static final Field CUSTOM_OPTIONS_FIELD = getCustomOptionsField();", "type": "Field", "var_name": "CUSTOM_OPTIONS_FIELD" }, { ...
{ "body": "@VisibleForTesting\n CallOptions patchOptions(CallOptions baseOptions) {\n CallOptions patchedOptions = baseOptions;\n\n patchedOptions = patchOption(patchedOptions, CallOptions::getAuthority, CallOptions::withAuthority);\n patchedOptions = patchOption(patchedOptions, CallOptions::g...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_66
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/StatusesTest.java", "identifier": "StatusesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void hasStatusCodeReturnsFalseWrongCode() {\n Throwable t = Status.NOT_FOUND.asException();\n assertThat(Statuses.hasStatusCode(t, Status.Code.UNAUTHENTICATED)).isFalse();\n }", "class_method_signature": "StatusesTest.hasStatusCodeReturnsFalseWrongCode()", "constructo...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Statuses.java", "identifier": "Statuses", "interfaces": "", "methods": [ { "class_method_signature": "Statuses.Statuses()", "constructor": true, "full_signature": "private Statuses()", "identif...
{ "body": "public static boolean hasStatusCode(Throwable t, Status.Code code) {\n if (!hasStatus(t)) {\n return false;\n } else {\n return doWithStatus(t, (status, metadata) -> status.getCode() == code);\n }\n }", "class_method_signature": "Statuses.hasStatusCode(Throwa...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_11
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/ServersTest.java", "identifier": "ServersTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void shutdownGracefullyPropagatesAwaitInterrupt() throws Exception {\n final Server server = mock(Server.class);\n final long maxWaitTimeInMillis = ThreadLocalRandom.current().nextLong(1, 10000);\n\n final InterruptedException interruptedException = new InterruptedExc...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Servers.java", "identifier": "Servers", "interfaces": "", "methods": [ { "class_method_signature": "Servers.shutdownGracefully(Server server, long maxWaitTimeInMillis)", "constructor": false, "full_si...
{ "body": "public static Server shutdownGracefully(Server server, long maxWaitTimeInMillis) throws InterruptedException {\n return shutdownGracefully(server, maxWaitTimeInMillis, TimeUnit.MILLISECONDS);\n }", "class_method_signature": "Servers.shutdownGracefully(Server server, long maxWaitTimeInMillis)", ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_46
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/xfcc/XfccMarshallerTest.java", "identifier": "XfccMarshallerTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void malformedHeaderThrows() {\n XfccMarshaller marshaller = new XfccMarshaller();\n String header = \"KABOOM!\";\n assertThatThrownBy(() -> marshaller.parseAsciiString(header)).isInstanceOf(RuntimeException.class);\n }", "class_method_signature": "XfccMarshaller...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/xfcc/XfccMarshaller.java", "identifier": "XfccMarshaller", "interfaces": "implements Metadata.AsciiMarshaller<List<XForwardedClientCert>>", "methods": [ { "class_method_signature": "XfccMarshaller.toAsciiString(L...
{ "body": "@Override\n public List<XForwardedClientCert> parseAsciiString(String serialized) {\n return XfccParser.parse(serialized);\n }", "class_method_signature": "XfccMarshaller.parseAsciiString(String serialized)", "constructor": false, "full_signature": "@Override public List<XForwardedClient...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_6
{ "fields": [ { "declarator": "requestMappingHandlerAdapter", "modifier": "@Autowired\n public", "original_string": "@Autowired\n public RequestMappingHandlerAdapter requestMappingHandlerAdapter;", "type": "RequestMappingHandlerAdapter", "var_name": "requestMappingHandlerAdapte...
{ "body": "@Test\n public void handlesFailure() throws Exception {\n final AtomicReference<Object> value = new AtomicReference<>();\n Exception ex = new Exception(\"This is bad\");\n ListenableFuture<String> future = Futures.immediateFailedFuture(ex);\n\n GuavaLFReturnValueHandler handl...
{ "fields": [], "file": "contrib/grpc-spring/src/main/java/com/salesforce/grpc/contrib/spring/GuavaLFReturnValueHandler.java", "identifier": "GuavaLFReturnValueHandler", "interfaces": "implements HandlerMethodReturnValueHandler", "methods": [ { "class_method_signature": "GuavaLFReturnValueHandler.su...
{ "body": "@Override\n public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer,\n NativeWebRequest webRequest) throws Exception {\n if (returnValue == null) {\n mavContainer.setRequestHandled(true);\n ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_50
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/xfcc/XfccParserTest.java", "identifier": "XfccParserTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void parseUriAndDnsSanHeaderWorks() {\n String header = \"By=http://frontend.lyft.com;Hash=468ed33be74eee6556d90c0149c1309e9ba61d6425303443c0748a02dd8de688;Subject=\\\"/C=US/ST=CA/L=San Francisco/OU=Lyft/CN=Test Client\\\";URI=http://testclient.lyft.com;DNS=lyft.com;DNS=www.lyft.co...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/xfcc/XfccParser.java", "identifier": "XfccParser", "interfaces": "", "methods": [ { "class_method_signature": "XfccParser.XfccParser()", "constructor": true, "full_signature": "private XfccParser()",...
{ "body": "static List<XForwardedClientCert> parse(String header) {\n List<XForwardedClientCert> certs = new ArrayList<>();\n\n for (String element : quoteAwareSplit(header, ',')) {\n XForwardedClientCert cert = new XForwardedClientCert();\n List<String> substrings = quoteAwareSpli...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_61
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/MoreFuturesTest.java", "identifier": "MoreFuturesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void getDoneUncheckedThrowsForExplodingFuture() {\n final RuntimeException exception = new RuntimeException(UUID.randomUUID().toString());\n\n ListeningExecutorService executorService =\n MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());\n...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/MoreFutures.java", "identifier": "MoreFutures", "interfaces": "", "methods": [ { "class_method_signature": "MoreFutures.MoreFutures()", "constructor": true, "full_signature": "private MoreFutures()",...
{ "body": "@Deprecated\n public static <V> V getDoneUnchecked(Future<V> future) {\n /*\n * We throw IllegalStateException, since the call could succeed later. Perhaps we \"should\" throw\n * IllegalArgumentException, since the call could succeed with a different argument. Those\n * exceptions' docs ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_36
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/MoreMetadataTest.java", "identifier": "MoreMetadataTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void jsonMarshallerPrimitiveRoundtrip() {\n Metadata.AsciiMarshaller<Integer> marshaller = MoreMetadata.JSON_MARSHALLER(Integer.class);\n String s = marshaller.toAsciiString(42);\n assertThat(s).isEqualTo(\"42\");\n\n Integer l = marshaller.parseAsciiString(s);...
{ "fields": [ { "declarator": "BOOLEAN_MARSHALLER = new Metadata.AsciiMarshaller<Boolean>() {\n @Override\n public String toAsciiString(Boolean value) {\n return value.toString();\n }\n\n @Override\n public Boolean parseAsciiString(String serialized) {\n ...
{ "body": "public static <T> Metadata.AsciiMarshaller<T> JSON_MARSHALLER(Class<T> clazz) {\n return new Metadata.AsciiMarshaller<T>() {\n private TypeToken<T> typeToken = TypeToken.of(clazz);\n private Gson gson = new Gson();\n\n @Override\n public String toAsciiStri...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_20
{ "fields": [ { "declarator": "serverRule = new GrpcServerRule()", "modifier": "@Rule\n public final", "original_string": "@Rule\n public final GrpcServerRule serverRule = new GrpcServerRule();", "type": "GrpcServerRule", "var_name": "serverRule" } ], "file": "contrib/g...
{ "body": "@Test\n public void unexpectedExceptionCanMatch() {\n GreeterGrpc.GreeterImplBase svc = new GreeterGrpc.GreeterImplBase() {\n @Override\n public void sayHello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {\n throw new ArithmeticExcepti...
{ "fields": [ { "declarator": "exactTypes = new HashSet<>()", "modifier": "private final", "original_string": "private final Set<Class<? extends Throwable>> exactTypes = new HashSet<>();", "type": "Set<Class<? extends Throwable>>", "var_name": "exactTypes" }, { "declara...
{ "body": "public TransmitUnexpectedExceptionInterceptor forExactType(Class<? extends Throwable> exactType) {\n this.exactTypes.add(exactType);\n return this;\n }", "class_method_signature": "TransmitUnexpectedExceptionInterceptor.forExactType(Class<? extends Throwable> exactType)", "constructor"...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_57
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/MoreFuturesTest.java", "identifier": "MoreFuturesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void addCallbackFailure() {\n AtomicBoolean called = new AtomicBoolean(false);\n final Exception ex = new Exception();\n\n SettableFuture<Object> future = SettableFuture.create();\n MoreFutures.onFailure(\n future,\n e -> { assertE...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/MoreFutures.java", "identifier": "MoreFutures", "interfaces": "", "methods": [ { "class_method_signature": "MoreFutures.MoreFutures()", "constructor": true, "full_signature": "private MoreFutures()",...
{ "body": "public static <V> void onFailure(@Nonnull final ListenableFuture<V> future,\n @Nonnull final Consumer<Throwable> failure,\n @Nonnull final Executor executor) {\n checkNotNull(future, \"future\");\n checkNotNull(failure, \...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_1
{ "fields": [], "file": "contrib/grpc-spring/src/test/java/com/salesforce/grpc/contrib/spring/GrpcServerHostTest.java", "identifier": "GrpcServerHostTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void startThrowsForBadServices() {\n final String badService1 = UUID.randomUUID().toString();\n final String badService2 = UUID.randomUUID().toString();\n final String goodService = UUID.randomUUID().toString();\n final int port = ThreadLocalRandom.current().ne...
{ "fields": [ { "declarator": "MAX_PORT = 65535", "modifier": "static final", "original_string": "static final int MAX_PORT = 65535;", "type": "int", "var_name": "MAX_PORT" }, { "declarator": "MIN_PORT = 0", "modifier": "static final", "original_string": "st...
{ "body": "@Override\n public void setApplicationContext(@Nonnull ApplicationContext applicationContext) throws BeansException {\n this.applicationContext = Preconditions.checkNotNull(applicationContext);\n }", "class_method_signature": "GrpcServerHost.setApplicationContext(@Nonnull ApplicationContext ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_41
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/context/AmbientContextTest.java", "identifier": "AmbientContextTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void contextThawingNotFrozenThrows() {\n AmbientContext context = new AmbientContext();\n assertThatThrownBy(() -> context.thaw(new Object())).isInstanceOf(IllegalStateException.class);\n }", "class_method_signature": "AmbientContextTest.contextThawingNotFrozenThrows()"...
{ "fields": [ { "declarator": "DATA_KEY = Context.key(\"AmbientContext\")", "modifier": "static final", "original_string": "static final Context.Key<AmbientContext> DATA_KEY = Context.key(\"AmbientContext\");", "type": "Context.Key<AmbientContext>", "var_name": "DATA_KEY" }, ...
{ "body": "public void thaw(Object freezeKey) {\n checkState(isFrozen(), \"AmbientContext is not frozen. Cannot thaw().\");\n checkArgument(this.freezeKey == freezeKey,\n \"The provided freezeKey is not the same object returned by freeze()\");\n this.freezeKey = null;\n }", "c...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_16
{ "fields": [ { "declarator": "serverRule = new GrpcServerRule()", "modifier": "@Rule\n public final", "original_string": "@Rule\n public final GrpcServerRule serverRule = new GrpcServerRule();", "type": "GrpcServerRule", "var_name": "serverRule" } ], "file": "contrib/g...
{ "body": "@Test\n public void parentTypeMatches() {\n GreeterGrpc.GreeterImplBase svc = new GreeterGrpc.GreeterImplBase() {\n @Override\n public void sayHello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {\n responseObserver.onError(new Arithmet...
{ "fields": [ { "declarator": "exactTypes = new HashSet<>()", "modifier": "private final", "original_string": "private final Set<Class<? extends Throwable>> exactTypes = new HashSet<>();", "type": "Set<Class<? extends Throwable>>", "var_name": "exactTypes" }, { "declara...
{ "body": "public TransmitUnexpectedExceptionInterceptor forParentType(Class<? extends Throwable> parentType) {\n this.parentTypes.add(parentType);\n return this;\n }", "class_method_signature": "TransmitUnexpectedExceptionInterceptor.forParentType(Class<? extends Throwable> parentType)", "constr...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_17
{ "fields": [ { "declarator": "serverRule = new GrpcServerRule()", "modifier": "@Rule\n public final", "original_string": "@Rule\n public final GrpcServerRule serverRule = new GrpcServerRule();", "type": "GrpcServerRule", "var_name": "serverRule" } ], "file": "contrib/g...
{ "body": "@Test\n public void parentTypeMatchesExactly() {\n GreeterGrpc.GreeterImplBase svc = new GreeterGrpc.GreeterImplBase() {\n @Override\n public void sayHello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {\n responseObserver.onError(new R...
{ "fields": [ { "declarator": "exactTypes = new HashSet<>()", "modifier": "private final", "original_string": "private final Set<Class<? extends Throwable>> exactTypes = new HashSet<>();", "type": "Set<Class<? extends Throwable>>", "var_name": "exactTypes" }, { "declara...
{ "body": "public TransmitUnexpectedExceptionInterceptor forParentType(Class<? extends Throwable> parentType) {\n this.parentTypes.add(parentType);\n return this;\n }", "class_method_signature": "TransmitUnexpectedExceptionInterceptor.forParentType(Class<? extends Throwable> parentType)", "constr...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_40
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/context/AmbientContextTest.java", "identifier": "AmbientContextTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void contextDoubleFreezingThrows() {\n AmbientContext context = new AmbientContext();\n context.freeze();\n assertThatThrownBy(context::freeze).isInstanceOf(IllegalStateException.class);\n }", "class_method_signature": "AmbientContextTest.contextDoubleFreezingThr...
{ "fields": [ { "declarator": "DATA_KEY = Context.key(\"AmbientContext\")", "modifier": "static final", "original_string": "static final Context.Key<AmbientContext> DATA_KEY = Context.key(\"AmbientContext\");", "type": "Context.Key<AmbientContext>", "var_name": "DATA_KEY" }, ...
{ "body": "public Object freeze() {\n checkState(!isFrozen(), \"AmbientContext already frozen. Cannot freeze() twice.\");\n freezeKey = new Object();\n return freezeKey;\n }", "class_method_signature": "AmbientContext.freeze()", "constructor": false, "full_signature": "public Object free...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_0
{ "fields": [], "file": "contrib/grpc-spring/src/test/java/com/salesforce/grpc/contrib/spring/GrpcServerHostTest.java", "identifier": "GrpcServerHostTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void constructorSetsFieldsCorrectly() {\n final int port = ThreadLocalRandom.current().nextInt(1000, 10000);\n final long shutdownWaitTimeInMillis = ThreadLocalRandom.current().nextLong(1000, 10000);\n\n final ApplicationContext applicationContext = mock(ApplicationCo...
{ "fields": [ { "declarator": "MAX_PORT = 65535", "modifier": "static final", "original_string": "static final int MAX_PORT = 65535;", "type": "int", "var_name": "MAX_PORT" }, { "declarator": "MIN_PORT = 0", "modifier": "static final", "original_string": "st...
{ "body": "@Override\n public void setApplicationContext(@Nonnull ApplicationContext applicationContext) throws BeansException {\n this.applicationContext = Preconditions.checkNotNull(applicationContext);\n }", "class_method_signature": "GrpcServerHost.setApplicationContext(@Nonnull ApplicationContext ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_56
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/MoreFuturesTest.java", "identifier": "MoreFuturesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void addCallbackSuccess() {\n AtomicBoolean called = new AtomicBoolean(false);\n final Object value = new Object();\n\n SettableFuture<Object> future = SettableFuture.create();\n MoreFutures.onSuccess(\n future,\n o -> { assertEqua...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/MoreFutures.java", "identifier": "MoreFutures", "interfaces": "", "methods": [ { "class_method_signature": "MoreFutures.MoreFutures()", "constructor": true, "full_signature": "private MoreFutures()",...
{ "body": "public static <V> void onSuccess(@Nonnull final ListenableFuture<V> future,\n @Nonnull final Consumer<V> success,\n @Nonnull final Executor executor) {\n checkNotNull(future, \"future\");\n checkNotNull(success, \"success...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_21
{ "fields": [ { "declarator": "serverRule = new GrpcServerRule()", "modifier": "@Rule\n public final", "original_string": "@Rule\n public final GrpcServerRule serverRule = new GrpcServerRule();", "type": "GrpcServerRule", "var_name": "serverRule" } ], "file": "contrib/g...
{ "body": "@Test\n public void unexpectedExceptionCanNotMatch() {\n GreeterGrpc.GreeterImplBase svc = new GreeterGrpc.GreeterImplBase() {\n @Override\n public void sayHello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {\n throw new ArithmeticExce...
{ "fields": [ { "declarator": "exactTypes = new HashSet<>()", "modifier": "private final", "original_string": "private final Set<Class<? extends Throwable>> exactTypes = new HashSet<>();", "type": "Set<Class<? extends Throwable>>", "var_name": "exactTypes" }, { "declara...
{ "body": "public TransmitUnexpectedExceptionInterceptor forExactType(Class<? extends Throwable> exactType) {\n this.exactTypes.add(exactType);\n return this;\n }", "class_method_signature": "TransmitUnexpectedExceptionInterceptor.forExactType(Class<? extends Throwable> exactType)", "constructor"...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_37
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/MoreMetadataTest.java", "identifier": "MoreMetadataTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void protobufMarshallerRoundtrip() {\n HelloRequest request = HelloRequest.newBuilder().setName(\"World\").build();\n\n Metadata.BinaryMarshaller<HelloRequest> marshaller = MoreMetadata.PROTOBUF_MARSHALLER(HelloRequest.class);\n byte[] bytes = marshaller.toBytes(reque...
{ "fields": [ { "declarator": "BOOLEAN_MARSHALLER = new Metadata.AsciiMarshaller<Boolean>() {\n @Override\n public String toAsciiString(Boolean value) {\n return value.toString();\n }\n\n @Override\n public Boolean parseAsciiString(String serialized) {\n ...
{ "body": "public static <T extends GeneratedMessageV3> Metadata.BinaryMarshaller<T> PROTOBUF_MARSHALLER(Class<T> clazz) {\n try {\n Method defaultInstance = clazz.getMethod(\"getDefaultInstance\");\n GeneratedMessageV3 instance = (GeneratedMessageV3) defaultInstance.invoke(null);\n\n ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_60
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/MoreFuturesTest.java", "identifier": "MoreFuturesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void getDoneUncheckedThrowsForCancelledFuture() {\n ListenableFuture<String> future = Futures.immediateCancelledFuture();\n\n assertThatThrownBy(() -> MoreFutures.getDoneUnchecked(future))\n .isInstanceOf(IllegalStateException.class);\n }", "class_method_...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/MoreFutures.java", "identifier": "MoreFutures", "interfaces": "", "methods": [ { "class_method_signature": "MoreFutures.MoreFutures()", "constructor": true, "full_signature": "private MoreFutures()",...
{ "body": "@Deprecated\n public static <V> V getDoneUnchecked(Future<V> future) {\n /*\n * We throw IllegalStateException, since the call could succeed later. Perhaps we \"should\" throw\n * IllegalArgumentException, since the call could succeed with a different argument. Those\n * exceptions' docs ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_22
{ "fields": [ { "declarator": "serverRule = new GrpcServerRule()", "modifier": "@Rule\n public final", "original_string": "@Rule\n public final GrpcServerRule serverRule = new GrpcServerRule();", "type": "GrpcServerRule", "var_name": "serverRule" } ], "file": "contrib/g...
{ "body": "@Test\n public void unexpectedExceptionCanMatchStreaming() {\n GreeterGrpc.GreeterImplBase svc = new GreeterGrpc.GreeterImplBase() {\n @Override\n public void sayHelloStream(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {\n responseObse...
{ "fields": [ { "declarator": "exactTypes = new HashSet<>()", "modifier": "private final", "original_string": "private final Set<Class<? extends Throwable>> exactTypes = new HashSet<>();", "type": "Set<Class<? extends Throwable>>", "var_name": "exactTypes" }, { "declara...
{ "body": "public TransmitUnexpectedExceptionInterceptor forExactType(Class<? extends Throwable> exactType) {\n this.exactTypes.add(exactType);\n return this;\n }", "class_method_signature": "TransmitUnexpectedExceptionInterceptor.forExactType(Class<? extends Throwable> exactType)", "constructor"...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_34
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/interceptor/DefaultCallOptionsClientInterceptorTest.java", "identifier": "DefaultCallOptionsClientInterceptorTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void noOverwriteWorksCustomKeys() {\n CallOptions.Key<String> k1 = CallOptions.Key.of(\"k1\", null);\n CallOptions.Key<String> k2 = CallOptions.Key.of(\"k2\", null);\n CallOptions.Key<String> k3 = CallOptions.Key.of(\"k3\", null);\n\n CallOptions baseOptions = ...
{ "fields": [ { "declarator": "CUSTOM_OPTIONS_FIELD = getCustomOptionsField()", "modifier": "private static final", "original_string": "private static final Field CUSTOM_OPTIONS_FIELD = getCustomOptionsField();", "type": "Field", "var_name": "CUSTOM_OPTIONS_FIELD" }, { ...
{ "body": "@VisibleForTesting\n CallOptions patchOptions(CallOptions baseOptions) {\n CallOptions patchedOptions = baseOptions;\n\n patchedOptions = patchOption(patchedOptions, CallOptions::getAuthority, CallOptions::withAuthority);\n patchedOptions = patchOption(patchedOptions, CallOptions::g...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_63
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/StatusesTest.java", "identifier": "StatusesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void hasStatusReturnsTrueStatusRuntimeException() {\n Throwable t = Status.INTERNAL.asRuntimeException();\n assertThat(Statuses.hasStatus(t)).isTrue();\n }", "class_method_signature": "StatusesTest.hasStatusReturnsTrueStatusRuntimeException()", "constructor": false, ...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/Statuses.java", "identifier": "Statuses", "interfaces": "", "methods": [ { "class_method_signature": "Statuses.Statuses()", "constructor": true, "full_signature": "private Statuses()", "identif...
{ "body": "public static boolean hasStatus(Throwable t) {\n return t instanceof StatusException || t instanceof StatusRuntimeException;\n }", "class_method_signature": "Statuses.hasStatus(Throwable t)", "constructor": false, "full_signature": "public static boolean hasStatus(Throwable t)", "identifi...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_18
{ "fields": [ { "declarator": "serverRule = new GrpcServerRule()", "modifier": "@Rule\n public final", "original_string": "@Rule\n public final GrpcServerRule serverRule = new GrpcServerRule();", "type": "GrpcServerRule", "var_name": "serverRule" } ], "file": "contrib/g...
{ "body": "@Test\n public void alleMatches() {\n GreeterGrpc.GreeterImplBase svc = new GreeterGrpc.GreeterImplBase() {\n @Override\n public void sayHello(HelloRequest request, StreamObserver<HelloResponse> responseObserver) {\n responseObserver.onError(new ArithmeticExce...
{ "fields": [ { "declarator": "exactTypes = new HashSet<>()", "modifier": "private final", "original_string": "private final Set<Class<? extends Throwable>> exactTypes = new HashSet<>();", "type": "Set<Class<? extends Throwable>>", "var_name": "exactTypes" }, { "declara...
{ "body": "public TransmitUnexpectedExceptionInterceptor forAllExceptions() {\n return forParentType(Throwable.class);\n }", "class_method_signature": "TransmitUnexpectedExceptionInterceptor.forAllExceptions()", "constructor": false, "full_signature": "public TransmitUnexpectedExceptionInterceptor for...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }
87590893_59
{ "fields": [], "file": "contrib/grpc-contrib/src/test/java/com/salesforce/grpc/contrib/MoreFuturesTest.java", "identifier": "MoreFuturesTest", "interfaces": "", "superclass": "" }
{ "body": "@Test\n public void getDoneUncheckedThrowsForIncompleteFuture() {\n ListeningExecutorService executorService =\n MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor());\n\n CountDownLatch latch = new CountDownLatch(1);\n\n ListenableFuture<String> futur...
{ "fields": [], "file": "contrib/grpc-contrib/src/main/java/com/salesforce/grpc/contrib/MoreFutures.java", "identifier": "MoreFutures", "interfaces": "", "methods": [ { "class_method_signature": "MoreFutures.MoreFutures()", "constructor": true, "full_signature": "private MoreFutures()",...
{ "body": "@Deprecated\n public static <V> V getDoneUnchecked(Future<V> future) {\n /*\n * We throw IllegalStateException, since the call could succeed later. Perhaps we \"should\" throw\n * IllegalArgumentException, since the call could succeed with a different argument. Those\n * exceptions' docs ...
{ "created": null, "fork": null, "fork_count": 27, "is_fork": false, "language": "Java", "license": "licensed", "repo_id": 87590893, "size": 535, "stargazer_count": 159, "stars": null, "updates": null, "url": "https://github.com/salesforce/grpc-java-contrib" }