Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
7
14
source
stringlengths
135
41.2k
target
stringlengths
36
20.4k
13899_11
class IoUtils { public static String readString(InputStream in, String charset) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); int c; while ((c = in.read()) > 0) { out.write(c); } return new String(out.toByteArray(), charset); } private IoUtils(); public static int s...
final String first = "Hi there"; final String second = "Have a nice day!"; byte[] firstBytes = first.getBytes(); byte[] secondBytes = second.getBytes(); byte[] newBytes = new byte[firstBytes.length + secondBytes.length + 1]; System.arraycopy(firstBytes, 0, newBytes, 0, firstBytes.length); System.arraycopy...
32578_0
class LookupManagerImpl implements LookupManager { public List<LabelValue> getAllRoles() { List<Role> roles = dao.getRoles(); List<LabelValue> list = new ArrayList<LabelValue>(); for (Role role1 : roles) { list.add(new LabelValue(role1.getName(), role1.getName())); } ...
log.debug("entered 'testGetAllRoles' method"); // set expected behavior on dao Role role = new Role(Constants.ADMIN_ROLE); final List<Role> testData = new ArrayList<Role>(); testData.add(role); context.checking(new Expectations() {{ one(lookupDao).getRoles();...
56670_0
class ClasspathScanner { protected String getPackage() { return pkg; } public ClasspathScanner(String pkg, boolean subpackages); public ClasspathScanner(String pkg); private void sanitizePackage(String pkgName); protected ClassLoader getClassLoader(); protected boolean isJARPath...
scanner = new ClasspathScanner("org.hibernate.*"); assertEquals("Package was sanitized", "org/hibernate", scanner.getPackage()); } }
56904_58
class ForeignKeyListHolder { public List<U> get() { if (this.loaded == null) { if (this.parent.isNew() || UnitTesting.isEnabled()) { // parent is brand new, so don't bother hitting the database this.loaded = new ArrayList<U>(); } else { if (!UoW.isOpen()) { throw new...
DummyDomainObject parent = new DummyDomainObject(); ForeignKeyListHolder<DummyDomainObject, DummyDomainObject> h = // new ForeignKeyListHolder<DummyDomainObject, DummyDomainObject>(parent, null, null, null); parent.setId(1l); Assert.assertEquals(0, h.get().size()); } }
74217_5
class RecordPackageClassScanner { public List<Class<?>> scan(List<String> packages) { List<Class<?>> classes = new ArrayList<Class<?>>(); for (String packageName : packages) { for (Class clazz : findClassesInPackage(packageName)) { if (hasRecordAnnoation(clazz)) ...
RecordPackageClassScanner scanner = new RecordPackageClassScanner(); List<Class<?>> classes = scanner.scan(Arrays.<String>asList("flapjack.test", "flapjack.test2")); assertNotNull(classes); assertTrue(classes.contains(User.class)); assertTrue(classes.contains(Phone.class)); ...
88960_47
class PlainFormatter implements JSLintResultFormatter { public String format(JSLintResult result) { StringBuilder sb = new StringBuilder(); for (Issue issue : result.getIssues()) { sb.append(outputOneIssue(issue)); } return sb.toString(); } public String footer(...
String nl = System.getProperty("line.separator"); String name = "foo/bar.js"; Issue issue = new IssueBuilder(name, 0, 0, "oops").evidence("BANG").build(); JSLintResult result = new JSLintResult.ResultBuilder(name).addIssue(issue).build(); StringBuilder sb = new StringBuilder(name...
97620_0
class ClassName { public String get() { return this.fullClassNameWithGenerics; } public ClassName(String fullClassNameWithGenerics); public String toString(); public String getSimpleName(); public String getPackageName(); public List<String> getGenericsWithoutBounds(); public List<String> getGenericsWithB...
assertThat(// new ClassName("java.util.Map<K, V>.Entry<K, V>").get(), is("java.util.Map.Entry<K, V>")); assertThat(// new ClassName("java.util.Foo<K extends java.util.Bar<K>>.Entry<K extends java.util.Bar<K>>").get(), is("java.util.Foo.Entry<K extends java.util.Bar<K>>")); } }
103035_6
class JMXAgent implements NotificationListener { public static boolean unregisterMBean(ObjectName oName) { boolean unregistered = false; if (null != oName) { try { if (mbs.isRegistered(oName)) { log.debug("Mbean is registered"); mbs.unregisterMBean(oName); //set flag based on registration st...
logger.info("Default jmx domain: {}", JMXFactory.getDefaultDomain()); JMXAgent agent = new JMXAgent(); agent.init(); MBeanServer mbs = JMXFactory.getMBeanServer(); //create a new mbean for this instance ObjectName oName = JMXFactory.createMBean( "org.red5.server.net.rtmp.RTMPMinaConnection", "connec...
121672_32
class Fields implements Comparable, Iterable<Comparable>, Serializable, Comparator<Tuple> { public Fields appendSelector( Fields fields ) { return appendInternal( fields, true ); } protected Fields( Kind kind ); public Fields(); @ConstructorProperties({"fields"}) public Fields( Comparab...
Fields fieldA = new Fields( 0, -1 ); Fields fieldB = new Fields( -1 ); try { Fields appended = fieldA.appendSelector( fieldB ); fail(); } catch( Exception exception ) { // ignore } } }
123235_12
class PubkeyUtils { public static KeyPair recoverKeyPair(byte[] encoded) throws NoSuchAlgorithmException, InvalidKeySpecException { final String algo = getAlgorithmForOid(getOidFromPkcs8Encoded(encoded)); final KeySpec privKeySpec = new PKCS8EncodedKeySpec(encoded); final KeyFactory kf = KeyFactory.getInst...
KeyPair kp = PubkeyUtils.recoverKeyPair(DSA_KEY_PKCS8); DSAPublicKey pubKey = (DSAPublicKey) kp.getPublic(); assertEquals(DSA_KEY_pub, pubKey.getY()); DSAParams params = pubKey.getParams(); assertEquals(params.getG(), DSA_KEY_G); assertEquals(params.getP(), DSA_KEY_P); assertEquals(params.getQ(), DSA_K...
135867_7
class LoginController extends UIController { @SuppressWarnings("unchecked") public ModelAndView logIn(HttpServletRequest request, HttpServletResponse response, LoginCommand login, BindException errors) throws Exception { // Checking whether logged in ApplicationState state = getAppl...
LoginCommand loginCom = new LoginCommand(); loginCom.setUsername("test1"); loginCom.setPassword("yes"); loginController = (LoginController) context.getBean("loginController"); ModelAndView mav = loginController.logIn(request, response, loginCom, new BindException(loginCom, "test"...
149511_10
class SVNState implements State { public boolean isUnderRevisionControl() { return true; } protected SVNState(String state); public boolean isCheckedOut(); public boolean isDeleted(); @Override public String toString(); protected boolean contains(String msg, String searchString); } class SVNStat...
assertFalse("Files in Unknown State should not be under revision control", SVNState.UNKNOWN.isUnderRevisionControl()); assertTrue("Files in Checked In State should be under revision control", VERSIONED.isUnderRevisionControl()); assertTrue("Files in Added State should be under revision control", SVNState.AD...
152134_28
class UserManagerBean implements UserManager { public User findByUsername(String username) { Query query = em.createNamedQuery("findUserByUsername"); query.setParameter("username", username); return (User) query.getSingleResult(); } public User create(String username, String passwo...
EntityManager em = createMock(EntityManager.class); Query q = createMock(Query.class); User user = createDummyUser(username); expect(em.createNamedQuery("findUserByUsername")) .andReturn(q); expect(q.setParameter("username", username)).andReturn(q); expec...
160996_95
class PlainMailboxManager implements MailboxManager { public void transportMessage( Who recipient, Message msg ) throws Exception { if (msg.getMessageId() != null) throw new IllegalStateException( "message has already been sent" ); msg.setMessageId( idGen.next() ); //Log.report( "MailboxManager.send",...
// test sending a message that has already been sent (has a message id) assertNull( transport.what ); assertNull( transport.recipient ); assertNull( transport.msg ); Message msg = constructAddMessage(); assertNull( msg.getMessageId() ); msg.setMessageId( 1L ); // this should trigger msg already s...
160999_86
class VerifyingFileFactory { public File create(String path) { File file = new File(path); return validate(file); } public VerifyingFileFactory(Builder builder); public File validate(File file); private void doFailForNonExistingPath(File file); private void doWarnForRelativeP...
VerifyingFileFactory vff = new VerifyingFileFactory.Builder(log).warnForRelativePath().build(); vff.create("./an/intended/relative/path"); // assertFalse(log.hasWarned); } }
161005_337
class WikiPermission extends Permission implements Serializable { public String toString() { return "(\"" + this.getClass().getName() + "\",\"" + m_wiki + "\",\"" + getActions() + "\")"; } public WikiPermission( String wiki, String actions ); public boolean equals( Object obj ); publ...
WikiPermission p1 = new WikiPermission("*", "createPages,createGroups,editProfile"); String result = "(\"org.apache.wiki.auth.permissions.WikiPermission\",\"*\",\"creategroups,createpages,editprofile\")"; Assertions.assertEquals(result, p1.toString()); } }
161180_0
class Convert { public static final byte[] toBytes(int i){ if(i < INT_N_65535 || i > INT_P_65535) { return Integer.toString(i).getBytes(); } final int absi = Math.abs(i); final byte[] cachedData = i2b_65535[absi]; final byte[] data; if(cachedData == null) { data = Integer.toString(absi).getBytes(); ...
Log.log("Testing number to bytes conversion ..."); byte[] javadata = null; byte[] data = null; // test MIN int n; n=Integer.MIN_VALUE; javadata = Integer.toString(n).getBytes(); data = Convert.toBytes(n); assertEquals (data.length, javadata.length, "buffer length"); for(int j=0; j<data.length;j++)...
168535_2
class GuestbookNavigation { public Entry getPrevious() { Entry previous = null; for (Entry entry : entryDao.readAll()) { if (entry.getId().equals(current.getId()) && previous != null) { return previous; } previous = entry; } return...
expect(daoMock.readAll()).andReturn(new ArrayList<Entry>()); replay(daoMock); assertNull(classUnderTest.getPrevious()); verify(daoMock); } }
169928_3
class SeasonPassManager { public int sizeOfToDoList() { return toDoList.size(); } public SeasonPassManager(Schedule schedule); public void setNumberOfRecorders(int number); public Program createNewSeasonPass(String programName, int channel); private boolean conflictsWithExistingSchedule(Program program); p...
assertEquals(0, seasonPassManager.sizeOfToDoList()); } }
175376_3
class Parser { Expr parseYieldExpr() { return new Expr.Yield(parseOptionalTestList()); } public Parser(Scanner scanner); private boolean is(String t); private boolean at(String t); private Object value(); private void expect(String token); int line(); Suite parseFileInput(); ExprList pars...
assertEquals("Suite[Expr(Yield(Lit(None)))]", parse("(yield)\n")); } }
184604_0
class CharacterUtil { public static int count(String text) { return text.length(); } private CharacterUtil(); public static boolean isExceedingLengthLimitation(String text); } class CharacterUtilTest { @Test void testCount() throws Exception {
String str; int expectedLength; str = "a quick brown fox jumped over the lazy dog."; expectedLength = str.length(); assertEquals(expectedLength, CharacterUtil.count(str)); str = "café"; expectedLength = 4; assertEquals(expectedLength, CharacterUtil.count(...
206320_1
class AccuRevRemoveCommand extends AbstractAccuRevCommand { public RemoveScmResult remove( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { return (RemoveScmResult) execute( repository, fileSet, parameters ); } public AccuRevRe...
final ScmFileSet testFileSet = new ScmFileSet( basedir, new File( "src/main/java/Foo.java" ) ); List<File> removedFiles = Collections.singletonList( new File( "removed/file" ) ); when( accurev.defunct( basedir, testFileSet.getFileList(), "A deleted file" ) ).thenReturn( removedFiles ); ...
206322_31
class LineEndingsUtils { @Nullable public static String getLineEndingCharacters( @Nullable String lineEnding ) throws AssemblyFormattingException { String value = lineEnding; if ( lineEnding != null ) { try { value = LineEndings.val...
assertEquals( null, LineEndings.keep.getLineEndingCharacters() ); } }
206350_846
class CallbackDescriptor implements Serializable { public LifecycleEvent getCallbackType() { return callbackType; } public CallbackDescriptor(LifecycleEvent callbackType); public void clear(); public Collection<String> getCallbackMethods(); public void addCallbackMethod(String method...
CallbackDescriptor m = new CallbackDescriptor(LifecycleEvent.POST_LOAD); assertEquals(LifecycleEvent.POST_LOAD, m.getCallbackType()); } }
206364_39
class DBDictionary implements Configurable, ConnectionDecorator, JoinSyntaxes, LoggingConnectionDecorator.SQLWarningHandler, IdentifierConfiguration { public String toSnakeCase(final String name) { final StringBuilder out = new StringBuilder(name.length() + 3); final boolean isDelimited = name....
final DBDictionary dictionary = new DBDictionary(); assertEquals("foo", dictionary.toSnakeCase("foo")); assertEquals("foo_bar", dictionary.toSnakeCase("fooBar")); assertEquals("fooba_r", dictionary.toSnakeCase("FoobaR")); assertEquals("o_f_o_ob", dictionary.toSnakeCase("oFOOb"));...
206402_426
class ResponseCachingPolicy { public boolean isResponseCacheable(final String httpMethod, final HttpResponse response) { boolean cacheable = false; if (!HeaderConstants.GET_METHOD.equals(httpMethod) && !HeaderConstants.HEAD_METHOD.equals(httpMethod)) { if (LOG.isDebugEnabled()) { ...
Assert.assertFalse(policy.isResponseCacheable("PUT", response)); Assert.assertFalse(policy.isResponseCacheable("get", response)); } }
206403_0
class JsonWriter { void write(Node node, int maxLevels) throws RepositoryException, IOException { write(node, 0, maxLevels); } JsonWriter(Writer writer); void write(Collection<Node> nodes, int maxLevels); private void write(Node node, int currentLevel, int maxLevels); private void ...
StringWriter writer = new StringWriter(); JsonWriter jsonWriter = new JsonWriter(writer); Node parent = createMock(Node.class); Property doubleProperty = createMock(Property.class); Value doublePropertyValue = createMock(Value.class); expect(doubleProperty.getType()).and...
206418_92
class ParallelBuildsManager implements BuildsManager, Contextualizable { public void checkoutProject( int projectId, String projectName, File workingDirectory, String scmRootUrl, String scmUsername, String scmPassword, BuildDefinition defaultBuildDefinition, ...
setupMockOverallBuildQueues(); BuildDefinition buildDef = new BuildDefinition(); buildDef.setId( 1 ); buildDef.setSchedule( getSchedule( 1, 1, 2 ) ); setupCheckoutProjectBuildQueuesAreEmpty(); buildsManager.checkoutProject( 1, "continuum-project-test-1", ...
206437_62
class CipherTextHandler { public byte[] decrypt( EncryptionKey key, EncryptedData data, KeyUsage usage ) throws KerberosException { LOG_KRB.debug( "Decrypting data using key {} and usage {}", key.getKeyType(), usage ); EncryptionEngine engine = getEngine( key ); return engine.getDecryp...
CipherTextHandler lockBox = new CipherTextHandler(); KerberosPrincipal principal = new KerberosPrincipal( "erodriguez@EXAMPLE.COM" ); KerberosKey kerberosKey = new KerberosKey( principal, "badpassword".toCharArray(), "DES" ); EncryptionKey key = new EncryptionKey( EncryptionType.DES_CBC_...
206444_108
class AcidTxnCleanerService implements MetastoreTaskThread { @Override public void run() { TxnStore.MutexAPI.LockHandle handle = null; try { handle = txnHandler.getMutexAPI().acquireLock(TxnStore.MUTEX_KEY.TxnCleaner.name()); long start = System.currentTimeMillis(); txnHandler.cleanEmptyA...
for (int i = 0; i < 5; ++i) { openNonEmptyThenAbort(); } Assert.assertEquals(5 + 1, getTxnCount()); Thread.sleep(txnHandler.getOpenTxnTimeOutMillis() * 2); underTest.run(); // deletes only the initial (committed) TXNS record Assert.assertEquals(5, getTxnCount()); Assert.assertTru...
206451_6
class XPath20ExpressionRuntime implements ExpressionLanguageRuntime { @SuppressWarnings("unchecked") public List evaluate(OExpression cexp, EvaluationContext ctx) throws FaultException, EvaluationException { List result; Object someRes = null; try { someRes = evaluate(cexp, ...
String insertElementName="InsertedNode"; OXPath20ExpressionBPEL20 exp = compile("$reallyEmptyVar/"+insertElementName); exp.setInsertMissingData(true); // Setup root node _rootNode = DOMUtils.stringToDOM("<tns:ApplicationData xmlns:tns=\"http://foobar\"/>"); ...
206452_15
class UIAction extends ActionSupport implements UIActionPreparable, UISecurityEnforced, RequestAware { public static String cleanTextKey(String s) { if (s == null || s.isEmpty()) { return s; } // escape HTML return StringEscapeUtils.escapeHtml4(cleanExpressions(s)); ...
assertEquals(null,UIAction.cleanTextKey(null)); assertEquals("",UIAction.cleanTextKey("")); assertEquals("a",UIAction.cleanTextKey("a")); assertEquals("$",UIAction.cleanTextKey("$")); assertEquals("%",UIAction.cleanTextKey("%")); assertEquals("%$",UIAction.cleanTextKey("%...
206483_66
class ModelMerger { protected void mergeContributor_Roles( Contributor target, Contributor source, boolean sourceDominant, Map<Object, Object> context ) { target.setRoles( merge( target.getRoles(), source.getRoles(), sourceDominant, e -> e ) ); } publ...
Contributor target = new Contributor(); target.setRoles( Arrays.asList( "first", "second", "third" ) ); Contributor source = new Contributor(); source.setRoles( Arrays.asList( "first", "second", "third" ) ); modelMerger.mergeContributor_Roles( target, source, true, null ); ...
206633_1000
class BeanFilter { public Object createFilteredBean(Object data, Set<String> fields) { return createFilteredBean(data, fields, ""); } @SuppressWarnings("unchecked") private Object createFilteredBean(Object data, Set<String> fields, String fieldName); public Set<String> processBeanFields(Collection<String>...
SimpleBean data = new SimpleBean().setI(5); SimpleBeanInterface dataBean = (SimpleBeanInterface) beanDelegator.createDelegator(data); SimpleBeanInterface newData = (SimpleBeanInterface) beanFilter.createFilteredBean( dataBean, ImmutableSet.<String>of("i")); assertEquals(5, newData.getI()); ...
206635_4
class PluginMetadataParser { public Set<MojoDescriptor> parseMojoDescriptors( File metadataFile ) throws PluginMetadataParseException { Set<MojoDescriptor> descriptors = new HashSet<>(); try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) ) { PluginMet...
File metadataFile = getMetadataFile( "test2.mojos.xml" ); Set<MojoDescriptor> descriptors = new PluginMetadataParser().parseMojoDescriptors( metadataFile ); assertEquals( 1, descriptors.size() ); MojoDescriptor desc = descriptors.iterator().next(); assertTrue( d...
209853_134
class BancoDoBrasil extends AbstractBanco implements Banco { @Override public String geraCodigoDeBarrasPara(Boleto boleto) { Beneficiario beneficiario = boleto.getBeneficiario(); String numeroConvenio = beneficiario.getNumeroConvenio(); if (numeroConvenio == null || numeroConve...
this.banco = new BancoDoBrasil(); this.boleto = this.boleto.comBanco(this.banco); assertEquals("3860", this.banco.geraCodigoDeBarrasPara(this.boleto).substring(5, 9)); } }
213337_470
class Domain { public abstract SortedSetModel<AdverseEvent> getAdverseEvents()public abstract SortedSetModel<AdverseEvent> getAdverseEvents(); public abstract SortedSetModel<AdverseEvent> getAdverseEvents()public abstract List<EntityCategory> getCategories(); public abstract SortedSetModel<AdverseEvent> getAdverseEve...
AdverseEvent ade = new AdverseEvent("a", AdverseEvent.convertVarType(Variable.Type.RATE)); assertEquals(0, d_domain.getAdverseEvents().size()); d_domain.getAdverseEvents().add(ade); assertEquals(1, d_domain.getAdverseEvents().size()); assertEquals(Collections.singletonList(ade), d_domain.getAdverseEvents()); ...
219850_20
class WikiParser extends BrainParser { public void setUseCanonicalFormat(boolean useCanonicalFormat) { this.useCanonicalFormat = useCanonicalFormat; } @Override public Note parse(final InputStream inputStream); private boolean isEmptyPage(final String page); private BufferedReader createRe...
wikiParser.setUseCanonicalFormat(true); List<Note> notes = readNotes("* Arthur Dent\n" + "\n" + "He's a jerk.\n" + "A complete kneebiter."); assertEquals(1, notes.size()); Note root = notes.get(0); assertEquals("Arthur Dent", root.g...
225207_7
class NMRFaultOutInterceptor extends AbstractPhaseInterceptor<NMRMessage> { public void handleMessage(NMRMessage message) throws Fault { message.put(org.apache.cxf.message.Message.RESPONSE_CODE, new Integer(500)); NSStack nsStack = new NSStack(); nsStack.push(); t...
PhaseInterceptor<NMRMessage> interceptor = new NMRFaultOutInterceptor(); try { NMRMessage msg = new NMRMessage(new MessageImpl()); interceptor.handleMessage(msg); fail("Should have thrown an exception"); } catch (IllegalStateException e) { // ok ...
225211_0
class OsgiLocator { public static <T> Class<? extends T> locate(Class<T> factoryId) { return locate(factoryId, factoryId.getName()); } private OsgiLocator(); public static void unregister(String id, Callable<Class> factory); public static void register(String id, Callable<Class> factory)...
System.setProperty(OsgiLocator.TIMEOUT, "0"); System.setProperty("Factory", "org.apache.servicemix.specs.locator.MockCallable"); Class clazz = OsgiLocator.locate(Object.class, "Factory"); assertNotNull("Expected to find a class", clazz); assertEquals("Got the wrong class", MockCa...
229738_123
class Sneaky { @CheckReturnValue @Nonnull public static DummyException throwAnyway(Throwable t) { if (t instanceof Error) { throw (Error) t; } if (t instanceof RuntimeException) { throw (RuntimeException) t; } if (t instanceof IOException) {...
RuntimeException rex = new IllegalArgumentException(); assertThatThrownBy(() -> Sneaky.throwAnyway(rex)) .isSameAs(rex); } }
231990_1
class ContributorHelper { public static List<String> parseTrack(String track) { Pattern pattern = Pattern.compile("(.+)(\\((F|f)eat(\\. |\\.| |uring )(.+))\\)"); Matcher matcher = pattern.matcher(track); boolean matches = matcher.matches(); if (matches) { String title = ...
assertEquals(singletonList("A"), parseTrack("A")); assertEquals(asList("A", "B"), parseTrack("A (feat. B)")); assertEquals(asList("A", "B"), parseTrack("A (Feat. B)")); assertEquals(asList("A", "B"), parseTrack("A (featuring B)")); assertEquals(asList("A", "B"), parseTrack("A (Fe...
235076_9
class ResourceHashModel implements TemplateHashModelEx, TemplateScalarModel, ResourceTemplate { @Override public String getAsString() throws TemplateModelException { if (resource.getURI() == null) { return INVALID_URL; // b-nodes return null and their ids are useless } else...
Resource resource = ModelFactory.createDefaultModel().createResource(); ResourceHashModel resourceHashModel = new ResourceHashModel(resource); assertEquals("Unexpected URI", ResourceHashModel.INVALID_URL, resourceHashModel.getAsString()); } }
237920_1
class CreateDeleteProjectAction extends AvailableLaterObject<Void> { public void setProjects(Projects projects) { this.projects = projects; } public CreateDeleteProjectAction(ProjectDir dir, boolean delete); @Override public Void calculate(); private CreateDeleteProjectAction action; ProjectDir dir; } c...
Projects projects = Mockito.mock(Projects.class); action = new CreateDeleteProjectAction(dir, true); action.setProjects(projects); AvailableLaterWaiter.await(action); Mockito.verify(projects).remove(dir); Mockito.verifyNoMoreInteractions(projects); } }
240464_2
class EJBException extends RuntimeException { public String getMessage() { if (causeException == null) return super.getMessage(); StringBuilder sb = new StringBuilder(); if (super.getMessage() != null) { sb.append(super.getMessage()); sb.append("; "); } ...
Assert.assertEquals(null, exceptionDefaultConstructor.getMessage()); Assert.assertEquals(null, exceptionWithNullMessage.getMessage()); Assert.assertEquals("msg", exceptionWithMessage.getMessage()); Assert.assertEquals("msg; nested exception is: java.lang.Exception: cause", exceptionW...
240466_0
class PropertyEditors { public static boolean canConvert(final String type, final ClassLoader classLoader) { if (type == null) { throw new NullPointerException("type is null"); } if (classLoader == null) { throw new NullPointerException("classLoader is null"); ...
assertTrue(PropertyEditors.canConvert(Blue.class)); } }
247823_30
class NewCookieHeaderDelegate implements HeaderDelegate<NewCookie> { public String toString(NewCookie cookie) { if (cookie == null) { throw new IllegalArgumentException(Messages.getMessage("cookieIsNull")); //$NON-NLS-1$ } return buildCookie(cookie.getName(), cookie.getValue(), ...
RuntimeDelegate rd = RuntimeDelegate.getInstance(); HeaderDelegate<NewCookie> newCookieHeaderDelegate = rd.createHeaderDelegate(NewCookie.class); if (newCookieHeaderDelegate == null) { fail("NewCookie header delegate is not regestered in RuntimeDelegateImpl"); } ...
279216_19
class Search extends Command<Result> { public Result send(Connection connection) throws DespotifyException { /* Create channel callback */ ChannelCallback callback = new ChannelCallback(); byte[] utf8Bytes = query.getBytes(Charset.forName("UTF8")); /* Create channel and buffer. */ Channel chann...
Result result = (Result)manager.send(new Search(store, "Johnny Cash")); assertTrue(result.getTotalTracks() > 2000); assertEquals(100, result.getTracks().size()); // todo assert a bit. at least we know there was no exception. System.currentTimeMillis(); } }
283187_21
class SLF4JBridgeHandler extends Handler { public static void install() { LogManager.getLogManager().getLogger("").addHandler(new SLF4JBridgeHandler()); } public SLF4JBridgeHandler(); private static java.util.logging.Logger getRootLogger(); public static void uninstall(); public stat...
SLF4JBridgeHandler.install(); String resourceBundleName = "org.slf4j.bridge.testLogStrings"; ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName); String resourceKey = "resource_key"; String expectedMsg = bundle.getString(resourceKey); String msg = resour...
283325_37
class TargetLengthBasedClassNameAbbreviator implements Abbreviator { public String abbreviate(String fqClassName) { StringBuilder buf = new StringBuilder(targetLength); if (fqClassName == null) { throw new IllegalArgumentException("Class name may not be null"); } int in...
{ TargetLengthBasedClassNameAbbreviator abbreviator = new TargetLengthBasedClassNameAbbreviator(100); String name = "hello"; assertEquals(name, abbreviator.abbreviate(name)); } { TargetLengthBasedClassNameAbbreviator abbreviator = new TargetLengthB...
291242_13
class MessageConveyor implements IMessageConveyor { public <E extends Enum<?>> String getMessage(E key, Object... args) throws MessageConveyorException { Class<? extends Enum<?>> declaringClass = key.getDeclaringClass(); String declaringClassName = declaringClass.getName(); CAL10NBundle rb = ...
MessageConveyor mc = new MessageConveyor(Locale.CHINA); try { mc.getMessage(Colors.BLUE); fail("missing exception"); } catch (MessageConveyorException e) { assertEquals( "Failed to locate resource bundle [colors] for locale [zh_CN] for enum type [ch.qos.cal10n.sample.Colors]", ...
291570_20
class AbstractAuthenticator implements Authenticator, LogoutAware { public final AuthenticationInfo authenticate(AuthenticationToken token) throws AuthenticationException { if (token == null) { throw new IllegalArgumentException("Method argument (authentication token) cannot be null."); ...
AuthenticationInfo authcInfo = abstractAuthenticator.authenticate(newToken()); assertNotNull(authcInfo); } }
293812_0
class PrettyFormatter implements Reporter, Formatter { @Override public void close() { out.close(); } public PrettyFormatter(Appendable out, boolean monochrome, boolean executing); public void setMonochrome(boolean monochrome); @Override public void uri(String uri); @Override pub...
PrintStream out = mock(PrintStream.class); Formatter formatter = new PrettyFormatter(out, true, true); formatter.close(); verify(out).flush(); verify(out).close(); } }
End of preview. Expand in Data Studio

methods2test_small_cleaned

A structurally-vacuous-filtered copy of the train split of andstor/methods2test_small (context config fm+fc+c+m+f+t+tc, the one actually used to fine-tune models in andstor/peft-unit-test-generation-replication-package). Produced for the investigation in lhnam/PEFT — FINDINGS.md (FINDINGS.md §1.2, §4 item 2), which found that 17.8% of the real fine-tuning targets are structurally vacuous (no assertion, empty, or tautological) and hypothesized this is a driver of the "convergence attractor" collapse seen when fine-tuning code LLMs for JUnit test generation.

What changed vs. the original

Split Original rows This dataset Vacuous rate
train 7,440 6,124 (vacuous rows dropped) 17.7% removed
validation 953 953 (unchanged) 15.2% (left in, for fair eval_loss)
test 1,017 1,017 (unchanged) 16.9% (left in)

Only train is filtered. validation and test are byte-identical to the source dataset's fm+fc+c+m+f+t+tc config — the point of this dataset is to isolate the effect of training on cleaner targets while still measuring eval_loss / benchmark success against the real, unfiltered data distribution. Filtering only the split a model actually learns from, and leaving evaluation untouched, is what makes a before/after comparison causally meaningful.

Filtering method

Each target (the reference JUnit test) is classified as vacuous if it does not contain a real, non-tautological assert*/fail/verify call:

ASSERT_RE = re.compile(r"\b(assert\w*|fail|verify\w*)\s*\(", re.IGNORECASE)
TAUTOLOGY_RE = re.compile(
    r"assert(true)\s*\(\s*true\s*[,)]|assert(false)\s*\(\s*false\s*[,)]|"
    r'assertequals\s*\(\s*([A-Za-z0-9_."\']+)\s*,\s*\3\s*[,)]',
    re.IGNORECASE,
)

Targets under 15 characters are also treated as vacuous ("empty"). This is the exact classifier used throughout the source investigation (see scripts/filter_vacuous_training_data.py in the repo above), applied here with --mode drop.

Breakdown of the original train split before filtering:

Label Count %
has_real_assert (kept) 6,124 82.3%
no_assert 1,278 17.2%
tautological_assert 25 0.3%
empty 13 0.2%
vacuous total (dropped) 1,316 17.7%

(Matches FINDINGS.md's independently-reported 17.8% to within rounding — recomputed directly from this dataset's own source parquet.)

Columns

  • id (string) — original row id from andstor/methods2test_small.
  • source (string) — the prompt/context (unchanged).
  • target (string) — the reference JUnit test (the fine-tuning label).

No weight column — this is the drop variant, not downweight. See the source script if you want a down-weighted variant instead.

Intended use

Point a fine-tuning run's TRAIN_DATASET at this repo (config default) in place of andstor/methods2test_small (fm+fc+c+m+f+t+tc), keeping everything else — model, LoRA config, epochs, learning rate, validation split — identical, to test whether removing the training-time shortcut narrows or removes the post-fine-tuning "convergence attractor" documented in the source repo's FINDINGS.md. This is one experiment in an ongoing, self-correcting investigation — see that document for the full methodology, caveats, and history of revisions before citing any number from this dataset card in a paper.

Provenance

Downloads last month
-