id
stringlengths
23
25
content
stringlengths
5.51k
455k
max_stars_repo_path
stringlengths
46
115
code_ujb_testgen_data_101
public void testReset() throws Exception { final List<String> list = Arrays.asList("a", "b", "c"); final LoopingIterator<String> loop = new LoopingIterator<String>(list); assertEquals("a", loop.next()); assertEquals("b", loop.next()); loop.reset(); assertEquals("a", ...
src/test/java/org/apache/commons/collections4/iterators/LoopingIteratorTest.java
code_ujb_testgen_data_102
public void testKeywords() throws Exception { final String DOC = "{\n" +"\"key1\" : null,\n" +"\"key2\" : true,\n" +"\"key3\" : false,\n" +"\"key4\" : [ false, null, true ]\n" +"}" ; JsonParser p = createParserUsingStream(J...
src/test/java/com/fasterxml/jackson/core/read/JsonParserTest.java
code_ujb_testgen_data_103
@Test public void testRule1() throws EncoderException { this.assertEncodings( new String[] { "MACX", "MCX" }, new String[] { "KNX", "NX" }, new String[] { "KX", "CX" }, new String[] { "PHX", "FX" }, new String[] { "PFX", "FX...
src/test/java/org/apache/commons/codec/language/NysiisTest.java
code_ujb_testgen_data_104
public void testCreateCopy1() { TimeSeries series = new TimeSeries("Series"); series.add(new Month(MonthConstants.JANUARY, 2003), 45.0); series.add(new Month(MonthConstants.FEBRUARY, 2003), 55.0); series.add(new Month(MonthConstants.JUNE, 2003), 35.0); series.add(new Month(M...
tests/org/jfree/data/time/junit/TimeSeriesTests.java
code_ujb_testgen_data_105
public void testBasicConfig() throws IOException { TokenBuffer buf; buf = new TokenBuffer(MAPPER, false); assertEquals(MAPPER.version(), buf.version()); assertSame(MAPPER, buf.getCodec()); assertNotNull(buf.getOutputContext()); assertFalse(buf.isClosed()); ...
src/test/java/com/fasterxml/jackson/databind/util/TestTokenBuffer.java
code_ujb_testgen_data_106
public void testEquals() { MeterPlot plot1 = new MeterPlot(); MeterPlot plot2 = new MeterPlot(); assertTrue(plot1.equals(plot2)); // units plot1.setUnits("mph"); assertFalse(plot1.equals(plot2)); plot2.setUnits("mph"); assertTrue(plot1.equals(plot2));...
tests/org/jfree/chart/plot/junit/MeterPlotTests.java
code_ujb_testgen_data_107
@SuppressWarnings("unchecked") public void testSetIterator() { final Iterator<E> iter1 = Collections.singleton((E) new Object()).iterator(); final Iterator<E> iter2 = Collections.<E>emptyList().iterator(); final FilterIterator<E> filterIterator = new FilterIterator<E>(iter1); fi...
src/test/java/org/apache/commons/collections4/iterators/FilterIteratorTest.java
code_ujb_testgen_data_108
public void testUseExportsAsExterns() { String librarySource = "/**\n" + " * @param {number} a\n" + " * @constructor\n" + " */\n" + "var InternalName = function(a) {" + "};" + "goog.exportSymbol('ExternalName', InternalName)"; String clientSource = "var a = new ExternalName(...
test/com/google/javascript/jscomp/ExternExportsPassTest.java
code_ujb_testgen_data_109
public void testDelegatedMethods() { DateTimeField fieldOne = UnsupportedDateTimeField.getInstance( dateTimeFieldTypeOne, UnsupportedDurationField .getInstance(weeks)); PreciseDurationField hoursDuration = new PreciseDurationField( DurationFiel...
src/test/java/org/joda/time/field/TestUnsupportedDateTimeField.java
code_ujb_testgen_data_110
public void testRawCollections() { TypeFactory tf = TypeFactory.defaultInstance(); JavaType type = tf.constructRawCollectionType(ArrayList.class); assertTrue(type.isContainerType()); assertEquals(TypeFactory.unknownType(), type.getContentType()); type = tf.constructRawCol...
src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory.java
code_ujb_testgen_data_111
public void testDelegateBeanInstantiator() throws Exception { ObjectMapper mapper = new ObjectMapper(); mapper.registerModule(new MyModule(MyBean.class, new MyDelegateBeanInstantiator())); MyBean bean = mapper.readValue("123", MyBean.class); assertNotNull(bean); assertEqu...
src/test/java/com/fasterxml/jackson/databind/deser/creators/TestValueInstantiator.java
code_ujb_testgen_data_112
public void testSparsePopulation() { DefaultKeyedValues2D d = new DefaultKeyedValues2D(); d.addValue(new Integer(11), "R1", "C1"); d.addValue(new Integer(22), "R2", "C2"); assertEquals(new Integer(11), d.getValue("R1", "C1")); assertNull(d.getValue("R1", "C2")); asse...
tests/org/jfree/data/junit/DefaultKeyedValues2DTests.java
code_ujb_testgen_data_113
@Test public void testAcquireMultiplePeriods() throws InterruptedException { final int count = 1000; final TimedSemaphoreTestImpl semaphore = new TimedSemaphoreTestImpl( PERIOD / 10, TimeUnit.MILLISECONDS, 1); semaphore.setLimit(count / 4); final CountDownLatch la...
src/test/java/org/apache/commons/lang3/concurrent/TimedSemaphoreTest.java
code_ujb_testgen_data_114
public void testSerialization5() { XYSeriesCollection dataset1 = new XYSeriesCollection(); NumberAxis domainAxis1 = new NumberAxis("Domain 1"); NumberAxis rangeAxis1 = new NumberAxis("Range 1"); StandardXYItemRenderer renderer1 = new StandardXYItemRenderer(); XYPlot p1 = new ...
tests/org/jfree/chart/plot/junit/XYPlotTests.java
code_ujb_testgen_data_115
@Test public void testRemoveWithoutCallingNext() { List<E> testListCopy = new ArrayList<E>(testList); Iterator<E> iter = new SkippingIterator<E>(testListCopy.iterator(), 1); try { iter.remove(); fail("Expected IllegalStateException."); } catch (IllegalSta...
src/test/java/org/apache/commons/collections4/iterators/SkippingIteratorTest.java
code_ujb_testgen_data_116
@Test public void testSimpleDate() { final Calendar cal = Calendar.getInstance(); final DatePrinter format = getInstance(YYYY_MM_DD); cal.set(2004,11,31); assertEquals("2004/12/31", format.format(cal)); cal.set(999,11,31); assertEquals("0999/12/31", format.format...
src/test/java/org/apache/commons/lang3/time/FastDatePrinterTest.java
code_ujb_testgen_data_117
public void test2502355_zoomOutDomain() { DefaultXYDataset dataset = new DefaultXYDataset(); JFreeChart chart = ChartFactory.createXYLineChart("TestChart", "X", "Y", dataset, false); XYPlot plot = (XYPlot) chart.getPlot(); plot.setDomainAxis(1, new NumberAxis("X2")); ...
tests/org/jfree/chart/junit/ChartPanelTests.java
code_ujb_testgen_data_118
public void testNameMangle() { assertEquals("foo", BeanUtil.legacyManglePropertyName("getFoo", 3)); assertEquals("foo", BeanUtil.stdManglePropertyName("getFoo", 3)); assertEquals("url", BeanUtil.legacyManglePropertyName("getURL", 3)); assertEquals("URL", BeanUtil.stdMangleProper...
src/test/java/com/fasterxml/jackson/databind/util/BeanUtilTest.java
code_ujb_testgen_data_119
public void testSimpleTypes() { Class<?>[] classes = new Class<?>[] { boolean.class, byte.class, char.class, short.class, int.class, long.class, float.class, double.class, Boolean.class, Byte.class, Character.class, Short.class, In...
src/test/java/com/fasterxml/jackson/databind/type/TestTypeFactory.java
code_ujb_testgen_data_120
public void testRectangle2DDoubleSerialization() { Rectangle2D r1 = new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0); Rectangle2D r2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(buffer); ...
tests/org/jfree/chart/util/junit/SerialUtilitiesTests.java
code_ujb_testgen_data_121
@Test public void testRelativeToleranceOnScaledValues() { final MultivariateFunction func = new MultivariateFunction() { public double value(double[] x) { final double a = x[0] - 1; final double b = x[1] - 1; return a * a * Fast...
src/test/java/org/apache/commons/math3/optim/nonlinear/scalar/noderiv/PowellOptimizerTest.java
code_ujb_testgen_data_122
public void testBug592170() throws Exception { testTypes( "/** @param {Function} opt_f ... */" + "function foo(opt_f) {" + " /** @type {Function} */" + " return opt_f || function () {};" + "}", "Type annotations are not allowed here. Are you missing parentheses?")...
test/com/google/javascript/jscomp/TypeCheckTest.java
code_ujb_testgen_data_123
public void testWithJsonParserSequenceSimple() throws IOException { // Let's join a TokenBuffer with JsonParser first TokenBuffer buf = new TokenBuffer(null, false); buf.writeStartArray(); buf.writeString("test"); JsonParser p = createParserUsingReader("[ true, null ]"); ...
src/test/java/com/fasterxml/jackson/databind/util/TestTokenBuffer.java
code_ujb_testgen_data_124
@Test public void testAddInitializerAfterStart() throws ConcurrentException { initializer.start(); try { initializer.addInitializer(CHILD_INIT, new ChildBackgroundInitializer()); fail("Could add initializer after start()!"); } catch (final Ille...
src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java
code_ujb_testgen_data_125
public void testArgumentChecking() throws Exception { final ObjectWriter w = MAPPER.writer(); try { w.acceptJsonFormatVisitor((JavaType) null, null); fail("Should not pass"); } catch (IllegalArgumentException e) { verifyException(e, "type must be provi...
src/test/java/com/fasterxml/jackson/databind/ObjectWriterTest.java
code_ujb_testgen_data_126
public void testSetMaximumItemCount() { TimeSeries s1 = new TimeSeries("S1"); s1.add(new Year(2000), 13.75); s1.add(new Year(2001), 11.90); s1.add(new Year(2002), null); s1.add(new Year(2005), 19.32); s1.add(new Year(2007), 16.89); assertTrue(s1.getItemCount()...
tests/org/jfree/data/time/junit/TimeSeriesTests.java
code_ujb_testgen_data_127
@Test public void testLoad() throws Exception { // Load from a URL empiricalDistribution.load(url); checkDistribution(); // Load again from a file (also verifies idempotency of load) File file = new File(url.toURI()); empiricalDistribution.load(file); ...
src/test/java/org/apache/commons/math3/random/EmpiricalDistributionTest.java
code_ujb_testgen_data_128
@Test public void testInitializeChildWithExecutor() throws ConcurrentException { final String initExec = "childInitializerWithExecutor"; final ExecutorService exec = Executors.newSingleThreadExecutor(); try { final ChildBackgroundInitializer c1 = new ChildBackgroundInitialize...
src/test/java/org/apache/commons/lang3/concurrent/MultiBackgroundInitializerTest.java
code_ujb_testgen_data_129
public void testMissingType() throws Exception { ObjectReader r = MAPPER.reader(); try { r.readValue("1"); fail("Should not pass"); } catch (JsonMappingException e) { verifyException(e, "No value type configured"); } } // @Override // ...
src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java
code_ujb_testgen_data_130
public void testTreeToValue() throws Exception { ArrayNode n = MAPPER.createArrayNode(); n.add("xyz"); ObjectReader r = MAPPER.readerFor(String.class); List<?> list = r.treeToValue(n, List.class); assertEquals(1, list.size()); } // @Override // public void wr...
src/test/java/com/fasterxml/jackson/databind/ObjectReaderTest.java
code_ujb_testgen_data_131
@Test public void testQuinticFunction2() { // p(x) = x^5 + 4x^3 + x^2 + 4 = (x+1)(x^2-x+1)(x^2+4) final double[] coefficients = { 4.0, 0.0, 1.0, 4.0, 0.0, 1.0 }; final LaguerreSolver solver = new LaguerreSolver(); final Complex[] result = solver.solveAllComplex(coefficients, 0); ...
src/test/java/org/apache/commons/math3/analysis/solvers/LaguerreSolverTest.java
code_ujb_testgen_data_132
public void testPreviousStandardDateMillisecondB() { MyDateAxis axis = new MyDateAxis("Millisecond"); Millisecond m0 = new Millisecond(458, 58, 31, 12, 1, 4, 2007); Millisecond m1 = new Millisecond(459, 58, 31, 12, 1, 4, 2007); Date d0 = new Date(m0.getFirstMillisecond()); D...
tests/org/jfree/chart/axis/junit/DateAxisTests.java
code_ujb_testgen_data_133
@Test public void testRound() throws Exception { // tests for public static Date round(Date date, int field) assertEquals("round year-1 failed", dateParser.parse("January 1, 2002"), DateUtils.round(date1, Calendar.YEAR)); assertEquals("round year-2 failed"...
src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
code_ujb_testgen_data_134
@Test public void testNthRoot_cornercase_thirdRoot_imaginaryPartEmpty() { // The number 8 has three third roots. One we all already know is the number 2. // But there are two more complex roots. Complex z = new Complex(8,0); // The List holding all third roots Complex[] t...
src/test/java/org/apache/commons/math3/complex/ComplexTest.java
code_ujb_testgen_data_135
@Test public void testMessageWithCorruptFileName() throws Exception { try (ZipArchiveInputStream in = new ZipArchiveInputStream(new FileInputStream(getFile("COMPRESS-351.zip")))) { ZipArchiveEntry ze = in.getNextZipEntry(); while (ze != null) { ze = in.getNextZipE...
src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
code_ujb_testgen_data_136
public void testSecond() { aDateTime = getADate( "1969-12-31T23:59:58" ); bDateTime = getADate( "1969-12-31T23:50:59" ); assertEquals( "SecondM1a", -1, cSecond.compare( aDateTime, bDateTime ) ); assertEquals( "SecondP1a", 1, cSecond.compare( bDateTime, aDateTime ) ); aDateTim...
src/test/java/org/joda/time/TestDateTimeComparator.java
code_ujb_testgen_data_137
@Test public void testGLSEfficiency() { RandomGenerator rg = new JDKRandomGenerator(); rg.setSeed(200); // Seed has been selected to generate non-trivial covariance // Assume model has 16 observations (will use Longley data). Start by generating // non-constant varianc...
src/test/java/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegressionTest.java
code_ujb_testgen_data_138
public void testCalendar() { if (TestAll.FAST) { return; } System.out.println("\nTestEthiopicChronology.testCalendar"); DateTime epoch = new DateTime(1, 1, 1, 0, 0, 0, 0, ETHIOPIC_UTC); long millis = epoch.getMillis(); long end = new DateTime(3000, 1, 1, 0...
src/test/java/org/joda/time/chrono/TestEthiopicChronology.java
code_ujb_testgen_data_139
public void testInlineReferenceInExpression11() { // Call under label helperInlineReferenceToFunction( "function foo(a){return true;}; " + "function x() {a:foo(1)?0:1 }", "function foo(a){return true;}; " + "function x() {" + " a:{" + " var JSCompiler_inline...
test/com/google/javascript/jscomp/FunctionInjectorTest.java
code_ujb_testgen_data_140
@Test public void testLongly() { // Y values are first, then independent vars // Each row is one observation double[] design = new double[] { 60323,83.0,234289,2356,1590,107608,1947, 61122,88.5,259426,2325,1456,108632,1948, 60171,88.2,258054,3682,1616,...
src/test/java/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegressionTest.java