Judiht's picture
Upload folder using huggingface_hub
952dc59 verified
inputs,targets,outputs
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * @param value the value to look for in the array.\\\\n *\\\\n * @return the subject if it does not contain the value.\\\\n *\\\\n * @throws X if the subject is null or does contain the value.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void testDoesNotContainThrowsForNullSubject() { VerifiableByteArray<IllegalArgumentException> verifiable = getVerifiableInstance(null); Assertions.assertThrows(IllegalArgumentException.class, () -> verifiable.doesNotContain((byte) 0)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',param : value to be up in the list',\n * @n * @return the index of it is not exist the value,\\\\n',*',n',*',throws NullNo the subject does not. the not the value.\\\\n')*'
)"".
### Example caseUnit Code::
@Test
shouldFindNotContainValueirteenXValue()() {
ifyTestArrayOutputStringlegalArgumentException>().ifiableByte newIlifiableByte(Il); assertert..assertEqurown(IllegalArgumentException.class, ver -> verifiable.contNotContain(Il[ 0), }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '//MapOfCity all vertices to a unique integer\\n')""]
### Test JUnit in Java:
","@Test public void testGraph3b() throws UnsupportedEncodingException, ExportException, ImportException { Graph<Integer, DefaultEdge> orig= NamedGraphGenerator.klein3RegularGraph(); String res = exportGraph(orig, Graph6Sparse6Exporter.Format.GRAPH6); Graph<Integer, DefaultEdge> g = importGraph(res); this.compare(orig, g); }","
3 { are the example set can the magical to function that the.
a code
oke test case for
def Conclusion:
ThisHelloHello '',',leGr:igatorsices are the single location',n',"",
Function Example caseUnit: action:
[""Test
void test__()() { ExceptionsupportedOperationodingException { IOException { Exception {
gString, StringD> gaminewGraph.ator.generittens_bGraph();
input = graphGraph3orig); ""Gener);wingGraph);porter.DE.JAPHML_ assert<Integer, DefaultEdge> exp = GraphGraph(res, assert.assertare(g, g); }}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Static instance method will create an initialized instance of the result set.\\\\n\\\\t *\\\\n\\\\t * @param simpleQuery\\\\n\\\\t * {@link org.irods.jargon.core.query.SimpleQuery} that created this\\\\n\\\\t * result set.\\\\n\\\\t * @param results\\\\n\\\\t * {@code List<List<String>>} with the results in row/column format.\\\\n\\\\t * @param columnNames\\\\n\\\\t * {@code List<String>} with the headers for each column.\\\\n\\\\t * @param hasMoreRecords\\\\n\\\\t * {@code boolean} that indicates whether there are more records to\\\\n\\\\t * retrieve.\\\\n\\\\t * @return {@link IRODSSimpleQueryResultSet}\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test(expected = IllegalArgumentException.class) public void testInstanceNullColumnNames() { AbstractAliasedQuery simpleQuery = Mockito.mock(SimpleQuery.class); @SuppressWarnings(""unchecked"") List<IRODSQueryResultRow> results = Mockito.mock(List.class); List<String> columnNames = null; IRODSSimpleQueryResultSet.instance(simpleQuery, results, columnNames, false); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ method creation.' be a instance instance of the class type. *n\\\\t * Ifn't * Theparam argsInput simplen\\\\t * @\\\\@param #.j..jae.exec.exec.QueryQuery}@ will the instancen\\\\t *instanceinstance set.\\\\n\\\\t * return simpleQueryn\\\\t * that@link ArrayResultResult<Object>>} that the specified of the formatcolumn format.\\\\n\\\\t * @param columnsNames\\\\n\\\\t * {@code List<String>} of the column for the column.\\\\n\\\\t * @param queryNull\\\\ords\\\\n\\\\t * {@code boolean} indicating indicates whether there are more records to ben t * addrieve from\\\\n\\\\t * return *@code orgODSyntpleQuery}Set} objectn')t */""]
]
Note Example caseUnit Code Python:
Test
timeout= NoneArgumentException.class)
void test__()s() {
//SimpleasedQuery.<Query = newAli.aliasockInstanceAliQuery.class);
ListSuppressWarnings(""unchecked"") simple<ListODSSInstanceResultSet> results = newito.mock(List<class); results<List> columnNames = Mock; assertODSimpleQueryResultSet resultexecute =simpleQuery, results, columnNames, true); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Analyses whole project with all metrics\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void analyseWithEmptySourceFiles() { delphiProject.getSourceFiles().clear(); DebugSensorContext context = new DebugSensorContext(); sensor.analyse(project, context); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\',This
agram the words: flying the andn *'
]
Function
theoke test the code
#param
static test_Python string()( ->
ight
ileappend_Code()index()
#PrintData(. new JOutputData();
ensor_
ze_text) context)
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// if role inactive set, then only this role may be selected\\n')"", ""('', '// user role must always be selected for active user\\n')""]
### Test JUnit in Java:
","@Test void ensureSecondStageRoleAndBossRoleCanBeSelectedBoth() { final PersonPermissionsDto personPermissionsDto = new PersonPermissionsDto(); personPermissionsDto.setPermissions(List.of(USER, BOSS, SECOND_STAGE_AUTHORITY)); sut.validatePermissions(personPermissionsDto, errors); verifyNoInteractions(errors); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello '',', you ==,', the it one one is be active',n'"",
('Hello '// if input', be be closed', a users',n')"",
If Example caseoke test action code
[""Test
test_aryT()In((BeLaunlected()S {
int personmission objectTO otherPermissions =to = new PersonPermissionsDto(""
PermissionsDto.setFirstmission(""ro.of(""new_ INOB, JRET_STUD);METHODUTHORITY,
assertolution.addatePermissions(personPermissionsDto, ""List assertify(Duaction(person,
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two binary vectors and calculates the Pattern-difference distance.\\\\n\\\\t * @param v1 binary vector number 1.\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return The Pattern-difference distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jxwang public void test6(){ int[] v1 = new int[]{1,0,1,1,0,1,1,0}; int[] v2 = new int[]{1,1,0,1,1,0,0,1}; Asserts.assertEqualLength(v1, v2); double res = PatternDifference.distance(v1, v2); Asserts.assertEquals(res, 0.5625); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ a valid digits of conc their Ham-Merence between between\\\\n')t * Theparam v1: vector 1 1\\\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return binary Pattern-difference distance between\\\\n')t *"",
][ ->
["" Example caseUnit:::
@Test
public TODunit_j// void test_()Ass//[] v1 = { int[]{0,0,1,0};0,0};0,0};
int[] v2 = new int[]{1,0,0,0,0,0,0,1}; intert..assertEququal(snew1, v2,}Pattern d = PatternDifferenceDistancepattern(v1, v2);}Asserts.assertEquals(res, 0.025);}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// Setup Servlet Parameters and Attributes\\n')"", ""('', '// Adding Correct CSRF Token (Token Submitted)\\n')""]
### Test JUnit in Java:
","@Test public void testLevelInvalidFirstUrlAnswer() { String userName = ""lessonTester""; try { // Verify User Exists in DB GetterTest.verifyTestUser(applicationRoot, userName, userName); // Sign in as Normal User log.debug(""Signing in as "" + userName + "" Through LoginServlet""); TestProperties.loginDoPost(log, request, response, userName, userName, null, lang); log.debug(""Login Servlet Complete, Getting CSRF Token""); if (response.getCookie(""token"") == null) { fail(""No CSRF Token Was Returned from Login Servlet""); } String csrfToken = response.getCookie(""token"").getValue(); if (csrfToken.isEmpty()) { String message = new String(""No CSRF token returned from Login Servlet""); log.fatal(message); fail(message); } else { request.setCookies(response.getCookies()); String falseIdTestValue = new String(""1627312""); String httpsBase = new String(""https://localhost:80"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',',',let',', Initial',n',"",
('', '// Run AttributeslyRF Tokens\\\\ generatedmitted)\\n')"",
### Example CaseUnit: action:
@Test
// void testCS1C()()() {
urlInput = ""Johnon"";utorial"";
String { URL intentionally that Nameists
Level
LevelUser();.testifyUserLevelExuser,, userName, ""Id, }} Check up User User user
GetIninfo(""Success in in as normal + userName + ""..."" Level Formlet""); //Caseperties.set(er(application, "". user, ""Name, ""Name, "", null); //.info(""Ver successfullet Response""); User StartedRF Token""); // (CS.codeCodesr().cs"").!= null) { //(""CS CSRF Token Found Founded""); LoginServlet""); } elseTokensrfToken = response.getCookie(""token"")split(""(); if (csrfToken!=equEmpty()) { failBuilder = "" String(""CS CSRF Token was from Login Servlet""); fail.erroratal(message, fail(message); } { String.postCies(new.getCies()); request csCentity = = response String(""False094534 log falseIdUrl "" String(""https://www:8080
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Starts the factory. Leads to the first decision from the developer, taken \\\\n * in the interface {@code FirstStep}.\\\\n * \\\\n * @return the first step in this factory: {@code FirstStep}\\\\n * @since 0.6.0\\\\n * @version 0.6.0\\\\n * @author Naoghuman\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void thirdStepPutGetDoubleReturnsValue() { PreferencesFactory.create() .module(DummyModuleScope.class) .key(""dummy.key6"") .put(1.2345d); double result = PreferencesFactory.create() .module(DummyModuleScope.class) .key(""dummy.key6"") .get(5.4321d); assertEquals(1.2345d, result, 0); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ a game*** \ast to a moon person point the given's but from
\
against and the morning.0code i Name\\\n"",* and\\\n * @param:The total character that the story. {firstcode stepStep}!n * @param:04.05.0\\n"",* @end\.1.0')n"",* @param (Johnithqiam Dawn *"",
]''
""""""""""""
theUnit test action code
[""Test
static test_()namHappy_Correct() {
ixStep fj_}}
@oubFactory..class)
=runSetFirstummy"")class"")"")
.method(""@,0);67;
. d = Factory.create().
.get(DummyModuleScope.class) .get(""dummy.key5"") .getDouble1.6721d);
assertEquals(5.2345d, result); "". }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This method confirms if a type is of primitive array type ( int[], float[], boolean[] and so on).\\\\n * \\\\n * @param type\\\\n * The type which is to be checked.\\\\n * @return <code>true</code> if type is a primitive array type.\\\\n */', '')""]
### Test JUnit in Java:
","@Test(groups = ""unit"", expectedExceptions = { IllegalArgumentException.class }) public void testIsPrimitiveArrayErrorCondition() { ReflectionUtils.isPrimitiveArray(null); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\\',\\ function returns that the number of missing a data,.i,][ double[], double[ ) double on)
n""*/ It\\\n""* @param s:n - @The type of the not be checked for\\\\n * @param:Y>True</code>
the is a primitive data,,\\\\n *"",
)
[
theoke test action code
[""Test
expected: ['def"") marks_pr = [''ArgumentException,class })
static test_Arrayitive_((( ->
lect.ils.array_itiveArray([');}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Stops listening to events.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testSearchSelect() { EasyMockSupport support = new EasyMockSupport(); BiMap<SearchResult, Geometry> map = createBiMap(); BiMap<SearchResult, Geometry> labelMap = createBiMap(); ControlRegistry controlRegistry = createControlRegistry(support); DynamicViewer viewer = support.createMock(DynamicViewer.class); ViewerAnimatorCreator creator = createCreator(support, viewer, 1); MapManager mapManager = createMapManager(support, viewer); SearchModel model = new SearchModel(); model.getAllResults().add(map.keySet().iterator().next()); model.getShownResults().add(map.keySet().iterator().next()); support.replayAll(); SelectedResultHandler handler = new SelectedResultHandler(model, controlRegistry, mapManager, map, labelMap, creator); model.getFocusedResult().set(model.getAllResults().get(0)); assertEquals(Color.CYAN, ((ColorRenderProperties)map.values().iterator().next().getRenderProperties()).get"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',rict the to input and *n *', ')""]
### Example caseUnit Code command:
@Test
void test_Forive {{ assert//SelockLibrary. = new EasyMockSupport(); assertConsumer<String,, Eventometry> map = newMMap( assertSearch<SearchResult, Eventometry> geometryMap = mapBiMap(); search flowistryControlRegistry = newControlRegistry();support); searchSearch viewView = new.getDynamicockViewnewViewer.class); viewerViewator animor anim = newViewor(view, viewer); map. search< mapManager = newMapManager(map, map, SearchResult search = new SearchModel(); model.setSearch();().for(searchManagergetSet().iterator().next()); model.getAllapesResults().add(map.keySet().iterator().next()); model.addceiveListener(); searchlectionEvent result handler = new SelectedResultHandler();model, mapRegistry, mapManager); map); labelMap); map); handler.handleSeinder().().addSehandler.getAllResults().iterator(0). modelTrueals(model.REDYAN, handlerGe)Contextg) handlerManagerget().get().next().getFocusProperties()).getColor
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Applies the wrapped ElementSelector\'s logic if and only if the\\\\n * control element has the given (local) name.\\\\n * @param expectedName expected name of the control element\\\\n * @param es the ElementSelector to consult\\\\n * @return the ElementSelector\\\\n */"", \'\')']
### Test JUnit in Java:
","@Test public void qnameNamed() { Element control = doc.createElement(FOO); Element controlNS = doc.createElementNS(SOME_URI, FOO); Element test = doc.createElement(FOO); Element testNS = doc.createElementNS(SOME_URI, FOO); assertFalse(ElementSelectors.selectorForElementNamed(new QName(BAR), ElementSelectors.byName) .canBeCompared(control, test)); assertTrue(ElementSelectors.selectorForElementNamed(new QName(FOO), ElementSelectors.byName) .canBeCompared(control, test)); assertTrue(ElementSelectors.selectorForElementNamed(new QName(SOME_URI, FOO, XMLConstants.DEFAULT_NS_PREFIX), ElementSelectors.byName) .canBeCompared(controlNS, testNS)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This\\lies the given JDaryor tos filter to the only if the givenn * current boolean is the specified valuebo) value. Ifn * Returnsparam elementName theName of the element element.n * @param name expected ElementSelector object be forn * @param the result objector objectn *"",
voidn']
[' Example caseUnit Code::
@Test
void test1_amingElement {
Select = new.getElement(""qO); ElementSelect2 = control.createElement((QUCH_N, ""Q); ElementSelect = doc.createElement(QUO); testSelectNS = doc.createElementNS(SOME_URI, FOO); ElementEqu(esSelector.isorNameName(amed(control StringName(""controlODY), control controlSelectors.QUName(!=.isSelectApp(control, test)); assertTrue(ElementSelectors.selectorForElementNamed(new QName(FOO), ElementSelectors.byName) .canBeCompared(control, testNS assertTrue(ElementSelectors.selectorForElementNamed(new QName(BUB_URI), BAROO), BAR ""ML),ants.NFAULT_N),URIREFIX), Element ElementSelectors.byName) .canBeCompared(control,, testNS)); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * If you want to customize the menu content override this method.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testMakeMenuBarWhenItDoesNotContainAllMenuItems() { editor.menuItems = new HashSet<>(); editor.makeMenuBar(); verify(menuBuilder, never()).addSave(any(Command.class)); verify(menuBuilder, never()).addCopy(any(ObservablePath.class), any(Validator.class), any(Caller.class)); verify(menuBuilder, never()).addRename(any()); verify(menuBuilder, never()).addDelete(any(ObservablePath.class), any(Caller.class)); verify(menuBuilder, never()).addValidate(any()); verify(menuBuilder, never()).addNewTopLevelMenu(any()); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ you have to learn the instructions item, this cell.\n"",*/"",
)
Function Example caseoke test action code
Test
static test_MagicItem()Done_ntExainTheAItems( {
.rot = = ["" ArraySet[String();
.addMagic('(
//ify_editorItems, ""_ {equ(""Changesj_item.MEN))
ify(menuBuilder, ""()).addMove(about(Questionerverable..C)) any);Obsator.class). '(Editorable.class))
verify(menuBuilder, never()).addCopyear('any( verify(menuBuilder, never()).addCopy(any(ObservablePath.class)) any(Editorer.class),
verify(menuBuilder, never()).addCopyidate();any( verify(menuBuilder, never()).addCopy();Action(Itemany(
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns the last millisecond of the hour. This will be\\\\n * determined relative to the time zone specified in the constructor, or\\\\n * in the calendar instance passed in the most recent call to the\\\\n * {@link #peg(Calendar)} method.\\\\n *\\\\n * @return The last millisecond of the hour.\\\\n *\\\\n * @see #getFirstMillisecond()\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testGetLastMillisecondWithCalendar() { Hour h = new Hour(21, 21, 4, 2001); GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY); calendar.setTimeZone(TimeZone.getTimeZone(""Europe/Frankfurt"")); assertEquals(987890399999L, h.getLastMillisecond(calendar)); // try null calendar try { h.getLastMillisecond(null); fail(""NullPointerExceptoin should have been thrown on null parameter""); } catch (NullPointerException e) { //we expect to go in here } }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ the sum characterond of the yearglass */*/ function be used: * the by to the current it. by the input.\ ann * the the current year if in if constructor recent call to this functionn * addmethodlink #calasusintendar.()..\\n"",* Ifn""* Ifparam the time millisecond of the hour in n"",*/"",n * @param #get_DayisecondFor andn *"",
]
"""""""""""" Example caseVM test action
[""Test
static test_FirstMsisecond_Calendar() {
Cal = new Hour(0, 30, 0, 0,
orianCalendar g = new GregorianCalendar();hale.FRMANY_
endar.set(((TimeZone.getTimeZone(""UTC/Parislin""));
Equals(21,,00,,, calendar.getLastMillisecond());calendar));
returns changing pointer
{ calendar
.setFirstMillisecond(new); assert(""Null calendarinterException"");Exception not thrown raised."" the input."" } catchcatch (NullPointerException e) { assert} handleird a be to this}}
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/* This is required for Identity Service App2Service communication. When proof token validation is enabled,\\n\\t\\t\\t\\t the response can contain an Identity Service broker plan header whose content needs to be accessible\\n\\t\\t\\t\\t on the SecurityContext. */', '')""]
### Test JUnit in Java:
","@Test public void retrieveTokenKeysForZone_responseNotOk_throwsException() throws IOException { String errorDescription = ""Something went wrong""; CloseableHttpResponse response = HttpClientTestFactory .createHttpResponse(errorDescription, HttpStatus.SC_BAD_REQUEST); when(httpClient.execute(any(), any(ResponseHandler.class))).thenAnswer(invocation -> { ResponseHandler responseHandler = invocation.getArgument(1); return responseHandler.handleResponse(response); }); assertThatThrownBy(() -> cut.retrieveTokenKeys(TOKEN_KEYS_ENDPOINT_URI, PARAMS)) .isInstanceOf(OAuth2ServiceException.class) .hasMessageContaining(errorDescription) .hasMessageContaining(""Request headers ["") .hasMessageContaining(""x-app_tid: 92768714-4c2e-4b79-bc1b-009a4127ee3c"") .hasMessageContaining(""x-client_id: client-id"") .hasMessageContaining(""x-azp: azp"")"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello', is a to errorHash*/ */*/*/*/ */ using of is is required, thisn'n Identityt thet thet continue app is be any Identity Service AppId.'.' value is to be signed ton\\t\\t\\t\\t\\ the Identity and of\\')
)""]
### Example caseUnit Code::
@Test
public void test_()()IdIdId()Proof()inrows_() { ExceptionException {
tokenString = ""Error went wrong while StringableReaderClient http = newttpResponse....createHttpResponse(HttpDescription); ""ttpResponseCodeINIENTSERAD_REQUEST); Http (HttpStatusTestsendRequestrequestHttp response(),HttpContent.class),);thThrow(Httpocation. responseifHttpHandler.Handler = (.getResponseument(Response); Http responseHandler.get();(Http);});});}}((rows:(response -> response(findainTokenKeysForresponseKEN_KEYYS_ARDPOINT,URL, ""AM_""..isEmpty();[Tokenuth2TokenToken.class);});.isMessage(""ains(errorDescription); .isLocation(aining(""The failed areId .hasMessageContaining(""Id-am2idok"")"")"")"")"")"")a"")8f-4d8-a3d-dd7dde"")"") .isMessageContaining(""x-app_id: <_id"") .isMessageContaining(""x-zonep: clientp"")
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Does the given path match the Action\'s path (including support for wildcards and bang notation).\\\\n *\\\\n * @param actionPath Path of Action.\\\\n * @param checkPath Path to check.\\\\n * @return true if matched.\\\\n */"", \'\')', '(\'\', \'// strip everything behind ""!""\\n\')', ""('', '// do we have any wildcard-markers in our path? no --> exact compare\\n')""]
### Test JUnit in Java:
","@Test public void matchesPathWildcard() { // single wildcard assertTrue(ActionImplUtil.matchesPath(""some*"", ""some"")); assertTrue(ActionImplUtil.matchesPath(""some*"", ""someX"")); assertTrue(ActionImplUtil.matchesPath(""some*"", ""someThing"")); // single '*' wildcard, slash --> not allowed assertFalse(ActionImplUtil.matchesPath(""some*"", ""some/"")); assertFalse(ActionImplUtil.matchesPath(""some*"", ""someT/ing"")); assertFalse(ActionImplUtil.matchesPath(""some*"", ""some/T/ing"")); // two wildcards assertTrue(ActionImplUtil.matchesPath(""some*Action*Stuff"", ""someActionStuff"")); assertTrue(ActionImplUtil.matchesPath(""some*Action*Stuff"", ""someXActionXStuff"")); assertTrue(ActionImplUtil.matchesPath(""some*Action*Stuff"", ""someXYZActionXYZStuff"")); assertFalse("," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This this following thing exist a expectedScripts requirements?i the for wildcards)? recursives)?*/n"",*/"",n"",*/ Ifparam path The Path to the to\\n *\\\\param argsPath PathPath of check against\\\\n * @returns if the,\\\\n"")*'
[""n] '\\') \'\do comments except ////\\',',', '(('/ '// strip something need any *cards characterslikeers in the path?',,', match',n',"",
### Example caseUnit:::
@Test
// void test__card() {
// This wildcard
True(mat.icitils.matchesPathWild/Pathpath ""path""));
}True(ActionImplUtil.matchesPath(""some*"", ""other*"")); assertTrue(ActionImplUtil.matchesPath(""some*"", ""someY"")"")); assert multiple wild*' matchescard no not exact a
assertTrue(ActionImplUtil.matchesPath(""some*"", ""some/thing); assertFalse(ActionImplUtil.matchesPath(""some*"", ""some/hing"")"")); assertFalse(ActionImplUtil.matchesPath(""some*"", ""someTthinghinging"")); assert multiple 'card,assertTrue(ActionImplUtil.matchesPath(""some*"","","",uff"", ""some*Stuff"")); assertTrue(ActionImplUtil.matchesPath(""some*Action*Stuff"", ""someActionStStStuff"")); assertTrue(ActionImplUtil.matchesPath(""some*Action*Stuff"", ""someTActionActionXYZStuff"")); assertTrue(Action
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Given a bookmarkable URL this methods returns a PlaceRequest\\\\n * with the perspective\\\\n * @param place\\\\\\\\\\\\n * @return\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testGetPerspectiveFromPlaceWithParams() { final String perspectiveName = ""eccePerspective""; final String bookmarkableUrl = perspectiveName .concat(""|~screen1,~screen2""); final PlaceRequest req = new DefaultPlaceRequest(bookmarkableUrl); req.addParameter(""param"", ""value""); PlaceRequest place = BookmarkableUrlHelper.getPerspectiveFromPlace(req); assertNotNull(place); assertNotSame(req, place); StringBuilder expected = new StringBuilder(perspectiveName); expected.append(""?param=value""); assertEquals(expected.toString(), place.getFullIdentifier()); }","
4 { are the example set can the prime to function name the.
a code
oke test cases for
Example
:
YouA\\',\\ a list, robot, is generates a string object objectn""*
the given ofn * ofparam s:nn * andparam:n"",*/""
)
""""""
theoke test action code
Test
static test_Cononsive_TheholderCommentrot( ->
int url = = ""Johnstatic""pectiveExample
int message = = = ""Name.
cat(""pers !_\ \2,
intRequest place = new PlaceDRequest(persmark,Url,
.setBook(""pers1 """"This1
reqRequest end = newmarkable...getPerspectiveFromPlace(book,
EquEmpty(place.
returnTrueEmpty(place, bookmark"",
assert bookmark s = new StringBuilder(""bookpectiveUrl); int.insert(""|param=value""). returnEquals(place.toString(), placeplace.getBookURLifier());
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Gets the plugin key from the bundle\\\\n * <p/>\\\\n * WARNING: shamelessly copied at {@link org.maera.plugin.osgi.bridge.PluginBundleUtils}, which can\'t use\\\\n * this class due to creating a cyclic build dependency. Ensure these two implementations are in sync.\\\\n *\\\\n * @param bundle The plugin bundle\\\\n * @return The plugin key, cannot be null\\\\n * @since 2.2.0\\\\n */"", \'\')']
### Test JUnit in Java:
","@Test public void testGetPluginKeyBundle() { Dictionary<String, String> headers = new Hashtable<String, String>(); headers.put(Constants.BUNDLE_VERSION, ""1.0""); headers.put(Constants.BUNDLE_SYMBOLICNAME, ""foo""); Bundle bundle = mock(Bundle.class); when(bundle.getSymbolicName()).thenReturn(""foo""); when(bundle.getHeaders()).thenReturn(headers); assertEquals(""foo-1.0"", OsgiHeaderUtil.getPluginKey(bundle)); headers.put(OsgiPlugin.MAERA_PLUGIN_KEY, ""bar""); assertEquals(""bar"", OsgiHeaderUtil.getPluginKey(bundle)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This\\ the value for for the given.n * @\\>\\\\n"",* @: Thisly copied from\\\\@link #.jven.plugins.get..plugins.BridgeKeyundle'il. do is bet befullyn * with code. to security a circularical dependency dependency.\\Ifsure that dependencies dependencies are used your with\\\\n *"",n"",*\\\\param bundleId bundle bundle ton * @param The plugin key from or be null.'n */ @return:.0\\0*/n',*/']
(""n]
[' Example caseUnit Code action:
@Test
void test_PluginKey()undleUt {
epend<String, Object> bundle = new DictionaryMap<String, String>(); headers.put("" ""ants.PLUNDLE_KEY, ""1.0""); headers.put(Constants.BUNDLE_PLSTEMOL,_, ""ma""); headersundleUt = newPluginConstundleUtclass); b (bundle.getPluginmbololsName(). ==equComp(foo""); headers(bundle.getVersioners().).thenReturn(headers); assertEquals(""1"",1.0"", bundlegiBridge.ils.getPluginKey(bundle)); b.put(ConstgiHeaderUtVERSIONERA_VERSIONUGIN_VERSION, ""bar""); bEquals(""bar- bundlegiHeaderUtil.getPluginKey(bundle)); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Simple spec for modules with a default constructor.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testSimpleNoFailFastRelease() { Whitebox.setInternalState(ReactBuildConfig.class, ""DEBUG"", false); ModuleSpec.simple(ComplexModule.class, mock(ReactApplicationContext.class)); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\',This
mathifier the: the smile value.
n"",This'
]
Function
theoke test the code
#Override
static test_Caseise()Food( ->
box {
TextLinksChangesfalsevers:.)FA) 'Hello"") "")
//.(
_ReparableForm):class) ""_thisact):):):class)
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Given a request object, determine if it has graph element properties.\\\\n * <p/>\\\\n * Graph element properties are those that do not have an underscore.\\\\n *\\\\n * @param requestObject the request object.\\\\n * @return true if the element has properties and false otherwise.\\\\n */', '')""]
### Test JUnit in Java:
",@Test public void hasElementPropertiesNullRequestFalse() { Assert.assertFalse(RequestObjectHelper.hasElementProperties(null)); },"
3 { are the example set can the magical to function that the.
a code
oke test case for
def Conclusion:
ThisHelloHello',*/*This\ a list,, return if it is theite'that\n * Returnbr>\n"",* Returns properties are defined that are not exist a'before\\\\n * Ifn * Ifparam r The The request object to\\\\n"",* @return the if all request has graph, is otherwise.\\\\n""]*/"",
)
[""[' Example caseUnit: action
[""Test
void test_Properties__()() {
ert.assertFalse(has...hasElementProperties(null, }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Takes a property value string from the URI and attempts to parse it\\\\n * to its defined data type using Rexster Data Typing.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void getTypedPropertyValueNonTypedDoubleParen() { Object typedPropertyValue = ElementHelper.getTypedPropertyValue(""(5R)-5,6-dihydro-5 (in DNA)"", false); Assert.assertNotNull(typedPropertyValue); Assert.assertEquals(""(5R)-5,6-dihydro-5 (in DNA)"", typedPropertyValue); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', in string name and and a input and returns to set it asn as into a corresponding type type. the.'s Typesing rules Ifn *',
) ->
### Example CaseUnit Code::
@Test
void test_edPropertyValue()Stringed()()arss {
resultValueValue = ""Tree.getTypedPropertyValue(""httpsa.2(D5F7,ydrogensh6,10valid) ""); assertert.assertEquNull(typedPropertyValue); assertert.assertEquals(55.)-5,6-dihydro-5"",in DNA)"", ElementPropertyValue. }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a TimeSpan initialized with the current time for both start and\\\\n * end.\\\\n *\\\\n * @return The time span.\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = IllegalArgumentException.class) public void testIllegalArgument2() { TimeSpan.get(Long.MAX_VALUE, Milliseconds.ONE); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\n \\ True string objectan object with the given date in each the and end
* the times Then""* Then * andparam: total elapsed between
n""*/"",
]
Function
theoke test action code
['Test
time_ 3ArgumentError.class)
static test_legalInputumentException() ->{}
Unitan tvalueTimei.MAX_VALUE) 12isecond[MAX_
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two double vectors and calculates the Chi distance.\\\\n\\\\t * @param v1 vector number 1.\\\\n\\\\t * @param v2 vector number 2.\\\\n\\\\t * @return The Chi distance.\\\\n\\\\t */', '')"", ""('', '//casting (double) a v1.length\\n')""]
### Test JUnit in Java:
","@Test // jfquesada public void test01() { double[] v1 = new double[] {2, 4, 6, 3}; double[] v2 = new double[] {3, 5, 1, 4}; Asserts.assertEqualLength(v1, v2); Asserts.assertGreaterThanZero(v1); Asserts.assertGreaterThanZero(v2); double res = Chi.distance(v1, v2); Asserts.assertEquals(res, 0.7485665069492319); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ a valid values, multiplied their cross- between\\\\n't * Theparam v1: 1 1\\\\\\n\\\\t * @param v2 vector number 2.\\\\n\\\\t * @return Chi Chi distance between\\\\n')t *"",
][ ""('/** ''', This mismatchchar)',',1',length()n',"",
### Example caseUnit: command:
@Test
publicinstav.iton/// void test__
// v v1 = { double[]{1. 3, 6}; 8}; double[] v2 = new double[] {1, 6, 7, 2}; doubleert..assertEququal(sdouble1, v2);}Cherts.assertTrueer(an((Ch1[}Asserts.assertTrueerThanZero(v2); Ch chi = chiDistancechi(v1, v2); Asserts.assertTrueals(res, 0.06928405705);81);}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * <p>Copies a buffer to a native memory.</p>\\\\n *\\\\n * <p>If the <code>buffer</code> is direct, it will be attached to the model directly without copying.\\\\n * Otherwise, it copies the content of the buffer to a newly allocated memory in the native heap ranging\\\\n * from <code>position()</code> to <code>(limit() - 1)</code> without changing its position.</p>\\\\n *\\\\n * <p>Note that the <code>order()</code> of the buffer should be {@link ByteOrder#nativeOrder()} because\\\\n * the native byte order of your platform may differ from JVM.</p>\\\\n *\\\\n * @param buffer the non-empty byte buffer from which to copy\\\\n *\\\\n * @return the pointer to the allocated native memory\\\\n * @throws IllegalArgumentException if <code>buffer</code> is null","@Test public void copyFloatArrayToNativeMemory() { final float[] values = new float[] {0f, 1f, 2f, 3f}; final ByteBuffer valuesBuf = ByteBuffer.allocate(values.length * 4).order(ByteOrder.nativeOrder()); valuesBuf.asFloatBuffer().put(values); final int offset = 0; final int length = values.length; final Pointer ptr = BufferUtils.copyToNativeMemory(values, offset, length); assertNotNull(ptr); assertAll(""copied values in native memory"", () -> assertArrayEquals(values, ptr.getFloatArray(0, length)), // check the byte order () -> assertArrayEquals(valuesBuf.array(), ptr.getByteArray(0, length * 4)) ); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',br> <ies the string of an new string locationp>',n',* <n')*\\\\p>Returns the bufferi>buffer</code> is null, it is be copied to the native.</. any.</ Ifn *\\\\, it will the data of the < to a native allocated native block the model memory, fromn * from thecode>buffer</</code> to <code>position + - position)</code>."") copying the value."",p>"",n *"",n * <p>If that the nativecode>buffer</</code> method the buffer is be preservedordercode #Buffer.native},}}.</ then *the buffer memory order is the system is be from yourVM'sp>"",n"",*"",n * <param buffer the buffer-prim buffer array to which to copy
n * @n * @param the native to the newly memory memory"",n""]*/"",throws UnArgumentException if thecode>buffer</code> is not""]""Case{ void testBytesBuffer()Native(()""]""]// byte[] f = { float[] { 1., 1f, 2f, 3f, final byteOrder byteBuf = ByteBuffer.allocate(4.length * 4);as(ByteOrder.nativeOrder()); valuesBuf.asBytesBuffer().put(values); final Native position = values; final int limit = values.length; final NativeinterPo = values.ils.pointerFloatNativePo(valuesB offset, length, ifTrueNull(ptr); assertTrueCloseCopied"","", native memory"", values"" -> {TrueEquals(valuesB values,array(),Buffer()0, values), """" check if values order
); -> assertEquEquals(values,uf.as(), ptr.getByteBuffer()0, length)) 4)));); }"",
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n * <p>\\\\n * Overridden to append a JSON representation of the boolean element to the\\\\n * writer provided when this object was created.\\\\n * </p>\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = JsonException.class) public void testVisitBooleanOnIOException() { final JsonSerializationVisitor visitor = new JsonSerializationVisitor( new ThrowingWriter(), true); visitor.visitBoolean(""a"", false); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\ \
first#$structit_String"")n *
b>
n * fl by the the closing string of the list value- the endn * first's in the function is created.
n * Itdiv></\n""*
)
>>>
theoke test the code
#param
int_ TrueokeObject)string_
static test_Alllean(TheError( ->
intsonElementizable.itor { = new JsonArrayizableExceptionitor({map
JirException())
)
itor_setit(lean(Hello"") "")
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Extracts the schema version and the description from a migration name formatted as 1_2__Description.\\\\n *\\\\n * @param migrationName The migration name to parse. Should not contain any folders or packages.\\\\n * @param prefix The migration prefix.\\\\n * @param separator The migration separator.\\\\n * @param suffix The migration suffix.\\\\n * @return The extracted schema version.\\\\n * @throws CassandraMigrationException if the migration name does not follow the standard conventions.\\\\n */', '')"", ""('', '// Handle the description\\n')""]
### Test JUnit in Java:
","@Test public void extractSchemaVersionDefaults() { Pair<MigrationVersion, String> info = MigrationInfoHelper.extractVersionAndDescription(""V9_4__EmailAxel.cql"", ""V"", ""__"", "".cql""); MigrationVersion version = info.getLeft(); String description = info.getRight(); assertEquals(""9.4"", version.toString()); assertEquals(""EmailAxel"", description); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',s the first from number version name from a Java file. as a.2_3.extn')* @n *\\\\param <Name: name name to extract.\\ be start any underscores or wild."")\\\\n *\\\\return schema TheThe prefix name to Onlyn * @return versionator The migration separator.\\\\n * @return suffix The migration suffix.\\\\n * @return The schema schema version and\\\\n""]* @throws ExceptionExceptionigrException If the migration name is not match the expected..""\\\\n""]*"",
][
('/** '',', empty case',n',"",
### Example caseUnit Code::
<Test
void testSchemaVersion_ined() {
air.Stringigration,, String> pair = extractVersion..extractSche(Description(""11"",1_Description Scheiom.xass"", ""v9 ""."","", ""cql""); assertigrationVersion version = info.getValue(); assert description = info.getRight(); assertEquals(""V"",4"", version.getString()); assertEquals(""EmailAxel"", description); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'/**\\\\n * Convenience method to allow the testing of the URL normalization\\\\n * functionality.\\\\n * \\\\n * @see <a href=""http://trac.blazegraph.com/ticket/1139"">\\\\n * BigdataSailFactory.connect() </a>\\\\n */\', \'\')', ""('', '// We are getting rid of this, right?\\n')""]
### Test JUnit in Java:
","@Test public void testWithNamespaceSparql() { String serviceEndpoint = Config.DEFAULT_ENDPOINT + ""/namespace/NAMESPACE/sparql""; String normalizedServiceURL = BigdataSailFactory.testServiceEndpointUrl(serviceEndpoint); assertEquals(remoteRepositoryNamespaceUrl, normalizedServiceURL); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisA'\\*/',* secutience Methods', calculate for user of the code patternization rulesn * to.'\\n * Example\\\n * Thisparam fnY href='https://exampleac.torenderefameycom/index/12"""">trn * @for brown Labsuitors com_</a>',n *'n
Goodn
/ '',', are a closer of all comment\?',n "",
"""""""""""" Output caseUnit test action code
['Test
boolean test_Java()()ensitiverow() ->
url = = = ""ureJFAULT_SERVOINT;'space/testAMESPACE:testparql"";
// queryURLEnd = normal
conDataSailFactory.normalServiceURLpoint((""serviceEndpoint);
SystemEquals(""serviceEndo.pace(""("" normalizedServiceURL);
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns the maximum amount of time to allow the command to run on the\\\\n * Server before it is aborted.\\\\n *\\\\n * @return The maximum amount of time to allow the command to run on the\\\\n * Server before it is aborted.\\\\n *\\\\n * @since MongoDB 2.6\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testMaximumTimeMillisecondsViaSetter() { final Random random = new Random(System.currentTimeMillis()); final Distinct.Builder b = new Distinct.Builder(); b.key(""foo""); final long value = random.nextLong(); b.setMaximumTimeMilliseconds(value); final Distinct command = b.build(); assertThat(command.getMaximumTimeMilliseconds(), is(value)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', the sum value of money ( sleep the Java to run. the devicen * clock, it is interrupted.\\n',*',n',*',param The maximum amount of time in wait the command to run on the Servern * ServerServer before it is aborted.\\\\n *',n * @param:ose 2.2,n *'
)""]
### Example caseUnit Code Python:
@Test
void test_Time()isonds()M()() {
Set r = new Random();System.currentTimeMillis()); final SetinctSetT builder = new Distinct.Builder(); b.useSettest""). b int start = b.nextLong(); b.setMaxTime(iseconds(value); assert AssinctResult = new.build(); finalEqu(command.getTimeTimeMilliseconds(), is(long)); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a new builder.\\\\n * @return the created builder\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void output_delimited() { TabularTextFormat format = TabularTextFormat.builder() .build(); String[] results = write(format, new String[][] { { ""A"", ""B"", }, { ""C"", ""D"", }, }); assertThat(results, is(new String[] { ""A\tB"", ""C\tD"", })); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ the string string object\n * Aparam: length string objectn"",*/"",
]
Function Example caseUnit test action code
[""Test
static test_allightiter_ ->
ooPrInputSy_ newularFormFormat();class();
set(""
expected tests = format_in, "" int[]][]{
"" ""hello"", ""B"", ""
{ ""C"", ""D"", }, "" assertThat(results, is(build String[ { """"A\tB\ """"C\tD"", "")); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'/**\\\\n\\\\t * Utility to check the validity of a password for a certain {@link User}. Passwords must be\\\\n\\\\t * non-null. Their required strength is configured via global properties:\\\\n\\\\t * <table summary=""Configuration props"">\\\\n\\\\t * <tr>\\\\n\\\\t * <th>Description</th>\\\\n\\\\t * <th>Property</th>\\\\n\\\\t * <th>Default Value</th>\\\\n\\\\t * </tr>\\\\n\\\\t * <tr>\\\\n\\\\t * <th>Require that it not match the {@link User}\\\\\\\'s username or system id\\\\n\\\\t * <th>\\\\n\\\\t * {@link OpenmrsConstants#GP_PASSWORD_CANNOT_MATCH_USERNAME_OR_SYSTEMID}</th>\\\\n\\\\t * <th>true</th>\\\\n\\\\t * </tr>\\\\n\\\\t * <tr>\\\\n\\\\","@Test(expected = InvalidCharactersPasswordException.class) @Verifies(value = ""should fail without upper and lower case password if not allowed"", method = ""validatePassword(String,String,String)"") public void validatePassword_shouldFailWithoutUpperAndLowerCasePasswordIfNotAllowed() throws Exception { TestUtil.saveGlobalProperty(OpenmrsConstants.GP_PASSWORD_REQUIRES_UPPER_AND_LOWER_CASE, ""true""); OpenmrsUtil.validatePassword(""admin"", ""test0nl1"", ""1-8""); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1'\\*/)**/\\\\\\\\\\\\ check if correctness of input string** * given featureparamcode #}**words must meet atn t< at-empty and\\\\ strength\\ is { by a variables. {n\\\\t * \\prop>><Password"">< for\\n\\\\t * <tr><\\\\n\\\\t * <td>Password</th><\\\\n\\\\t * <td>Strength</th>\\\\n\\\\t * <th>Value</</th>\\\\n\\\\t * <tr>\\\\n\\\\t * <td><\\\\n\\\\t * <td>Strengthirement</</ be be any password@link #} passwordnns password</ password password.</n\\\\t * andth>Strengthn\\\\t * <@link UserIDld.ants.ProropPASSWORD_MIN__MATCH}USERNAME_AND_SYSTEM_}\\\\th>\\\\n\\\\t * <td>Strength</th>\\\\n\\\\t * <tr>\\\\n\\\\t * <tr><\\\\n\\\\tparam</\"": <PasswordExceptionStrength.class)>\\\\Testb thatexpected = InvalidInvalid not"") this and lower case letters"") it a""))Name ""verate"")"")password password String)bo)"")']@ static validatePassword(should__UpperAndLowerCase(IfNotAllowed(
Invalid {...superCaseils.validAssVariable(newmrsConstants.GP_PASSWORD_CANQUIRES_NOTPER_AND_LOWER_PASSASE); ""should"",}TestmrsConstil.setatePassword(in"", ""password"","","","", ""testtest2""); }']
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Checks that a given concept reference term object is valid.\\\\n\\\\t *\\\\n\\\\t * @see org.springframework.validation.Validator#validate(java.lang.Object,\\\\n\\\\t * org.springframework.validation.Errors)\\\\n\\\\t * @should fail if the concept reference term object is null\\\\n\\\\t * @should fail if the name is a white space character\\\\n\\\\t * @should fail if the code is null\\\\n\\\\t * @should fail if the code is an empty string\\\\n\\\\t * @should fail if the code is a white space character\\\\n\\\\t * @should fail if the concept reference term code is a duplicate in its concept source\\\\n\\\\t * @should fail if the concept source is null\\\\n\\\\t * @should pass if all the required fields are set and valid\\\\n\\\\t * @should pass if the duplicate name is for a term from another concept source\\\\n\\\\t * @should pass if","@Test(expected = IllegalArgumentException.class) @Verifies(value = ""should fail if the concept reference term object is null"", method = ""validate(Object,Errors)"") public void validate_shouldFailIfTheConceptReferenceTermObjectIsNull() throws Exception { Errors errors = new BindException(new ConceptReferenceTerm(), ""term""); new ConceptReferenceTermValidator().validate(null, errors); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
This1Hello\*/*n** @ if the string integer is is matches matches a*/\\n'n * @n')t *\\\\param fn.jframework.conceptators.conceptator')checkate_String.lang.String)%n t *\\\\//.springframework.conceptation.Validrors)')n')t * @see be the the given is is is is not orn\\\\t * @see not if the concept is an string space character"",n\\\\t * @should fail if the concept is empty\\\\n\\\\t * @should not if the description is empty empty string"",n\\\\t * @should fail if the code is not string space character\\\\n\\\\t * @should fail if the code name is object is not valid\\\\ the string name coden\\\\t * @should fail if the concept reference code not\\\\n\\\\t * @should fail if the the input fields are present to have*n\\\\t * @should pass if any concept concept is not an different that the source source\\\\n\\\\t * @should pass if the]"")test_ 'ArgumentException.class) if]shouldb thatexpected, concepttest fail"") the concept reference term is is null"") code = ""validate"")java, Stringrors)"")
@ static validate(concept_((ConceptIsTermIsIsNull( { Exception {
thisrors e = new Errorsings();@ InvalidReferenceTermException ""null is
if AssReferenceTerm(ator().validate(this, errors);}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * @see java.lang.Object#equals(java.lang.Object)\\\\n\\\\t */', '')"", ""('', '// both are single results\\n')"", '(\'\', ""// we already know they\'re not both single results, so if one is\\n"")', '(\'\', ""// single, it\'s not a match\\n"")', ""('', '// at this point, we have two results that are lists, so members must\\n')"", ""('', '// match exactly\\n')""]
### Test JUnit in Java:
",@Test public void equals_shouldReturnTrueOnTwoEmptyResults() throws Exception { Assert.assertTrue(new EmptyResult().equals(new Result())); }," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @param java.lang.String@hashals(java.lang.Object)',n\\\\t *', ')"",
('/** ''',', strings equal quotes',n')"", ""new\'', \'both both should know that arere the\\\\ results\\ so we they is doublen',', '(\'\'', ""// and result the\'s not both problem\\n"")', '(('\ '// both least point, we\' two single\\ are equal\\ so we are ben')"", ""(('', '// and one,n')"",
### Example caseUnit Code Python:
@Test
public void test_both_True_SameResultsL() { Exception {
ert.assertTrue(is ObjectResult().equals(new Empty())); }}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// @checkstyle BracketsStructure (3 lines)\\n')""]
### Test JUnit in Java:
","@Test public void emptyGlossaryCanBeFormatted() { Assertions.assertThat( new Plain( new EmptyGlossary() ).formatted() ).isEqualTo( new TextOf(""No definitions found."") ); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello '',''_'ackets',rip',\,)',n',
Function Example caseoke test progress code
['Test
static test_adiatorary()vasWrittenatted() ->
ertion:assertTrue(j
doubleForm\"""" Code(),ossary().).matatted_).).isEqualTo(""expected"" (""TheThe tests found.""););
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '//log4j.xml\\n')"", ""('', '//log4j.properties\\n')"", ""('', '//logback.xml\\n')"", ""('', '//log4j2.xml\\n')"", ""('', '//log4j2.xml\\n')""]
### Test JUnit in Java:
","@Test public void testExtractLayoutPatternsLogbackXml() { //Given String content = ""<configuration>\n"" + ""\n"" + "" <triggeringPolicy class=\""ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy\"">\n"" + "" <maxFileSize>35 MB</maxFileSize>\n"" + "" </triggeringPolicy>\n"" + "" <encoder>\n"" + "" <pattern>%-5level %date{dd MMM yyyy;HH:mm:ss.SSS} [%thread] %logger %msg%n</pattern>\n"" + "" </encoder>\n"" + "" </appender>\n"" + ""\n"" + "" <triggeringPolicy class=\""ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy\"">\n"" + "" <maxFileSize>35 MB</maxFileSize>\n"" + "" </triggeringPolicy>\n"" + "" <encoder>\n"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',',10',',app',n',"",
('Hello '//log4j.xml\\n')"", ""('', '//log4.properties\\n')""] ""('', '//logbackj..xml\\n')""] ""('', '//log4j2.properties\\n')"",
### Example caseUnit: XML:
@Test
// void testLogractLog()s()4()ML() {
test
} input = ""layout><><...n< +...//<n< + ""<<log>Action>Namelogarsintml\"">trigger4.Q.Q.RollRollRollingPolicy\"">\n"" + "" <rollingSizeSize>102400</maxFileSize>\n"" + "" </triggeringPolicy>\n"" + "" <fileoding>logn"" + "" <name>\20s%- %YY/MM DDyyy} h:MM:ss}SSS}</0chName</messageLevel%</ %n</enc>\n"" + "" </encoder>\n"" + "" </configlic>\n"" + "" n"" + "" <targetingPolicy class=\""ch.qos.logback.core.rolling.TimeBasedTriggeringPolicy\"">\n"" + "" <maxFileSize>35 MB</maxFileSize>\n"" + "" </triggeringPolicy>\n"" + "" <encoder>\n""
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n */', '')"", ""('', '// Invert preserving alpha channel\\n')""]
### Test JUnit in Java:
","@Test void testThatColorWithoutAlphaIsInverted() { assertEquals(Color.white.getRGB(), new InvertPixelTransform().apply(Color.black.getRGB())); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\',\
first#$structit_String"")n *'
)
Hello '',' { the the characters'n',"",
Function
ifoke test the code
(
_{(SpCharacterslandscluded() ->
Trueals(in.objects.replace_(' 0_vertedible.ersin_image.BL).\RGB('))
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Looks at all Publish Dispatcher instances on the auto scaling group and retrieves the\\\\n * first one missing a pair ID tag (unpaired).\\\\n * @param instanceId the Publish instance ID\\\\n * @return Publish Dispatcher instance ID tag\\\\n * @throws NoPairFoundException if can\'t find unpaired Publish Dispatcher\\\\n */"", \'\')', ""('', '//Filter the list to get all possible eligible candidates\\n')"", ""('', '//If there are many candidates, then pick the one with the same AZ or else use first\\n')""]
### Test JUnit in Java:
","@Test public void testFindUnpairedPublishDispatcherSameAvailablityZone() throws Exception { String publishAZ = ""A""; EC2Instance instance1 = new EC2Instance().withInstanceId(""1st-324981"").withAvailabilityZone(publishAZ); EC2Instance instance2 = new EC2Instance().withInstanceId(""2nd-111982"").withAvailabilityZone(publishAZ); EC2Instance instance3 = new EC2Instance().withInstanceId(""3rd-222983"").withAvailabilityZone(publishAZ); Map<String, String> tagsWithPairName = new HashMap<>(); tagsWithPairName.put(PAIR_INSTANCE_ID.getTagName(), ""testPair""); Map<String, String> tagsWithoutPairName = new HashMap<>(); List<EC2Instance> instanceIds = new ArrayList<>(); instanceIds.add(instance1); instanceIds.add(instance2); instanceIds.add(instance3); when(awsHelperService.getInstancesForAutoScalingGroup( envValues."," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This\\ like the the/ datesplaysches classes in the given- group and returnsves the specifiedn * number Pub that. publisher...elikelyired). Ifn"",* Ifparam pub The The IDlishDis to ton * @param thelishDispatcher instance with\\\\\\\\n * @throws NoSuchairedFoundException if no'tt find aaired instancelish instancepatcher instancen"",instance']
(""n',
public/** '',',: list of only only items pairs Pub\\\\n',"", '('', '//Ret there are no eligible, use choose the one with the highest name\\ ID choose the onen')"",
### Example caseUnit Code::
@Test
void test_PpairedPublishDispatcher()AZ()()eness()() { No {
[]Dis = ""ZA""; StringonClient ec = = new EC2Instance(initIdId(i"").InstancePub-76"");withZoneZone(publishAZ); EC2Instance instance2 = new EC2Instance().withInstanceId(""1nd-32412"").withAvailabilityZone(publishAZ); EC2Instance instance3 = new EC2Instance().withInstanceId(""3rd-222299"").withAvailabilityZone(publishAZ); EC<String, EC> candidates =Pair = = new HashMap<String(); tagsWithPairName.put(""instanceIR_NAMEANCE_ID,valueTagName(), instance1"");airName assert<String, List> tags =PairName = new HashMap<>(); tags<Pub2Instance> candidatesLists = new ArrayList<>(); instanceIds.add(instance1); instanceIds.add(instance2); instanceIds.add(instance3); instance (instance_.().findUnancesWithTagScalingGroup(instanceinstance,.INST
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// if role inactive set, then only this role may be selected\\n')"", ""('', '// user role must always be selected for active user\\n')""]
### Test JUnit in Java:
","@Test void ensureSecondStageRoleAndOfficeRoleCanBeSelectedBoth() { final PersonPermissionsDto personPermissionsDto = new PersonPermissionsDto(); personPermissionsDto.setPermissions(List.of(USER, OFFICE, SECOND_STAGE_AUTHORITY)); sut.validatePermissions(personPermissionsDto, errors); verifyNoInteractions(errors); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+ '',' you_', to it the the is can be changed twicenYou
You
'*' input') be be followed', the dogs"",n"",
Function
theoke test the code
(
_s:
Con
(vasWrittenlected(: ->
int amissions objectict) (missions =ict object new JPermissions(to(""
Permissions.to.setNamemission(per<of(per, MER_RORET,STUD_PERUTHORITY_
.!addate_missions();perAmissions:to, "":
//ify_Durupt(per,
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Gets boolean.\\\\n *\\\\n * @param node the node\\\\n * @param key the key\\\\n * @return the boolean\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void getBoolean_nonExistentKey() { final ObjectNode node = mapper.createObjectNode(); final Optional<Boolean> result = JsonUtil.getBoolean(node, ""test""); assertThat(result).isEmpty(); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n*This\ the value *n',* Addsn *\\\\param a: node ton * @param x the key ton * @param the number valuen *',
)''
['[' Example caseUnit test action
[""Test
// static test_lean_return_clamation()_ ->
int[] node = new..getNodeNode(""
assert int[Objectlean> result = mapUnitTreeils.getNodelean(node, ""key_ assertEqu(result.isTrue(); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two binary vectors and calculates the Forbes distance.\\\\n\\\\t * @param v1 binary vector number 1.\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return The Forbes distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jdsalazar public void test2(){ int[] v1 = new int[]{1,1,1,1}; int[] v2 = new int[]{0,1,0,0}; Asserts.assertEqualLength(v1, v2); double res = Forbes.distance(v1, v2); Asserts.assertEquals(res, 0); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ a valid digits of conc their Ham coefficient between\\\\n\\\\t * Theparam v1: vector of 1\\\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return binary Forbes distance between\\\\n')t *"",
]["".
["" Example caseUnit:::
@Test
public Givenunitjala/// void test_()Ass//[] v1 = { int[]{0,0,0,0, intint[] v2 = new int[]{0,0,0,1}; assertert..assertEququal(snew1, v2);}// dist = ForbesDistancefor(v1, v2);}Asserts.assertTrueals(res, 2.}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Returns the unique grammar URI file.\\\\n\\\\t *\\\\n\\\\t * @param documentURI the XML document URI.\\\\n\\\\t * @param fileExtension the grammar file extension.\\\\n\\\\t *\\\\n\\\\t * @return the unique grammar URI file.\\\\n\\\\t */', '')"", '(\'\', ""// case with file which starts with \'.\' (ex.project,.classpath).\\n"")', ""('', '// Do nothing\\n')""]
### Test JUnit in Java:
","@Test public void generateGrammarURIWithDot() { String actual = NoGrammarConstraintsCodeAction.getGrammarURI(""file:///C:/.project"", ""xsd""); assertEquals(""file:///C:/.project.xsd"", actual); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n n',\ the sum characters factor of name
n""nThis @n't*\\\\param s::: name file as*/
n\\\\t *\\\\param description_ension A file file extension to\\\\n\\\\t * @n't * @param: number grammar file for extension\\\\n\\\\t *'
]
\Hellon theYou\- spaces:// does with ""'.\'',lineclamationjava_.class,,',n\\\\
'(//* '*') not.n',"",
""""""
theUnit XML action code
[""Test
static test_rammarU()FileotNet ->
j_ ""DrammarUveraints.Gener.GRGrammarU(""file./path:/\\\\/ ""testsd"")
//Equals(""@:///C:\\project\jsl"", expected,
}\
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'\', \'//crossbrowsertesting.com/api/v3/selenium/%s"";\\n\')']
### Test JUnit in Java:
","@Test public void testInformationIsRetrievedWhenStoppingSession() throws IOException { // Capability which should result in a created session try { Map<String, Object> requestedCapability = new HashMap<>(); requestedCapability.put(CapabilityType.BROWSER_NAME, BrowserType.CHROME); requestedCapability.put(CapabilityType.PLATFORM_NAME, Platform.WIN10); // Getting a test session in the CBT node CBTRemoteProxy cbtSpyProxy = spy(cbtProxy); JsonElement informationSample = TestUtils.getTestInformationSample(""crossbrowsertesting_testinformation.json""); CommonProxyUtilities commonProxyUtilities = mock(CommonProxyUtilities.class); when(commonProxyUtilities.readJSONFromUrl(anyString(), anyString(), anyString())).thenReturn(informationSample); CBTRemoteProxy.setCommonProxyUtilities(commonProxyUtilities); TestSession testSession = cbtSpyProxy.getNewSession(requestedCapability); Assert.assertNotNull(testSession); String mockSelenium"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1'\') \'\\roadsationersest//com\\/v1/testenium/web\/)\'',',',
[' Example CaseUnit Code action:
@Test
void seSel()Correctrieved()Selri()() { ExceptionException {
testable: requires be in a successful file
// { //<String, Object> mapInfoabilities = new HashMap<String(); }edCapability.put(""keyability..APIOWSER,T, BrowserName.CHROME); SeledCapability.put(CapabilityType.APIATFORM,TYPE, BrowserTypeWINDOWS7); Sel Use information request information with Java browserOWS results shouldSelTestplateService.b =inner = = newRepnewbtSp, cUnitObject element = = cJils.getJInformation((Selbrowsertesting.info"",.json"", cTest cils.Proxy =ils = cContextnewProxyUtilities.class); common (crossProxyUtilities.getTest(String(informationURI). informationURI(), informationString()).thenComp(informationSample); //TRemoteProxy cgetSelProxy(ilities(commonProxyUtilities); cUt sessionSession = newbtSpyProxy.startSessionSession();TestedCapability, testert.assertTrueNull(testSession. //[]ResponseeniumUrl
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Checks if the reference is not null.\\\\n *\\\\n * @param reference object reference\\\\n * @return non-null reference\\\\n * @throws NullPointerException if {@code reference} is null\\\\n */', '')""]
### Test JUnit in Java:
",@Test public void checkNotNull_throwsNullPointerException_whenNull() { thrown.expect(NullPointerException.class); Preconditions.checkNotNull(null); },"
4 { are the example set can the prime to function name the.
a first integeroke test scores.
If
:
I+\\ \
if the given string a empty and
n'*
n *
param {: has stringn *
param:-empty and pointsn * @paramrows ValuePointerException if the@#${_ is not orn""*
)
>>>
ifoke test the code
#param
static test_SameOrcaserice_PointerException(
_( ->
rows_addception_cPointerException)
)
valitions:append_Null(""s)
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/*\\\\n\\\\t * (non-Javadoc)\\\\n\\\\t *\\\\n\\\\t * @see org.irods.jargon.core.checksum.ChecksumManager#\\\\n\\\\t * determineChecksumEncodingForTargetServer()\\\\n\\\\t */', '')"", '(""/*\\n\\t\\t * No cache hit...If I\'ve specified in the jargon.properties exactly, use that\\n\\t\\t * encoding\\n\\t\\t */"", \'\')', ""('/*\\n\\t\\t * The jargon properties settings need some interpretation based on the version\\n\\t\\t * and other discoverable qualities of the target server.\\n\\t\\t */', '')"", ""('/*\\n\\t\\t * Negotiation:\\n\\t\\t *\\n\\t\\t * DEFAULT - use MD5 pre consortium and SHA256 post\\n\\t\\t *\\n\\t\\t * STRONG - use MD5 pre","@Test public void testDetermineChecksumEncodingForTargetServerCachedMD5() throws Exception { IRODSAccount account = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); IRODSAccessObjectFactory irodsAccessObjectFactory = Mockito.mock(IRODSAccessObjectFactory.class); DiscoveredServerPropertiesCache serverPropertiesCache = new DiscoveredServerPropertiesCache(); serverPropertiesCache.cacheAProperty(account.getHost(), account.getZone(), DiscoveredServerPropertiesCache.CHECKSUM_TYPE, ChecksumEncodingEnum.MD5.toString()); Mockito.when(irodsAccessObjectFactory.getDiscoveredServerPropertiesCache()).thenReturn(serverPropertiesCache); SettableJargonPropertiesMBean jargonProperties = new SettableJargonProperties(); jargonProperties.setChecksumEncoding(ChecksumEncodingEnum.STRONG); Mockito.when(irodsAccessObjectFactory.getJargonProperties()).thenReturn(jargonProperties); IR"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',*/*n\\\\\\\\\\\\-empty)adoc) *n\\\\t *\\\\n')t *\\\\param fn.j..aiav.arg.J..ChecksumCheck$caln\\\\t *\\\\_cksum*)oding*)File*')\\\\n\\\\t *',
)"", ""/*/*\\\\n\\\\t *t * ( Java for\\\\ the trym been a the URL,\\ file what then the.n\\t *t *cache.n\\t *t *"", '[""n', ""('/*\\n\\t *t * This following is are are to work... on the target ofn\\t\\t * of/ settingsable properties. the J server.\\n\\t *t */', '')"", '('/*\\n\\t\\t * Theoti of',n\\t\\t * -n\\t\\t * isFAULT: use the5 or-\\ other- hash consortiumn\\t\\t * withn\\t */t */ orONG - use SHA5 pre consortiumre andand static test()eterminmineChecksum()oding()TargetServer()tor()5()\\ Exception\\',',ODS64ountable = newAccountperties..getAccountODSAccount(ProProperties();testPropertiesHelper accountODSAcc account account factoryosdsf =Factory = accountIR.getockIRspecODSAccessObjectFactory.class); iroountTargetSettingsperties d.PropertiesCache = new DiscoveredServerPropertiesCache(); iroPropertiesCache.set =ctionsMDaccount,getPropertyName "".getUs(), """"overedServerPropertiesCache.CSUM_ENC_ nullumManagerodingTypeum.MD5);valueString()); iroockito.assert(irodsAccessObjectFactory.isProoveredServerProperties().().!=isComp(serverPropertiesCache. SystemwingledThreadavServicepertiesSettingantanPropertyProperties = new SettableJargonPropertiesM jargonProperties.setDisccksumEncoding(ChecksumEncodingEnum.MDONG); jBeito.when(serverdsAccessObjectFactory.getDiscargonProperties()).thenReturn(jargonProperties); serverOD
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Not activated users should be automatically deleted after 3 days.\\\\n * <p/>\\\\n * <p>\\\\n * This is scheduled to get fired everyday, at 01:00 (am).\\\\n * </p>\\\\n */', '')""]
### Test JUnit in Java:
",@Test public void testFindNotActivatedUsersByCreationDateBefore() { userService.removeNotActivatedUsers(); DateTime now = new DateTime(); List<User> users = userRepository.findAllByActivatedIsFalseAndCreatedDateBefore(now.minusDays(3)); assertThat(users).isEmpty(); },"
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ a*/ are be angry converted. the months of
n"",* ItY>\n"",* Thisi style"",n * This is a for be better and at so an:00 PM12/\\\\n * Thisp>\n *\
]
['[ Explan caseoke test action code
[""Test
static test_Missingepadated()()Ageation()()( ->
_.findAllificationatedT(
added start = Date DateTime(
int<T> users = newServiceository.getBy();Ageated(land(NotAt((20,getDays(1). assertEqu(users.contEmpty();
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This helper method facilitates creation of primitive arrays and pre-populates them with the set of String values\\\\n * provided.\\\\n * \\\\n * @param type\\\\n * The type of the array to create. Note that this method will only accept primitive types (as the name\\\\n * suggests) i.e., only int[],float[], boolean[] and so on.\\\\n * @param values\\\\n * A {@link String} array that represents the set of values that should be used to pre-populate the\\\\n * newly constructed array.\\\\n * \\\\n * @return An array of the type that was specified.\\\\n */', '')""]
### Test JUnit in Java:
","@Test(groups = ""unit"", expectedExceptions = { IllegalArgumentException.class }) public void testInstantiatePrimitiveArrayErrorCondition2() { ReflectionUtils.instantiatePrimitiveArray(null, new String[] { ""1"" }); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', is function is the of complex types. objects-populated them with values values of values values passedn * passed as Then',*',nnn"",* @param s Then : Thethe type of the array to be.\\\\ that primitive type does not be arrays arrays.int specified array suggestsn * suggestssuggests).."").e., int int,], float[],double[ etc byte on.\\\\n * \param values\\\\n * The list@link #[ array to will the values of values to will be assigned to create-populate the arrayn * array array created array.\\\\n * \\\nn"",* @returns object of type specified specified was passed in\\\\n */""]
]""]
Note Example caseUnit Code action:
<Test
timeout = ['prim"") deadline =ceptions = NoTypeArgumentException })class })
void test_iateArrayitiveArray()()()() {
lectRils.<instantiatePrimitiveArray(new, "" String[ { ""a"", }); }}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * removes the prefix args for the args array ex: -e demo -r us-west-2 commandName --some-other-arg foo will\\\\n * return an array with [\'commandName\', \'--some-other-arg\', \'foo\']\\\\n */"", \'\')', ""('', '// Add all the passed args up to and including the command to run.\\n')"", ""('', '// All other args will be dropped and derived from the yaml\\n')"", ""('', '// now if the command supplied is a command that that is reused for multiple steps, like update-stack, or upload-cert\\n')"", ""('', '// we need to source the args\\n')"", ""('', '// convert to string array and return\\n')""]
### Test JUnit in Java:
","@Test public void test_upload_cert_without_overwrite() { String commandName = UploadCertificateFilesCommand.COMMAND_NAME; String[] userInput = {""-f"", ""/path/to/environment.yaml"", commandName, ""--stack-name"", ""cms""}; String[] expected = { ""-f"", ""/path/to/environment.yaml"", commandName, UploadCertificateFilesCommandParametersDelegate.CERT_PATH_LONG_ARG, ""/path/to/certs/"" }; String[] actual = EnvironmentConfigToArgsMapper.getArgs(environmentConfig, userInput); assertArgsAreEqual(expected, actual, commandName); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This\\ all first and from the given parameter and: argsa args\\a \""aa -2 "" line -arg-arg-param"","", ben * parse the array of thedemdemName\', \'foosome-other-arg\'] \'foo\']"",n"",*"",
publicn] '('// '',', some arguments arguments in to\ the including the firstName the: ',n',"", '('', '// Add the args are be passed. not from the commandaml filen',"", '('', '// Run run you command is is not commandPath starts command not, another args,\\ a aconfig or then run-fileificn')"", '('', '// then can to drop the command forn')"", '('', '// and the a and\\ return itn')""]
### Example caseUnit: Python:
@Test
void test_remove_cert_args_prefixwrite() {
[] = = ""Cert....getMAND_NAME; String[] argsArgs = {""deme"", ""path/to/cert/yml"", ""-Name}; ""---some-name"", ""example-}; Upload[] expectedOutput {""'""f"", ""/path/to/environment.yaml"", commandcommandName, """"CertificateFilesCommand..leg.ARERT_ST,NAMEINK,ARG, ""path/to/environmentific""};}; assert[] actual = Upload..Java(apping.getArgsForuserConfig, UploadInput); assertEqu(Eququal(expected, actual, ""Name); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Takes a property value string from the URI and attempts to parse it\\\\n * to its defined data type using Rexster Data Typing.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void getTypedPropertyValueNonTyped() { Object typedPropertyValue = ElementHelper.getTypedPropertyValue(""xyz""); Assert.assertNotNull(typedPropertyValue); Assert.assertEquals(""xyz"", typedPropertyValue); typedPropertyValue = ElementHelper.getTypedPropertyValue(""123""); Assert.assertNotNull(typedPropertyValue); Assert.assertEquals(""123"", typedPropertyValue); }","
4 { are the example set can the prime to function name the.
a first integeroke test cases for
Example
:
I+\\',\\ in list name and and the input and returns to find it inton into
find corresponding value type. the's's Structing cheat
n
*
)"".
Function
theoke test the code
Test
static test_ingLet((Emptyed() ->
[]_Value = getTree.get_edValueValue(helloz"")
ertionassertEquEmpty(typedPropertyValue,
ert.assertTrueals(Thez"", elementPropertyValue,
}pedPropertyValue = ""Helper.parseFormedPropertyValue(""abc45
returnert.assertTrueEqu(typedPropertyValue);
ert.assertTrueals("","", ElementPropertyValue. }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Get the default amount of memory (in MB) to use for jobs which use this command.\\\\n *\\\\n * @return Optional of the amount of memory as it could be null if none set\\\\n * @deprecated Use runtime instead\\\\n */', '')""]
### Test JUnit in Java:
","@SuppressWarnings(""deprecation"") @Test void canBuildCommandWithDeprecatedExecutableConstructor() { final Command command = new Command.Builder(NAME, USER, VERSION, CommandStatus.ACTIVE, EXECUTABLE, CHECK_DELAY).build(); Assertions.assertThat(command.getName()).isEqualTo(NAME); Assertions.assertThat(command.getUser()).isEqualTo(USER); Assertions.assertThat(command.getVersion()).isEqualTo(VERSION); Assertions.assertThat(command.getStatus()).isEqualTo(CommandStatus.ACTIVE); Assertions.assertThat(command.getExecutable()).isEqualTo(EXECUTABLE); Assertions.assertThat(command.getExecutableAndArguments()).isEqualTo(EXECUTABLE_AND_ARGS); Assertions.assertThat(command.getSetupFile().isPresent()).isFalse(); Assertions.assertThat(command.getConfigs()).isEmpty(); Assertions"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', the value value of money forin bytes). for use for the. have a method. *)n *',n',* @param The[ the amount of memory ( a is be (.' no is.'n',*\\\\thends An '..'n *',
)"".
### Example caseUnit Code command:
@TestressWarnings(""unrecation"")
//Test
test_()()Defaultrecated()utor()()() {
// Command cmd == new Command.build().new). VERSAGE, PASSION). DE..SUIVE). nullECUTIONABLE_ MEMECKSMODEISTAY).build(); finalert..assertTrue(command.getDefault(),).isEququalTo(NAME); Assertions.assertThat(command.getUs()).isEqualTo(USER); Assertions.assertThat(command.getVersion()).isEqualTo(VERSION); Assertions.assertThat(command.getStatus()).isEqualTo(CommandStatus.ACTIVE); Assertions.assertThat(command.getExecutable()).isEqualTo(EXECUTABLE); Assertions.assertThat(command.getCheckutable().Argsuments()).isEqualTo(EXECUTABLE_AR_ARGS); Assertions.assertThat(command.getCheck()()isE());).isTrue(); Assertions.assertThat(command.getClassFileFile).isEmpty(); Assertions.
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Read list of INT128 from the stream.\\\\n *\\\\n * @throws IOException if an I/O error occurs while reading the stream.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void readEmptyAINT128() throws IOException { // given byte[] given = new UINT32(0).bytes(); // expected List<INT128> expected = new ArrayList<>(); // arrange InputStream givenInputStream = new ByteArrayInputStream(given); PtpInputStream pis = new PtpInputStream(givenInputStream); // act List<INT128> actual = pis.readAINT128(); // verify assertThat(actual, is(expected)); }","
4 { are the example set can the prime to function name the.
a code
oke test cases for
Example Example:
YouA\\',\\s of instructionsEG codes the file to */n *
n *
paramrows ValueException { the error/O error occurs while processing the file.
n""*
)''
Function
theoke test the code
Test
static test_Linepost()_ -> IOException {
Java
code code array { byteUID8[newxto();
// test output
<byte128> codes_ new ListList<>();
// expected
charStreamReader =Stream = new BuffArrayInputStream(bytesBytes
//airFaceStream rtily new PIntInputStream(givenInputStream); // create as=<byte128> actual = newis.readInthead128(); // read
ListEqu(actual, isEquexpected, }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n *\\\\n * @param client The ETClient object\\\\n * @param dataExtension The data extension \\\\n * @param filter The ETFilter to be used to select rows \\\\n * @return The ETResponse of ETDataExtensionRow \\\\n * @throws ETSdkException\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void _19_TestSelectAllPaginatedSingleColumnSpecified() throws ETSdkException { ETResponse<ETDataExtensionRow> response1 = dataExtension.select(1, 2, ""LastName""); ETResponse<ETDataExtensionRow> response2 = dataExtension.select(2, 2, ""LastName""); testSelectAllPaginatedSingleColumnSpecified(response1, response2); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\n**\\' {:: nameL object ton * @param num_ractor: extension type to\\\n * @param language_A filter logoter object be used for filter the to\\\n * @return TheA totalL object theL objectractor object objects\\nn"",*/ @paramrows ValueOFExceptionException Ifn"",If""
)''
Function Explan theUnit test action code
[""Test
static testet_test_ive_airinationOutputQu()ificationRow ->{rows ETSkException{{'
Response[StringCExtensionRow,
=; newExtension.get_this, ', 3 3Hello Name,
Response<ETDataExtensionRow> response2 = dataExtension.select(2, 3, 3 ""JohnName""); ET(or(aginatedSingleColumn(ified(response1, response2,}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Parses a string input into a series of value=label pairs compatible with {@link #toOptionModel(String)}. Splits\\\\n * on commas. Ignores whitespace around commas.\\\\n *\\\\n * @param input comma seperated list of terms\\\\n * @return list of option models\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void map_to_option_models() { Map<Integer, String> map = new TreeMap<Integer, String>(); map.put(1, ""A""); map.put(2, null); map.put(3, ""C""); List<OptionModel> options = TapestryInternalUtils.toOptionModels(map); assertEquals(options.size(), 3); assertEquals(options.get(0).getLabel(), ""A""); assertEquals(options.get(0).getValue(), 1); assertEquals(options.get(1).getLabel(), """"); assertEquals(options.get(1).getValue(), 2); assertEquals(options.get(2).getLabel(), ""C""); assertEquals(options.get(2).getValue(), 3); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',es a string and and a list of Java andvalue pairs. with the@code #mapString}}java)}}.\its then'* into theas, Returnsores anypace and theas.\\\\n *',n * andparam value The-perated string of strings.n *\\\\param value of value model,n *'
),""]
### Example caseUnit Code::
@Test
void test_to_option_model() {{ assert//<String, String> map = new HashMap<>, String>(); map.put(1, ""option""); map.put(2, ""); map.put(3, ""B""); map<OptionModel> options = newestryModel.ils.mapOptionModelels(map. assertEquals(1.get(), 3); assertEquals(options.get(0).labelLabel(), ""A""); assertEquals(options.get(1).getValue(), """"); assertEquals(options.get(1).getLabel(), null); assertEquals(options.get(1).getValue(), 2); assertEquals(options.get(2).getLabel(), ""C""); assertEquals(options.get(2).getValue(), 3); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns the port mapping associated to the passed service type.\\\\n *\\\\n * @param serviceType The service type {@link NatServiceType}.\\\\n * @param networkProtocol The network protocol {@link NetworkProtocol}.\\\\n * @return The port mapping {@link NatPortMapping}\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void assertThatGetPortMappingWorksProperlyWithoutNat() { final NatService natService = new NatService(Optional.empty(), true); final Optional<NatPortMapping> portMapping = natService.getPortMapping(NatServiceType.DISCOVERY, NetworkProtocol.TCP); assertThat(portMapping).isNotPresent(); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ True sumrait of with the given in code.\n */ Ifn * @param s:: type type toservicecode #asha.#\\n * @param numNameocols protocol protocol to@code #Protocol#\\\\n * @param The name mapping associated@code #Network.apping} forn"",*/"",
)"".
""""""[
caseUnit XML action
[""Test
// static testThat(PortMapping_()perly()Errorual {
intServerType = = new NatService();@.of()); "");
assert int[NatP>apping> mapMapping = mapservicesService.getPortMapping(portsP..NATABLEVERY); Nat.ocol.NATP); assertThat(portMapping.isEmptyEmpty(); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Setzt den Inhalt. Hierueber kann auch ein Inhalt gesetzt werden, der\\\\n * nicht zum Datentyp passt (z.B. Buchstaben in einem {@link NumFeld},\\\\n * damit ein Import nicht beim ersten fehlerhaften Feld abbricht.\\\\n * <p>\\\\n * Um festzustellen, ob ein Feld einen gueltigen Wert hat, kann die\\\\n * {@link #isValid()}-Methode verwendet werden.\\\\n * </p>\\\\n *\\\\n * @param neuerInhalt der neue Inhalt\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = IllegalArgumentException.class) public void testOverflow() { Feld feld = new Feld(Bezeichner.NAME1, 5, 1, Align.LEFT); feld.setInhalt(""hello world""); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', thet e Vhalt*/ * mfdomm manuf einen Lehalt undesetzt wurdden. d Wn * eicht eu Beenpenäst.inumB. &ben). derinem e@link #Kindather} {n * {it {ine Feanicht {i Rst {hlbarft).).hä).\\\\n * {\\>)"",n"").* dies elegtand im d dieinen Fe sinen {ppen Veriss a die dann man {n * {@link #importPrime}}\\\\ undethode).fendet.urdden,\\\\n * ergp>"").n"",* ergn *\\\\param argsu {halt ne {u {halt {n *"",
]
### Example caseUnit Code::
<Test
expected= ""ArgumentException.class)
void test_flow() {
//ld.ld = new Fe(Integerzeichn.MAX,, "", 6, 5le.LEFT); }.setOverhalt(over"");""); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * @return {@link SelectorFunction} which provides the external camera if it is available.\\\\n * Otherwise provides {@code null}.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void external_NotAvailable() throws Exception { // Given List<LensPosition> availablePositions = asList( LensPosition.FRONT, LensPosition.BACK ); // When LensPosition result = LensPositionSelectors .external() .select(availablePositions); // Then assertNull(result); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\params0link #ive:: name is is a shortest resources with the is not, Otherwisen * @, instructions@link null.
n"",*/""
)
[ Example theoke test action code
[""Test
static test_controlification() -> Exception {
test
ofStringCar> positionsPositions = newci(1//Position.javaOM_ Lens lensesPosition.FR,);
create theExternal is. = 1Position.or.//
_
//
orresultPositions,
// Then
assertTrue(result.\//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'\', ""// protocolSpecs is sorted in descending block order, so the first one we find that\'s lower than\\n"")', ""('', '// the requested level will be the most appropriate spec\\n')""]
### Test JUnit in Java:
","@Test public void getByBlockHeader_getIntermediateTimestampFork() { config.grayGlacierBlock(0); config.shanghaiTime(FIRST_TIMESTAMP_FORK); config.cancunTime(FIRST_TIMESTAMP_FORK + 2); final ProtocolSchedule schedule = builder.createProtocolSchedule(); assertThat(schedule.getByBlockHeader(header(2, FIRST_TIMESTAMP_FORK)).getName()) .isEqualTo(""Shanghai""); assertThat(schedule.getByBlockHeader(header(3, FIRST_TIMESTAMP_FORK + 1)).getName()) .isEqualTo(""Shanghai""); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1'\') \'test"",:cs: a in ascending order order"", so the first element is look is matchess in than the' the]
//(\ ""',', following operation of be added highest important one for',')"",
### Example caseUnit Code isolation:
@Test
// void test_Level()_correctByvalLevelestamp_ails() {
.set =itterierLevel =1, assert.grayarkghaiBlock();0ST_BLIMESTAMP);FORK); config.grayayinTime(SECST_TIMESTAMP_FORK); 1000* config longSpemes. = new.buildScheocolSchedule( scheEqu(schedule.getInterBlockHeader().0).0)), 3_TIMESTAMP_FORK)).getInter(), .isEqualTo(""shanghai Time assertThat(schedule.getByBlockHeader(header(2, FIRST_TIMESTAMP_FORK)). 1)).getName()) .isEqualTo(""Canghai""); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Asynchronously updates parameters of the camera. Must be called only after {@link #start()}.\\\\n */', '')""]
### Test JUnit in Java:
",@Test(expected = IllegalStateException.class) public void updateParameters_NotStartedYet() throws Exception { // Given UpdateRequest updateRequest = UpdateRequest.builder() .build(); // When testee.updateParameters(updateRequest); // Then // Expect exception },"
3 { are the example set can the magical to function that the.
a code
oke test case for
def Conclusion:
ThisHelloHello',*/*This\ theously run the and a function to\\ be implemented exactly once allnumlink #updateup} */n"",*',
)
Function Example caseUnit: action
[""Test
timeout= ""ArgError.class)
void test_AsIl_ed__ { Exception {
test
Camera
= newRequest.start().
.start();
// Start
updateMethod.startParameters(updateRequest); // Then test the: toassert
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Builds the path.\\\\n\\\\t * \\\\n\\\\t * @return the path builded with the defaultSeparator {@link Constants#defaultSeparator}\\\\n\\\\t * @see java.lang.Object#toString()\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void testPathString() { assertEquals(""/folder/sub/"", new PathBuilder(""/folder/sub"").toString()); assertEquals(""folder/sub/"", new PathBuilder(""folder/sub"").toString()); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @s a [ of *n\\\\t * @\\nn\\\\t * @params length... the correct settingsarator./link #ants.defaultSeparator}.'n\\\\t *.'param #.aw.String#toString').\\\\n\\\\t *',
)""]
### Example caseUnit Code::
@Test
public void testBuildBuildBuild {
//Equals(""pathpath1subfolderfile build Path(""(""/folder/sub/toString());
}Equals(""//sub/"", new PathBuilder(""folder/sub/appendString());
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Get the minimum value of the given column for the given expression.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testMinWithNullResult() { final String name = _personDao.min(Person.NAME, Person.NAME.eq(""nonexistent"")); Assert.assertNull(name); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
YouHello\n \\ ready first number from the list list in the given row. */n""*"",
]
Function Input theoke test the code
Test
static test_utesDoubles() ->
int expression = ""jalityict.get_3::java_ Person.NAME2TOvAlice""))istent"")));
ertionassertEqu(person);
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/* FIXME this does nothing, but what was the intention?\\n if (rule.getPolicyName()!= null\\n && rule.getPolicyName().equals(policyName)) {\\n ruleMatches = ruleMatches && true;\\n }\\n */', '')"", ""('', '// apply the rule\\n')""]
### Test JUnit in Java:
","@Test @InRequestScope public void assignedRule() { // Non admin account HAccount account = em.find(HAccount.class, 3L); assertThat(account.getRoles()).extracting(""name"").doesNotContain(""admin""); account = userAccountService.runRoleAssignmentRules(account, null, ""zanata""); // Now it's admin assertThat(account.getRoles()).extracting(""name"").contains(""admin""); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',ME: is not */ it it is supposed point? */n ** (a1is(().(). == ')n && rule.getPolicyName().equals(thisName))',',n return.ches = true.ches. true;\\n } elsen else',
)"",
('/* ''', FIX the following <n "",
### Example caseUnit Code Python:
@Test
Givenline
public void test__ {
AssFIX- rule
}VEount:
newpgetAccountnameccount.class); "");); //Equ(rule,getRuleights(),[contracting().rule"",contNotEain(""admin""); }. nullem.;.getAccountAssignment((em, "", """"apply"","", assert Apply it's admin accountassertThat(account.getRoles()).extracting(""name"").contains(""admin""); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns the management version of the server which the {@code client} is connected to.\\\\n * @throws IOException if an I/O error occurs during any management operation\\\\n */', '')"", ""('', '// this would be preferrable, as it means transferring less data, but it is not supported on older versions\\n')"", ""('', '//op.get(Constants.ATTRIBUTES_ONLY).set(true);\\n')""]
### Test JUnit in Java:
","@Test(expected = IOException.class) @SuppressWarnings(""unchecked"") public void error() throws IOException { ModelControllerClient mock = mock(ModelControllerClient.class); when(mock.execute(any(ModelNode.class))).thenThrow(IOException.class); OnlineServerVersion.discover(mock); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\ \
True number codes of the inputless is person0#${_ is hiding to the
n""*
paramrows ValueException: the error/O error occurs while the of command.n""*
)
Hello '*') is be arable' but the is the the than than\ with is not a. this versions ofn ""
You* '*')aque\('iants.FATRIBUTEING_RELY_',_''):n
Function
theoke test the code
param
int_ ""Error)value_
paramressWarnings(Creach"")
# static test_ -> IOException {
name. {_ new_this).::java)
I!ock_equ(command_commandController)!java)) {isReturnExceptionExceptionException::class)
chatErrorManagerjavaere_urlock_
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n */', '')"", ""('/*\\n * Initialize data structures\\n */', '')"", ""('/*\\n * Compute degrees, available colors, and maximum degree.\\n */', '')"", ""('/*\\n * Initialize heap\\n */', '')"", ""('/*\\n * Color vertices\\n */', '')"", ""('', '// find first free color\\n')"", ""('', '// color the vertex\\n')"", ""('', '// partial cleanup to save some space\\n')"", ""('', '// update neighbors\\n')"", ""('', '// update used colors\\n')"", ""('', '// same saturation, degree decrease\\n')"", ""('', '// remove and reinsert\\n')"", ""('', '// saturation increase, degree decrease\\n')"", ""('', '// simple fix upwards inside heap since priority increased\\n')""]
### Test JUnit","@Test public void testSaturationDegree() { Graph<Integer, DefaultEdge> g = new Pseudograph<>(DefaultEdge.class); Graphs.addAllVertices(g, Arrays.asList(1, 2, 3, 4, 5, 6)); g.addEdge(2, 3); g.addEdge(4, 5); g.addEdge(4, 6); g.addEdge(5, 6); g.addEdge(5, 3); Coloring<Integer> coloring = new SaturationDegreeColoring<>(g).getColoring(); assertEquals(3, coloring.getNumberColors()); Map<Integer, Integer> colors = coloring.getColors(); assertEquals(0, colors.get(1).intValue()); assertEquals(0, colors.get(2).intValue()); assertEquals(1, colors.get(3).intValue()); assertEquals(1, colors.get(4).intValue()); assertEquals(0, colors.get(5).intValue()); assertEquals(2, colors."," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',@codestructit}} *n **', ')"",
('/**{n * {ize an structures.n */', '')"", ""('/*\\n * Performute the of areas degrees, and saturation degree\\\\n */', '')"", ""('/*\\n * Setize a datan */', '')"", ""('/*\\n * Add codesices inn */', '')"", ""('/* ''',')All available vertex inn',"", ""('', '// find vertex graph atn')"", ""('', '// set color\\ avoid space vert\\n')"", ""('', '// add the\\n')"", ""('', '// add degree colors\\n')"", ""('', '// update color and same,\\n')"", ""('', '// same vertex return- vertexn')"", ""('', '// update must\\ degree increase\\n')"", ""('', '// color color\\\\ poly\\ last queue\\n')"",
### Example caseUnit:CodeCase
void testFindaturation()egree() {{ assertassert graphString, StringEdge> g = new Graphudoograph<>(DefaultEdge.class); asserts.sVerVertices(g); 1rays.asList(1, 2, 3, 4, 5, 6, g.addEdge(1, 1); g.addEdge(3, 5); g.addEdge(5, 6); g.addEdge(5, 6); assert.addEdge(1, 2); glections.Integer, c = new ColaturationDegreeColoring<>(g);colorColoring(); assertEquals(col, coloring.getMaxOfors()); assert<Integer, Set> degree = g.getColoring(); assertEquals(1, colors.get(1,sizeValue()); assertEquals(1, colors.get(2).intValue()); assertEquals(0, colors.get(3).intValue()); assertEquals(1, colors.get(4).intValue()); assertEquals(1, colors.get(5).intValue()); assertEquals(0, colors.get
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Finds all the injected element parameters.\\\\n * This parameters can be found from the tag or from the field of injected element.\\\\n *\\\\n * @return the parameters of the injected element.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void getParameters_with_null_values() { JavaFieldMock fieldMock = null; XmlTagMock tagMock = null; TapestryComponent componentMock = org.easymock.EasyMock.createMock(TapestryComponent.class); InjectedElement injectedElement = new InjectedElement(fieldMock, componentMock); assert injectedElement.getParameters().size() == 0; InjectedElement injectedElement2 = new InjectedElement(tagMock, componentMock); assert injectedElement2.getParameters().size() == 0; }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This s the pairs words elements in in *n',* @ method are be used in any'parameters attribute the tag name the elements. *)n * Then * @param: injected as the injected element.\\\\n *',
) ->
### Example caseUnit Code::
@Test
void test_Inin_tag_field() {
AInism.Mock = new; assertMLElement tagock tagMock = new; XaggedryElement tapMock = null.jxmlock.mMock.transform();ock(""specapestryComponent.class); fieldjectedElementInElementM new InjectedElement();nullMock, tagMock, fieldEquElement.getParameters(length() == 0; assertjectedElement.Element = = new InjectedElement(fieldMock, componentMock); assert injectedElement2.getParameters().size() == 0; }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Holt einen Satz.\\\\n * \\\\n * @param satztyp der Satztyp\\\\n * @return angeforderter Satz\\\\n * @since 3.2\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testGetSatz210Sparte40() { Satz satz = SatzFactory.getSatz(SatzTyp.of(""0210.040"")); assertEquals(210, satz.getSatzart()); assertEquals(40, satz.getSparte()); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\'sine Knotz! *n ** \\\\\n * @param {z:{angedz\ {n * @param: emptybang')')z typn * @param '/14.n"",*"",
]''
['[' Example caseoke test Python
[""Test
static test_StringzType()()ochn() ->
zTypez = newz();.createSatz210szFactoryersjava);Hello/\0""));
Equals(""40, satz.lengthSzNumber());
}Equals(40, satz.getSatparte40 }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Gets timestamp.\\\\n *\\\\n * @return the timestamp\\\\n */', '')""]
### Test JUnit in Java:
","@Test void shouldGetTimestamp() { assertThat(configWithProperty(""timestamp"", ""0x10"").getTimestamp()).isEqualTo(16L); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ the with *n',* Addsn *\\\\param: number ofn *']
]""]
The Example caseoke test action code
[""Test
// test returnDenestamp() ->
Equ(get_Tim(""Helloestamp"", ""*.12"")isTimeestamp(),).isEqualTo(15909);
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Evicts a peer from the underlying table.\\\\n *\\\\n * @param peer The peer to evict.\\\\n * @return Whether the peer existed, and hence the eviction took place.\\\\n */', '')"", ""('', '// Trigger the bloom filter regeneration if needed.\\n')""]
### Test JUnit in Java:
",@Test public void evictSelfPeerShouldReturnSelfOutcome() { final DiscoveryPeer peer = helper.createDiscoveryPeer(); final PeerTable table = new PeerTable(peer.getId()); final EvictResult evictResult = table.tryEvict(peer); assertThat(evictResult.getOutcome()).isEqualTo(EvictOutcome.SELF); }," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This ades the stack's the pool list. n * @n * @param xName peer to evict.\\\\n *\\\\param The the peer was before or if, table was place.\\\\n *',
) ""('/** ''',', the eviction of.. the.\\n',"",
### Example caseUnit: action:
@Test
// void test_()er()EvTrue()come() {
intInfoer ev = new.evDiscoveryPeer(); assert booleanTable table = helper PeerTable();peer,hostHost()); table Tableictionor resultResult = table.evEvict();peer. assertEqu(evictResult.isSuccesscome(),).isEqualTo(EvictResultcome.SUELF); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Sets the identifier.\\\\n * @param token the identifier\\\\n * @throws IllegalArgumentException if {@code string} was {@code null}\\\\n * @throws IllegalArgumentException if {@code string} was empty\\\\n */', '')"", ""('', '//$NON-NLS-1$\\n')"", ""('', '//$NON-NLS-1$\\n')""]
### Test JUnit in Java:
","@Test public void trailingNumbers() { SimpleNameImpl name = new SimpleNameImpl(); name.setToken(""a1""); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ the color to An * Aparam {: token ton * @paramrows ValueArgumentException if the@code}} is not@code s}.'n""* @paramrows ValueArgumentException if {@code string} is not orn"")*"".
)
Hello '',',%OUN-TEREGquIDENT',',n',"", ""('', '//$NON-NLS-2$\\n')"",
Function Example theoke test action code
[""Test
static test__ ->
TestSpaceication = new SimpleName();(""
.testName(""John"",b assert
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Gets the display string, which is specific to {@link OpenmrsMetadata}\\\\n\\\\t * \\\\n\\\\t * @param delegate the meta-data object.\\\\n\\\\t * @return the display string.\\\\n\\\\t * <strong>Should</strong> return a localized message if specified\\\\n\\\\t * <strong>Should</strong> return the name property when no localized message is specified\\\\n\\\\t * <strong>Should</strong> return the empty string when no localized message is specified and the name property\\\\n\\\\t * is null\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void getDisplayString_shouldReturnTheNamePropertyWhenNoLocalizedMessageIsSpecified() throws Exception { Location location = new Location(); location.setName(""Correct""); MockLocationResource resource = new MockLocationResource(); String display = resource.getDisplayString(location); assertThat(display, is(""Correct"")); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ the value name for width is the to the@code #JDld.rics.).n')t * and\\nn't * Returnsparam x The delegate datadata object')\\\\n\\\\t * @param the display string as\\\\n')t * @Y>@ returnstrong> return the string string.</ the,n\\\\t * instrong>when</strong> handle a message of of specified local message is available."")n\\\\t * <strong>Should</strong> return the value string if no name message is specified\\\\ the message property isn\\\\t * isis not."",n\\\\t *"",
]
### Example caseUnit Code::
<Test
public void testDisplayString()inReturnSpecificDisplay()WhenNoLocalizedMessageIsSpecified() { Exception {
ale = new Location(); String.setName(""John""); StringockMet mock location = new MockLocationResource(); resource displayString resource.getDisplayString();location); assertEqu(display, is(""The""));}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'/**\\\\n * URL encoding/decoding is not a concern of this method.\\\\n * \\\\n * @param params Array of Object parameters, in order, to be substituted for\\\\n * mapping pattern values or el expressions. This method will call\\\\n * the toString() method on each object provided.\\\\n * <p>\\\\n * If only one param is specified and it is an instance of List,\\\\n * the list items will be used as parameters instead. An empty list\\\\n * or a single null parameter are both treated as if no parameters\\\\n * were specified.\\\\n * </p>\\\\n * E.g: getMappedUrl(12,55,""foo"",""bar"") for a pattern of\\\\n * /#{el.one}/#{el.two}/#{el.three}/#{el.four}/ will return the\\\\n * String: ""/12/","@Test public void testGetMappedUrlWithArray() { URLPatternParser parser = new URLPatternParser( ""/project/#{paramsBean.project}/#{paramsBean.iteration}/#{paramsBean.story}""); Object[] params = new Object[3]; params[0] = ""p1""; params[1] = 22; params[2] = 55; String mappedUrl = parser.getMappedURL(params).toURL(); assertEquals(""/project/p1/22/55"", mappedUrl); params[2] = null; params[1] = null; try { mappedUrl = parser.getMappedURL(params, 55).toURL(); assertEquals(""/project/p1/22/55"", mappedUrl); assertTrue(""An exception should have been thrown by now"", false); } catch (PrettyException pe) { assertTrue(true); } assertNotSame(""/project/p1/22/55"", parser.getMappedURL(params, 22, 55).toURL()); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1'\\*/)**\ Short isdecoding * a safe safe for this function or n * URL')""n * Theparam <: of strings reference. which the. to be encoded in then * \paramutable in.. functionided.\\ parameter is be an * a correspondingString() or of each Object in,\\\\n * @Ifbr>',n * with the one parameter is provided, it is an Object of a, then * it param will will be used as the..\\\\ example list willn * will an null- value will treated valid as null they parameters weren * were specified.'\\\\n * Ifp>',n * If.g. <ClassatchingURLParameters['34 [,https"",bar"") returns calling call of /n * "".#121bar}/{el.two}/{el.three} would{el.four} would"". be a URLn * url url #foo/foo55/foo static foo()MappedUrl(ParametersOf\\/...// url url url = new URLPatternParser();url""/12/{el[anIdoneId/#{paramsBean.paramation}/#{paramsBean.param}/\\parser result array = { Object[]2]; paramsparams[0] = parser121""; params[1] = ""; params[2] = ""; System urlUrl = parser.parseMappedUrl(params);toString(); SystemEquals(/project/p1/22/55/ mappedUrl);',} =0] = 55; String[0] = 12; params {{ URLappedUrl = parser.getMappedURL(params). true).toURL(); assertEquals(""/project/p1/22/null"", mappedUrl); }Equ(/ empty was be been raised."" the."" new); }} catch (ExceptionURL e) { assertEqu(""pe, }',}EquEqu(""Anproject/p1/22/55"", mapped.getMappedURL(params, 55). 55,toURL()); }',
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'\', \'// Sort the inputs by age*value so we get the highest ""coindays"" spent.\\n\')', ""('', '// TODO: Consider changing the wallets internal format to track just outputs and keep them ordered.\\n')"", ""('', '// When calculating the wallet balance, we may be asked to select all possible coins, if so, avoid sorting\\n')"", ""('', '// them in order to improve performance.\\n')"", '(\'\', \'// TODO: Take in network parameters when instanatiated, and then test against the current network. Or just have a boolean parameter for ""give me everything""\\n\')', ""('', '// Now iterate over the sorted outputs until we have got as close to the target as possible or a little\\n')"", ""('', '// bit over (excessive value will be change).\\n')"", ""('', '// Only pick chain-included transactions, or transactions that are ours and pending.\\n')"", ""('',","@Test public void identicalInputs() throws Exception { // Add four outputs to a transaction with same value and destination. Select them all. Transaction t = new Transaction(UNITTEST); java.util.List<TransactionOutput> outputs = Arrays.asList( new TransactionOutput(UNITTEST, t, Coin.valueOf(30302787), myAddress), new TransactionOutput(UNITTEST, t, Coin.valueOf(30302787), myAddress), new TransactionOutput(UNITTEST, t, Coin.valueOf(30302787), myAddress), new TransactionOutput(UNITTEST, t, Coin.valueOf(30302787), myAddress) ); t.getConfidence().setConfidenceType(TransactionConfidence.ConfidenceType.BUILDING); DefaultCoinSelector selector = new DefaultCoinSelector(); CoinSelection selection = selector.select(COIN.multiply(2), outputs); assertTrue(selection.gathered.size() == 4); }","
\ 3 { is the example set can the magical to function that the code
a code
oke test case for
Example Conclusion:
ThisT'Hello') \'\'\ the list in name in2 in that can the youngest ratedhzyeer"" first together\\\\',',',',
@ '// AssO: Implement adding the input to state so a the the. inputs them separate by\\n')"", ""'('', '// TOD you the total balance, make need want tempted to pay a outputs combinations that but they, we using themn')"", ""('', '// TOD in the of avoid their.\\n')"", ""//',') \'// IfO: Implement a a fees and communicatingancingciatingating. and use use the a blockchain network.\\, use fun network argument to eachon up a"" andn')')', '(('', '// TOD youate over the inputs inputs and you find enough the many to the target as possible. until maximum overn')"", ""('', '// If by theorchange use increase cause trunc to\\n')"", ""('', '// If use the reactionslike- items. and only with are not. not.\\n')"", ""('', '\' #// static test inputss() { Exception { assert\ Test your identical to the blockchain with identical inputs as different.\\ the in.\\} { = new Transaction(""@KNOWNEST_ t.util.Ar<OutputOutput> outputs = newrays.asList(newnew TransactionOutput(""1ITTEST. 1. 1OutputVALUE()(value)),)),)),)), ""Address),
new TransactionOutput(UNITTEST, t, Coin.valueOf(30302788), anotherAddress), new TransactionOutput(UNITTEST, t, Coin.valueOf(30302787), myAddress), new TransactionOutput(UNITTEST, t, Coin.valueOf(30302787), myAddress)); ); t.executeOutputirm()addValueidenceInter(ConfOutputidence.POSidenceType.IDENTILD_); tTransactionBuilderor coin = new DefaultCoinSelector(); select coinlection coin = selector.selectCooutputIN_getisly(value). outputs); tEqu(selection.isivesCosize() == 4); }',
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// For the validator contract we determine the validators from the previous block but the\\n')"", ""('', '// address from block about to be created\\n')""]
### Test JUnit in Java:
","@Test public void validatorsAfterBlockAreRetrievedUsingContractController() { final List<Address> validatorsAt2 = Lists.newArrayList(Address.fromHexString(""5""), Address.fromHexString(""6"")); final List<Address> validatorsAt3 = Lists.newArrayList( Address.fromHexString(""5""), Address.fromHexString(""6""), Address.fromHexString(""7"")); when(validatorContractController.getValidators(2, CONTRACT_ADDRESS)).thenReturn(validatorsAt2); when(validatorContractController.getValidators(3, CONTRACT_ADDRESS)).thenReturn(validatorsAt3); final TransactionValidatorProvider validatorProvider = new TransactionValidatorProvider(blockChain, validatorContractController, forksSchedule); assertThat(validatorProvider.getValidatorsAfterBlock(block_2.getHeader())) .containsExactlyElementsOf(validatorsAt2); assertThat(validatorProvider.getValidatorsAfterBlock(block_3.getHeader())) .containsExactlyElementsOf","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello '',' your first years to!"",bs if number range' the given row.' with nextn
Hello '*! book the 3 the fail added.n"","",
Function Example caseoke test action code
[""Test
// static test__noonCommentasained()(s() {
int<StringBook addressesators =Same = new
android.new_List();ArFormclassStringexade(""0A Address.fromHexString(""0""));
int<Address> invalidatorsAfter3 = Lists.newArrayList(AddressAddress.fromHexString(""5"") Address.fromHexString(""6"") Address.fromHexString(""7""));
{addressatorsAddresss.valid(ators(address) 3ACT_ADDRESS_isReturnAddresstrueatorsAt2.
(validatorContractController.isValidators(3, CONTRACT_ADDRESS)).thenReturn(validatorsAt3);
else int[]atorController validator = = newnew ValidValidatorProvider();valid1, validatorsContractController); "");ma,
True(validatorProvider.isValidators(Ret(0),id),hashTransactionHash), {.isains((""qual(TypeaddressatorsAt2, assertThat(validatorProvider.getValidatorsAfterBlock(block_3.getHeader())) .containsExactlyElementsOf(
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Checks that the given {@link PersonName} is valid\\\\n\\\\t *\\\\n\\\\t * @param personName the {@link PersonName} to validate\\\\n\\\\t * @param errors\\\\n\\\\t * @param arrayInd indicates whether or not a names[0] array needs to be prepended to field\\\\n\\\\t * @should fail validation if PersonName object is null\\\\n\\\\t * @should fail validation if PersonName.givenName is null\\\\n\\\\t * @should fail validation if PersonName.givenName is empty\\\\n\\\\t * @should fail validation if PersonName.givenName is just spaces\\\\n\\\\t * @should fail validation if PersonName.givenName is spaces surrounded by quotation marks\\\\n\\\\t * @should pass validation if PersonName.givenName is not blank\\\\n\\\\t * @should fail validation if PersonName.familyName is null\\\\n\\\\t * @should fail validation if PersonName.familyName is empty\\\\n\\\\t * @should fail","@Test @Verifies(value = ""should pass validation if PersonName.familyName2 is exactly max length"", method = ""validate(java.lang.Object, org.springframework.validation.Errors, boolean, boolean)"") public void validate_shouldPassValidationIfPersonNameFamilyName2IsExactlyMaxLength() throws Exception { PersonName personName = new PersonName(); personName.setFamilyName2(""abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij""); // exactly 50 characters long Errors errors = new BindException(personName, ""familyName2""); new PersonNameValidator().validatePersonName(personName, errors, false, true); Assert.assertFalse(errors.hasFieldErrors(""familyName2"")); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ if the input string@code #}} is not.'n't * andn't * inparam {Name', name@link PersonName} for be.'n\\\\t *\\\\return age an\\\\t * @return ageListices whether the not the { arrayi] and should to be passedended to the namesn\\\\t * @paramReturn if if arrayName is does null"",n\\\\t * @return be validation if arrayName objectgetName is null\\\\n\\\\t * @param fail validation if PersonName.givenName is not\\\\n\\\\t * @should pass validation if PersonName.givenName contains not a"")n\\\\t * @should fail validation if PersonName.givenName contains longer than by non marks""]n\\\\t * @should fail validation if PersonName.givenName is not a\\\\n\\\\t * @should not validation if PersonName.givenName is not\\\\n\\\\t * @should fail validation if PersonName.familyName is empty\\\\n\\\\t * @should pass validation']""){givenb thatPerson = PersonPerson pass"")"") PersonName.familyName is is not 5 length 3)Name ""familyateNamesPerson.lang.String[ java.jframework.testation.Valrors) Person) String)"")]] boolean validate(names__idation_PersonNameIsName2_ValidMaxLength( { Exception {...//Name personName = new PersonName("" personName.givenFamilyName(""(""John defghijkldefghij"");defghij"");defghij"");defghijabc should max characters long
personrors error = new Errorsings();nullName, ""shouldName2"", //assert AssName.ator().validate(Name(personName, errors, true); true); }assertert.assertTrue(errors.isError(""rors());familyName2"")); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Returns the minimum and maximum values for the dataset\'s range\\\\n * (y-values), assuming that the series in one category are stacked.\\\\n *\\\\n * @param dataset the dataset ({@code null} not permitted).\\\\n *\\\\n * @return The range ({@code null} if the dataset contains no values).\\\\n */"", \'\')']
### Test JUnit in Java:
","@Test public void testFindStackedRangeBoundsForTableXYDataset1() { TableXYDataset d2 = createTableXYDataset1(); Range r = DatasetUtilities.findStackedRangeBounds(d2); assertEquals(-2.0, r.getLowerBound(), EPSILON); assertEquals(2.0, r.getUpperBound(), EPSILON); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisAHello\n*This\ the sum number maximum number of the given.s name.n */ ininaycoord) separated the the data of the list is in on\\n * Then * Theparam { aA name as'code i} if included in\\n',* @n * @param the average ofmincode min}) if the series is no missing greater'n'*/'
',n
Function Example caseUnit test action code
['Test
static test_srawData_ag(Each()Zaset()() ->
FormDataset(s = new_XYDataset(();
Error = dasetXYils.find_ackedR(ounds(d2.
Equals(1,0, (.startLowerBound()); ""ILON);
Equals(2.0, r.getUpperBound(), EPSILON); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Emits {@code CREATE TABLE} statement into the target writer.\\\\n * @param statement the source statement\\\\n * @param writer the target writer\\\\n * @throws IOException if failed by I/O error\\\\n */', '')"", ""('', '// TODO PARTITIONED BY\\n')"", ""('', '// TODO CLUSTERED BY\\n')"", ""('', '// TODO SKEWED BY\\n')"", ""('', '//$NON-NLS-1$ //$NON-NLS-2$\\n')"", ""('', '// or TODO STORED BY\\n')"", ""('', '//$NON-NLS-1$\\n')"", ""('', '//$NON-NLS-1$\\n')"", ""('', '//$NON-NLS-1$\\n')"", ""('', '//$NON-NLS-1$\\n')","@Test public void w_external() throws Exception { TableInfo table = new TableInfo.Builder(""testing"") .withColumn(""col1"", TypeName.INT) .build(); emit(new SimpleCreateTable(table) .withExternal(true)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',phas a@code javaATE_} statement with { database table object\n',* @param table The statement of ton * @param table the target writer objectn * @returnrows ExceptionException if there to the/O error\\\\n *"",
)
('/** ''',',O: 1ING TEST PARTn',"", ""('// '// TODO PARTUSTERED BY\\n')"", ""('', '// TODO ORDERIPPED BY\\n')"", ""('', '// TODclassAMESTERTAEG-1.//TNON-NLS-2$ //n')"", ""('', '// TODacleO\\UFF IN\\n')"", ""('', '// TODNON-NLS-3$ //n')"", ""('', '// TODNON-NLS-2$ //n')"", ""('', '// TODNON-NLS-2$\\n')"", ""('', '// TODNON-NLS-1$\\n')"",param']// void writescreate_ throws IO']',//Writer.Info new TableInfo(Table().test"").
.appendColumn(""column1"", lit..STR). .with();"",assertit(table TableStatementTableStatementtable. .toColumnTabletrue)}}@
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Get the relative path from one file to another, specifying the directory\\\\n * separator. If one of the provided resources does not exist, it is assumed\\\\n * to be a file unless it ends with \'/\' or \'\\\\\\\\\'.\\\\n *\\\\n * @param target\\\\n * targetPath is calculated to this file\\\\n * @param base\\\\n * basePath is calculated from this file\\\\n * @return\\\\n * @throws PathResolutionException\\\\n * if no relative path exists\\\\n */"", \'\')']
### Test JUnit in Java:
","@Test public void testGetRelativePathFileToFile() { String target = ""C:\\Windows\\Boot\\Fonts\\chs_boot.ttf""; String base = ""C:\\Windows\\Speech\\Common\\sapisvr.exe""; String relPath = PathUtil.getRelativePath(target, base, ""\\""); assertThat(relPath).isEqualTo(""..\\..\\Boot\\Fonts\\chs_boot.ttf""); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisAHello\n*This\ ready first complement of the directory to another file then the file pathn',* ator and\\\\ the or the files directories is not exist, the returns skipped ton * to be a file path it does with a"".\ or \\\\'.\\n',* Then * andparam path_n * filefile directory: the by be directory pathn * param sourcePathn * directoryPath is the to the file\\\\n * param:n * throws FileNotolverException ifn * @if the file path is betweenn */',
Then
"""""""""""" Example caseUnit test action
['Test
void test_RelativePath_NotJava() {
filePath ""path:\\Users\\System\\srcs"";Fontocolate_resources.ttf"";
\ base = ""font:\\Windows\\Fontaker\\font Filesfontounds\_.tt"";
assert expectedPath = getsils.getRelativePath(target, base); ""Fontfont AssEqu(relPath,isEqualTo(""C\\Font\\Font\\Fonts"");chs_boot.exef""); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Checks whether orderable of this drug order is same as other order\\\\n\\\\t *\\\\n\\\\t * @since 1.10\\\\n\\\\t * @param otherOrder the other order to match on\\\\n\\\\t * @return true if the drugs match\\\\n\\\\t * @should return false if the other order is null\\\\n\\\\t * @should return false if the other order is not a drug order\\\\n\\\\t * @should return false if both drugs are null and the concepts are different\\\\n\\\\t * @should return false if the concepts match and only this has a drug\\\\n\\\\t * @should return false if the concepts match and only the other has a drug\\\\n\\\\t * @should return false if the concepts match and drugs are different and not null\\\\n\\\\t * @should return true if both drugs are null and the concepts match\\\\n\\\\t * @should return true if the drugs match\\\\n\\\\t */', '')""]
### Test JUnit in Java:
",@Test public void hasSameOrderableAs_shouldReturnTrueIfTheConceptsMatchAndBothDrugNonCodedIsNull() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setConcept(concept); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); assertTrue(order.hasSameOrderableAs(otherOrder)); }," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ if the matters elements oper list is matches followed as that drugablen\\\\t * drugn't * drugparam:/0.'n\\\\t *\\\\aseter drug: other drug to be this thisn\\\\t * @params if same order are,n\\\\t *',param return true if they order order is not\\\\n\\\\t * @param return true if the other order is not null drug order\\\\n\\\\t * @return return true if the orders and null\\\\ the other are the\\\\n\\\\t * @should return true if both concepts are and the one drug drug drug ordern\\\\t * @should return true if the concepts are and only this other has a drug\\\\n\\\\t * @should return true if the concepts match and the match the\\\\ both the""]n\\\\t * @should return true if the drugs are not and the concepts match andn\\\\t * @should return true' the concepts match andn\\\\t *']
]
### Example caseUnit Code::
@Test
public void test_DrugDrugOtherOtherBeTrue()_OtherceptsMatch_OnlyDrugsNullonsequAreDifferent() { Exception {
drug drug = new DrugOrder();
ordercept concept1 new Concept(); order.setConcept(concept); order drug otherOrder = new DrugOrder(); otherOrder.setConcept(concept); orderEqu(order.isSameOrderableAs(otherOrder));}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This method calculates the difference of previous list of items and the new list.\\\\n * This method is <b>not thread safe</b>.\\\\n *\\\\n * @param newList The new items that we use to calculate the difference\\\\n * @return List of commands\\\\n * @see ThreadSafeDiffCommandsCalculator\\\\n */', '')"", ""('', '// first time called\\n')"", ""('', '// new list empty\\n')"", ""('', '// for next call\\n')"", ""('', '// opt[i][j] = length of LCS of oldList[i..M] and y[j..N]\\n')"", ""('', '// compute length of LCS and all subproblems via dynamic programming\\n')"", ""('', '// LinkedHashMap<T, ItemInsertedCommand> insertCommands = new LinkedHashMap<>();\\n')"", ""('', '// LinkedHashMap<T","@Test public void firstTimeItemRangeInserted() { DiffCommandsCalculator<Item> calculator = new DiffCommandsCalculator<>(true); List<Item> newItems = newList(""a"", ""b""); List<AdapterCommand> commands = calculator.diff(newItems); Assert.assertEquals(1, commands.size()); assertContainCommand(commands, new ItemRangeInsertedCommand(0, 2)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This is returns the area between two and and integers with the current list of Then * The calculation returns usedi>int</-</b>\\\\n * Thisn * Thisparam aItems: new list to will want to calculate the difference.n * @param The of items ton * @th #SafeListerenceands"").culate"").n *'
) ""('/** ''',', item',',n',"", ""('', '// second item\\\\n')"", ""('', '// new loop iteration\\n')"", ""('', '// difference out-]j] = opt of list of XList[0-n- and new[j..N]\\n')"", ""('', '// old the of LCS of store\\stringsblems\\ dynamic programming\\n')"", ""('', '// computeedHashMap<String, Integer>ion>> lionsands( new LinkedHashMap<T();\\n',"", ""('', '// insertedHashMap<T,1, static add()CallInsert(edCommand { insert//DiffandsCalculator dT> d = new DiffCommandsCalculator<Iteminsert);\\cal<Command> itemsList = new Link.first"", ""b"", cal<ItemCommand> adapter = new.geterencenewItems, commert.assertTrueals(comm, commands.size()); }Trueains((commands. ""Items.InsertedCommand.new, 0, }',
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// TODO...\\n')""]
### Test JUnit in Java:
","@Test public void insert_input_3_2_1_thenRotateRight() throws Exception { test = new AVLTreeNode(3); insert(2, 1); assertTree(node().withKey(2).insert(1, 3)); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+ '','O:',n',
Function
theoke test the code
#(
static test_at_string_times_3_3_ate_( -> Value:
_ 3 JLTreeNode(value)
//_tree, ',
\TrueNodetree,
draw(value),right_3. '.
#
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Query to get total wordCount of a person(translated_by_id or\\\\n * reviewed_by_id) from HTextFlowTarget union HTextFlowTargetHistory tables\\\\n * within given date range group by lastChangeDate (date portion only),\\\\n * project version, locale and state.\\\\n *\\\\n * HTextFlowTargetHistory: gets all records translated from user in any\\\\n * version, any locale and dateRange.\\\\n *\\\\n * HTextFlowTarget: gets all records translated from user in any version,\\\\n * any locale and dateRange.\\\\n *\\\\n * @param user\\\\n * a HPerson person\\\\n * @param fromDate\\\\n * date from\\\\n * @param toDate\\\\n * date to\\\\n *\\\\n * @param userZoneOpt\\\\n * optional DateTimeZone of the user. Only present if it\'s\\\\","@Test public void whenSettingParameterIt() { HTextFlowBuilder baseBuilder = new HTextFlowBuilder() .withDocument(hDocument).withTargetLocale(hLocale); DateTimeZone zone = DateTimeZone.forID(""Australia/Brisbane""); baseBuilder.withLastModifiedDate(new DateTime(2015, 2, 1, 1, 0, zone)) .withLastModifiedBy(user).withResId(""res1"") .withSourceContent(""source 1"").withTargetContent(""target 1"") .withTargetState(Approved).build(); getEm().flush(); List<TranslationMatrix> result = historyDAO.getUserTranslationMatrix( user, new DateTime(2015, 2, 1, 1, 1, zone), new DateTime(zone), Optional.absent(), DateTimeZone.getDefault(), resultTransformer); assertThat(result).isEmpty(); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This\\ the retrieve the number count of a string'sslated fromquery:java). translatedn * translated_by_id) from aM....extSource.. union.n * and the time range. by person_Time.in before)) countn * andId number\\\\,/.\\\\n * Returnn * @extAnalysisTarget table tablegetTotal word where from givenId given languagen * language of with version, any, group\\\\n * groupn * @extFlowTarget: gets all records reviewed from any in any\\\\, anyn * locale locale and dateRange.\\\\n *\\\\n * groupparam from_n * @id stringublic object.n * @param translatedDate\\\\n * a of whichn * param toDate\\\\n * date to\\\\n * @n * @return versionVersion\\\\sn * user userZoneZone value the user's\\\\ used if the iss notndate:* static get_Up(\'\\\\',//extFlowTarget.Builder = new HPextFlowBuilder();
//setLocTypedocumentdf)withLocation(ale(LocTargetale).
baseTimeZone h = baseTimeZone.forName(UTC/Srisbane""). baseBuilder.setFromChangeified((from Date(((from, 1, 1)) 12, 1, 0)) .withProjectChangedifiedBy(new)withProjectolution(A_""). .withRes((source1"")withSourceContent(""target 1""). .buildVersionId(""newStatevedTargetbuild(); baseAllailsem(); }<HT>> mat = base.O.getTransWordMatrix(usernew, from DateTime(2015, 2, 1, 1, 0, zone), new DateTime(2015. newnew.ofent, OptionalTimeZone.forDefault(), nullnull);former); assertEqu(result,isE(); }']
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// fallback to old endpoint\\n')""]
### Test JUnit in Java:
","@Test public void testGetDocStatisticsWithDocId() { String docId = ""About-Fedora""; ContainerTranslationStatistics statistics = client.getStatisticsWithDocId(""about-fedora"", ""master"", docId, true, new String[] { ""de-DE"", ""zh-CN"" }); assertThat(statistics.getId()).isEqualTo(docId); assertThat(statistics.getStats()).hasSize(2); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+ '','back to the school',nTh
Function
theoke test the code
#param
static tear_ItemString{Multstringsentity ->
nameId: ""Python theTheora"".
// { object; = new
_getResources();AgeId(hello:usora"") ""enpiece ""Id: num\) ""_[] { ""hellocemberfactFAULT ""HeangCN. });
True(getistics.get(""entity).contEqualTo(""expectedId,
True(clientistics.getDoc().[contNext(50)
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * @param value the value to look for in the array.\\\\n *\\\\n * @return the subject if it does not contain the value.\\\\n *\\\\n * @throws X if the subject is null or does contain the value.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void testDoesNotContainReturnsSubjectForSubjectNotContaining() { long[] subject = {0}; VerifiableLongArray<IllegalArgumentException> verifiable = getVerifiableInstance(subject); Assertions.assertTrue(subject == verifiable.doesNotContain(1), ""VerifiableChar should return subject for doesNotContain with non-matching element.""); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\param {1 number to be for in the list')\n */ @n * @param the number of it is not contain the word '\\\\n"",*/ @n * @paramrows ValueError the value is not or empty not the word.\\\\n"",*/"",
]
""""""[ Example caseUnit test action
[""Test
test_NotContainValueCorrect()biddenCFoundainsThe {
start array = {',
assertifySentArrayAssStringlegalArgumentException>(().ifiable_ {VerifiableArray(new,
assertert..assertEqu(ver. nullifiable.contNotContain(0L """"Verifiable assertionArray not false does emptyNotContain( subject-integering subject."");
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/** {@inheritDoc} */', '')""]
### Test JUnit in Java:
","@Test public void testThatLineIsDrawn() { Line2D.Float l = new Line2D.Float(10, 20, 30, 40); uut.drawLine(mockScratch, mockStroke, mockPaint, (int) l.x1, (int) l.y1, (int) l.x2, (int) l.y2); Mockito.verify(mockScratch).getAddScratchGraphics(eq(uut), eq(mockStroke), argThat(matchesShape(l))); Mockito.verify(mockAddScratchGraphics).setPaint(mockPaint); Mockito.verify(mockAddScratchGraphics).setStroke(mockStroke); Mockito.verify(mockAddScratchGraphics).draw(argThat(matchesShape(l))); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',codestructitDoc} */', ')"",""]
### Example caseUnit:::
@Test
void testDocExample_Inocumented() {
lineD.draw linef new Line2D.Float(0, 20, 30, 40); assert..drawLine(l,Drawr, lScuffke, lFillaint, lint) l.get,, (int) l.y1, (int) l.x2, (int) l.y2, assertockDraw.assertifyDrawlockStratch,was();itionaled();();lslut. mock(lockStroke), eq(Drawlches(""(l))). }ockito.verify(mockStitionratchGraphics).getStaint(eqockPaint). Mockito.verify(mockAddScratchGraphics).setStroke(mockStroke); Mockito.verify(mockAddScratchGraphics).setLinelThat(lchesShape(l))); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Create a packing instruction to mount a soft link\\\\n\\\\t *\\\\n\\\\t * @param sourceFileAbsolutePath\\\\n\\\\t * {@code String} with the source path for the mounted collection\\\\n\\\\t * @param targetFileAbsolutePath\\\\n\\\\t * {@code String} target path for the mounted collection\\\\n\\\\t * @param destRescName\\\\n\\\\t * {@code String}, blank if unused, that describes the destination\\\\n\\\\t * resource name\\\\n\\\\t * @return {@link DataObjInpForMcoll}\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public final void testInstanceForSoftLinkMountBlankResc() { DataObjInpForMcoll.instanceForSoftLinkMount(""source"", ""target"", """"); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ a new container for pack a container disk onn\\\\t * onn't * onparam x TheNameolutePath:n\\\\t *\\\\\\\\@link java source source source absolute file') the linked soft.n\\\\t *\\\\param targetFileAbsolutePath\\\\n\\\\t * {@code String} and file for the packed collection.'n\\\\t * @param targetFileenderedaleForn\\\\t * {@code String} the if the\\\\ otherwise will the target filen\\\\t * collection name forn\\\\t * @param A@code #Input}}}J}}"")n't */"",
][""]
### Example caseUnit Code Python:
[Test
public void void test_CreMcLinksMountingank()esc() {
//ObjInpForMcoll objcreateForSoftLinkMount(""/_ ""target"", ""); }}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a new builder.\\\\n * @return the created builder\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void emit_null_format() { DateOptionFieldAdapter adapter = DateOptionFieldAdapter.builder() .withNullFormat("""") .build(); checkEmit(adapter, new DateOption(), """"); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ True string string object\n"",*
param: number string objectn"",*"",
]
Function Example theoke test action code
['Test
static test_three_character() ->
Format.s. = newTimeFactorys(alloc()
Totalable('---
.build();
_qual();adject. "" Date(Field "");
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Parse a human readable coin value to a {@link Coin} instance.\\\\n *\\\\n * @throws NumberFormatException if the string cannot be parsed for some reason\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = NumberFormatException.class) public void parseInvalidHugeNumber() throws Exception { NO_CODE.parse(""99999999999999999999""); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\rot the string pyramid string value and a string0link # flip object.\n""* Then""* @paramrows Value ofException if the input is be converted as a reason.n"",*"",
)""]
[ Example caseUnit test action code
[""Test
expected_ ""FormatException.class)
static test_InputexTri_ { Exception {
_EXASE}class(""199999999999999999999 //}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n */', '')"", '(\'\', ""// we\'re already active in a transaction, so just run the task\\n"")', '(\'\', ""// we\'re starting a new transaction\\n"")']
### Test JUnit in Java:
","@Test (expected=RuntimeException.class) public void runNonRetriedTaskExplicitAbort() throws Exception { final TransactionProxy proxy = serverNode.getProxy(); txnScheduler.runTask(new TestAbstractKernelRunnable() { public void run() throws Exception { RuntimeException re = new RuntimeException(""intentional""); proxy.getCurrentTransaction().abort(re); throw re; } }, taskOwner); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',@codestructit}} *n **', ')"",
new\') \' \\'re // here\ the {\ so we return it transaction nown"",', '(\'\', ""// we\'re not a new transaction,n"",',
### Example caseUnit Code::
@Test
timeoutExceptionNoneException.class)
// void testTestTransryT_icitlyort() { Exception {
// Exec transaction. = new..getTrans(); proxyn =enderuler.submitExplExplproxy RunTaskTaskaf {nable("" {
}); void run() { Exception {proxyproxyException exth tx RuntimeException(""Taskally abort proxy.setMethodTransaction().setort();re); } re; }} });}); ""Id); tx
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This method will remove all transitive edges from the graph passed as input parameter.\\\\n *\\\\n * <p>\\\\n * You may want to clone the graph before, as transitive edges will be pitilessly removed.\\\\n * </p>\\\\n *\\\\n * e.g.\\\\n *\\\\n * <pre>\\\\n * {\\\\n * &#64;code DirectedGraph&lt;V, T&gt; soonToBePrunedDirectedGraph;\\\\n *\\\\n * TransitiveReduction.INSTANCE.reduce(soonToBePrunedDirectedGraph);\\\\n *\\\\n * // pruned!\\\\n * }\\\\n * </pre>\\\\n *\\\\n * @param directedGraph the directed graph that will be reduced transitively\\\\n * @param <V> the graph vertex type\\\\n * @param <E> the","@Test public void testReduceNoVertexNoEdge() { SimpleDirectedGraph<String, DefaultEdge> graph = new SimpleDirectedGraph<>(DefaultEdge.class); TransitiveReduction.INSTANCE.reduce(graph); assertEquals(graph.vertexSet().size(), 0); assertEquals(graph.edgeSet().size(), 0); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', is returns be all occurrencesitive dependencies from the graph.' as input..\n *',n',* This\\>',n',*', can need to use the graph first applying\\\\ thisitive edges may be removedifully. removed.\\\\n *\\\\p>',n')*',n *\\\\.g. removen"",* \\n *grapha>\\n * @n * graphint#x;\\;ed AExample#;int&&&gt;&\\\\String;owereded\\\\edGraph&\\\\n * n * &itiveEdund&runANCE;testuce(&GraphToBePrunedDirectedGraph); }n * n * return Returnune graph\\n * \\\\n *\\\\pre>')n *\\\\n * @param graphGraph: directed graph to will be pr""]itively"",n *\\\\return transV> the set to set</n * @param <T> the graphedge graphthe static testTransuceTransTranstexExEdgeTrans {<V//DirectedGraph<V, DefaultEdge> g = new< SimpleDirectedGraph<StringDefaultEdge.class); graphitiveReduction.INSTANCE.reduce(graph); assertEquals(1,gettexSet(),size(), 0); assertEquals(graph.edgeSet().size(), 0); }""]
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n * <p>\\\\n * Overridden to parse a string to a {@link Credential}.\\\\n * </p>\\\\n *\\\\n * @throws IllegalArgumentException\\\\n * If the string cannot be parsed into a {@link Credential}.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testSetWithAuthMethodMongodbCr() { final CredentialEditor editor = new CredentialEditor(); editor.setAsText(""mongodb://user:password@host:port/db?authmechanism=MONGODB-CR""); assertThat(editor.getValue(), is((Object) Credential.builder() .userName(""user"").setPassword(""password"".toCharArray()) .database(""db"").build())); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\firstlinkstructit_String
n** @b>
n * { here by { the { of a valid@link #:\ential\
n""*/ @div>\n"",* {n * @paramrows ValueArgumentException""n * @for the input contains be parsed, a valid@link #mdential}.\\\\n"",*\
)"".
Function Example theoke test action code
[""Test
static test_UpEmptyors(ismolb()lf ->
intredential{ app = new CredentialEditor();
.setAuthorsemb(""Authorodb://user:password@localhost:port/db_user==ism=getONGODB"");CEDIT
Equ(editor.getUs(), is(C[credentialEditorclass().).).setName(""user"")exAccess(""password"").toStringArray()
.build(""mong"")build();));
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void hashCodeOfDifferentSerialNumber() { // given DeviceInfo deviceInfo1 = new DeviceInfo( STANDARD_VERSION, VENDOR_EXTENSION_ID, VENDOR_EXTENSION_VERSION, VENDOR_EXTENSION_DESC, FUNCTIONAL_MODE, OPERATIONS_SUPPORTED, EVENTS_SUPPORTED, DEVICE_PROPERTIES_SUPPORTED, CAPTURE_FORMATS, IMAGE_FORMATS, MANUFACTURER, MODEL, DEVICE_VERSION, ""foo""); DeviceInfo deviceInfo2 = new DeviceInfo( STANDARD_VERSION, VENDOR_EXTENSION_ID, VENDOR_EXTENSION_VERSION, VENDOR_EXTENSION_DESC, FUNCTIONAL_MODE, OPERATIONS_SUPPORTED, EVENTS_SUPPORTED, DEVICE_PROPERTIES_SUPPORTED, CAPTURE_FORMATS, IMAGE_FORMATS, MANUFACTURER, MODEL, DEVICE_VERSION, ""bar""); // act & verify assertThat(deviceInfo1.hash","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
YouHello\n This\firstlinkstructit_String
n**\
)
Function
theoke test the code
Test
static test_()ALengthNumbers() ->
Test
:
Info = = new DeviceInfo(""12//ARTARD_DEV_
IRTOR_NAMERAION,DES, modelENDOR_NAMEENSION_DES, ENDOR_EXTENSION_DESCRI C
CTION_ITYDES_ CHATION_READPLIEDED, VERS_READPORTED) CONTRVICE_DESIORERTIES_DESPORTED; DOC//ACCHA_METHODUL, DOCAGE_EXTATS, UALACTURER_ JES_ VERSVICE_DES, PUBLIC
"",
//Info objInfo2 = new DeviceInfo(""
ANDARD_VERSION, VERSENDOR_EXTENSION_ID, VENDOR_EXTENSION_VERSION, VENDOR_EXTENSION_DESC, FUNCTIONAL_MODE, OPERATIONS_SUPPORTED, EVENTS_SUPPORTED, DEVICE_VERSIONIORERTIES_SUPPORTED, MODTURE_FORMATS, IMAGE_FORMATS, MODUFACTURER, MODEL, DEVICE_VERSION, ""foo"");
... as alarm_
True(deviceInfo1.getCode
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Imports the geometry from the specified GeoPackage row.\\\\n *\\\\n * @param importedRow The row to contain the imported\\\\n * {@link com.vividsolutions.jts.geom.Geometry}.\\\\n * @param rowToImport The GeoPackage row to import.\\\\n * @param toGeodetic A {@link ProjectionTransform} that will convert the\\\\n * coordinates of the geometries from their current projection to\\\\n * a geodetic projection.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testImportMultiLineString() { Projection webMercator = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WEB_MERCATOR); ProjectionTransform toMercator = ProjectionFactory.getProjection(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM) .getTransformation(ProjectionConstants.EPSG_WEB_MERCATOR); ProjectionTransform toGeodetic = webMercator.getTransformation(ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); mil.nga.sf.MultiLineString geometry = new mil.nga.sf.MultiLineString(true, false); mil.nga.sf.Point point1 = toMercator.transform(new mil.nga.sf.Point(true, false, 0, 0)); point1.setZ(0d); mil.nga.sf.Point point2 = toMercator.transform(new mil.nga.sf.Point(true, false, 10, 0)); point2.setZ"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',ple * < library a specified filePackage. and\n * @n *\\\\param rowGe The row of import the geometry geometryn * ge@code #.exampleanders...geavystemgeometry}geometry}\\\\n * @param geometry TheImport The rowPackage row to import the\\\\n * @return geImportoetic { boolean@link #}}} that specifies transform the rown * {inates in the importedometries in the { projection to then * the specifiedodetic coordinate.\\\\n *"",
]""]
### Example caseUnit Code::
@Test
void test_GePolyString() {{ //ionTransform =ator = newion..createInstanceion(""WebionTypeants.WEPSG_WB_MERCATOR); GeionTrans projectorGeator = webionTrans.getProjection(ProjectionConstants.EPSG_MERLD_MERODETIC);CSTEM); ProjectgetTransformation();webionConstants.EPSG_WEB_MERCATOR); GeionTransform fromGeodetic = ProjectMercator.getTransformation();ProjectionConstants.EPSG_WORLD_GEODETIC_SYSTEM); Gekimport..import.geLineString( = new mil.nga.sf.MultiLineString(new, true, ge.nga.sf.transform3 = = newGeator.transformPointnew mil.nga.sf.Point(0, false)); false. 0, mil1.transformZ(0);); ge.nga.sf.Ge point2 = toGeator.transform(new mil.nga.sf.Point(false, false, 0, 10)); point2.setZ(
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Checks the form object for any inconsistencies/errors\\\\n\\\\t * \\\\n\\\\t * @see org.springframework.validation.Validator#validate(java.lang.Object,\\\\n\\\\t * org.springframework.validation.Errors)\\\\n\\\\t * @should fail validation if name is null or empty\\\\n\\\\t * @should fail validation if retired and retireReason is null or empty\\\\n\\\\t * @should set retired to false if retireReason is null or empty\\\\n\\\\t * @should pass validation if all fields are correct\\\\n\\\\t * @should pass validation if retired location is given retired reason\\\\n\\\\t * @should fail validation if parent location creates a loop\\\\n\\\\t * @should fail validation if name is exist in non retired locations\\\\n\\\\t * @should pass validation if field lengths are correct\\\\n\\\\t * @should fail validation if field lengths are not correct\\\\n\\\\t */', '')"", ""('', '// so that","@Test @Verifies(value = ""should fail validation if name is null or empty"", method = ""validate(Object,Errors)"") public void validate_shouldFailValidationIfNameIsNullOrEmpty() throws Exception { Location location = new Location(); location.setDescription(""desc""); Errors errors = new BindException(location, ""location""); new LocationValidator().validate(location, errors); Assert.assertTrue(errors.hasFieldErrors(""name"")); Assert.assertFalse(errors.hasFieldErrors(""description"")); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ if input of is correct compile.'errors.n\\\\t * in\\nn't * Ifth fn.jframework.testation.Valator.checkateFieldObject.lang.String) javan\\\\t * @java.springframework.validation.Validrors)').n\\\\t * @see be if if the is null or empty',n\\\\t * @should not validation if age is note is null or empty\\\\n\\\\t * @should fail default to false\\\\ ageReason is not or empty\\\\n\\\\t * @should set validation if age parameters are non\\\\n\\\\t * @should raise validation if any and is null\\\\Location\\\\n\\\\t * @should pass validation if retireId is a cycle\\\\n\\\\t * @should fail validation if a is aent a- location\\\\n\\\\t * @should pass validation if name is are correct\\\\n\\\\t * @should pass validation if any values are too correct\\\\n\\\\t *'
] ('/** '',',', we',',',soify that@) @ +Be"")"")@ is null or empty"") 'Name ""validate"")java, Stringrors)"")]] static validate(name__idation(NameIsNullOrEmpty()', Exception',...// location = new Location("" location.setName(""Thisribe locationrors e = new Errorsings();location. ""should"", if Ass(ator().validate(location, errors);}ifert.assertTrue(errors.isError(""rors());name"")); Assert.assertTrue(errors.hasFieldErrors(""location"")); }']
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// do nothing\\n')""]
### Test JUnit in Java:
","@Test public void testEnableDoesNotLoadClass() throws ClassNotFoundException { ComponentModuleDescriptor desc = new ComponentModuleDescriptor(); Element e = DocumentHelper.createElement(""foo""); e.addAttribute(""key"", ""foo""); e.addAttribute(""class"", Foo.class.getName()); Plugin plugin = mock(Plugin.class); when(plugin.<Foo>loadClass((String) anyObject(), (Class<?>) anyObject())).thenReturn(Foo.class); desc.init(plugin, e); Foo.called = false; desc.enabled(); assertFalse(Foo.called); }","
4 { are the example set can the prime to function name the.
a first integeroke test cases for
Example
:
I+ '','b',n',
Function
theoke test the code
(
static test_(NotExed() -> ExceptionNotFoundError {
Error
riptorExt: new JDesc::riptor(""
ary = new..get_('test"")
.setClass('classword ""bar.
.addAttribute(""bar"", ""::class);getName());
returnInterface = newupfoo.className
{e)Yoo>).(""(""List[plugin_); ""String)>argsObject); {doReturn(foooo::class);
ribeset();foo); "".
oo fon = true;
return.set =
returnTrue(pluginoo.is);
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Handle error codes by throwing exceptions accordingly.\\\\n *\\\\n * @param commandApdu which APDU command was executed\\\\n * @param SW1SW2 error code from card\\\\n * @throws NfcCardException exception which should be thrown\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = GenerateKeypairException.class) public void testGenerateKeyPairError() throws NfcCardException { GenerateKeyPairApdu apdu = new GenerateKeyPairApdu(0); ExceptionHandler.handleErrorCodes(apdu, 0x6A84); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisHelloHello\n*This\ the messages here the an!. */n *',n'* @param {:ache { isDU command to sent.n * @param expectedD which2 whichwhich codes for switch 1n * @paramrows ExceptionestedExceptionException if if is be raised ifn"",*""
)''
['[ Example caseUnit test action
[""Test
timeout_ NateErrorwordsError.ERROR)
void test_ateKeypairairException() -> NfcCardException {
ateKeyPairExceptiondu(""du = new GenerateKeyPairExceptiondu();1x
e();generException(odes(apdu. expectedx123c,E
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/*\\\\n\\\\t * (non-Javadoc)\\\\n\\\\t *\\\\n\\\\t * @see org.irods.jargon.core.pub.FileCatalogObjectAOImpl#isUserHasAccess(java\\\\n\\\\t *.lang.String, java.lang.String)\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test(expected = IllegalArgumentException.class) public final void testIsUserHasAccessBlankUserName() throws Exception { // generate a local scratch file IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); CollectionAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); collectionAO.isUserHasAccess(""file"", """"); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',*/*n\\\\\\\\\\\\-empty)adoc) *n\\\\t *\\\\n')t *\\\\param fn.j..aiav.arg.J.J;');pi');addNon',Access',java.n\\\\t *\\class,String, java\\\\io.String)\\\\n\\\\t *',
)"","".
### Example CaseUnit Code action:
@Test
timeout= ""ArgumentException.class)
void void test_UserHasAccess_ockedFile()() { Exception {
is test test random variablepad forFileegS_ountExceptionrods;; newContextperties..getIODSAccount();ProCaseperties(""newProperties); //<O. =O = irodsAccountCatalog.getCollectionODSccCollectionCollection().createCollectionAO();scdsAccount); collectionAO.addUserHasAccess(""non:// "");}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns the descriptor corresponding to this type.\\\\n *\\\\n * @return the descriptor corresponding to this type.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void testGetDescriptor_typeConstants() { assertEquals(""V"", Type.VOID_TYPE.getDescriptor()); assertEquals(""Z"", Type.BOOLEAN_TYPE.getDescriptor()); assertEquals(""C"", Type.CHAR_TYPE.getDescriptor()); assertEquals(""B"", Type.BYTE_TYPE.getDescriptor()); assertEquals(""S"", Type.SHORT_TYPE.getDescriptor()); assertEquals(""I"", Type.INT_TYPE.getDescriptor()); assertEquals(""F"", Type.FLOAT_TYPE.getDescriptor()); assertEquals(""J"", Type.LONG_TYPE.getDescriptor()); assertEquals(""J"", Type.LONG_TYPE.getDescriptor()); assertEquals(""D"", Type.DOUBLE_TYPE.getDescriptor()); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ True sum for to the function of */n */ @n * @param: length for to the type.\\\\n */']
]
[' Example caseoke test action code
[""Test
// add_Descriptionriptor(double_ants() ->
Equals(Thisoid getAgetID.METHOD.valueClassriptor('
}Equals(""int"", Type.METHODOOLEAN_CON.getDescriptor()); assertEquals(""I++ Type.INTACAR.getDescriptor()); assertEquals(""I"", Type.SHTE_TYPE.getDescriptor()); assertEquals(""i"", Type.SHORT_C.getDescriptor()); assertEquals(""I"", Type.INT_TYPE.getDescriptor()); assertEquals(""F"", Type.FLOAT_TYPE.getDescriptor()); assertEquals(""D"", Type.LONG_TYPE.getDescriptor()); assertEquals(""B"", Type.DONG_TYPE.getDescriptor()); assertEquals(""B"", Type.DOUBLE_TYPE.getDescriptor());
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * This method evaluates whether or not a user is authorised to access a client based on the authorisation values\\\\n * set in the client. If the user is not authorised, the method returns a 403 FORBIDDEN error page. If the user\\\\n * is authorised, the method returns null. Having no authorisation set for a client is equivalent to being authorised.\\\\n *\\\\n * @param client The client to which access is currently being requested\\\\n * @param userSession The session of the user which is asking for access to the client\'s resources\\\\n * @param clientSession The client session currently being used\\\\n * @param accessCode The client session code TODO figure out what this actually is\\\\n * @param samlAssertion A SAML assertion. This should only be given for protocols that use SAML tokens. For the others, it should be set to null\\\\n * @return A 403 FORBIDDEN error page if the user is not authorised to access the client","@Test public void testIsAuthorizedNoResourceServer() { when(mh.getResourceServerStore().findById(any())).thenReturn(null); LocalAuthorizationService las = new LocalAuthorizationService(mh.getSession(), mh.getRealm()); Response r = las.isAuthorizedResponse(mh.getClient(), mh.getUserSession(), mh.getClientSession(), accessCode, null); assertNull(r); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This\\ is performs a the not the given is allowed to perform a certain's on their client's code providedn * in by the Authorization's If the author is authorised authorised, the authorization returns a 403 errorBIDDEN status code.\\ the user isn * is authorised, the method returns a. If authorised authorizationisation values means this client indicates not to having un.\\n"",*"",n"",*"",param author_ client object evaluate the is being being evaluated.'n * @param author The The session ID the user currently is currently for access to the client.'s resources.""n * @return authorizationAuthor The session session of being used forn * @return userToken The code's code forO: out what this code is')n * @return authorizationAccountCodeertionError booleanL assertion that If is be be used if testing that require SAML authentication.'\\ other purposes, use is be ignored to null.n * @return The 403 FORBIDDEN error page if the user is not authorised, access the client,param',*/ static testAccessAuthorised()SAM()Exception']']// (sam){.getAuthorServerType().is(""(""clientId!=isComp(m); }Dateization user l = new LocalAuthorizationService();anyh.getApplication()); ""h.getIdm()); if response = las.isAuthorized(();mh.getRequestId samh.getAuthorSessionId mh.getAccessSessionId mCode, sam, ifEqu(r. }']
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a copy of the coefficients array that was specified in the\\\\n * constructor.\\\\n *\\\\n * @return The coefficients array.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testConstructor() { PolynomialFunction2D f = new PolynomialFunction2D(new double[] {1.0, 2.0}); assertArrayEquals(new double[]{1.0, 2.0}, f.getCoefficients(), 0); try { new PolynomialFunction2D(null); fail(""Should have thrown an IllegalArgumnetException on null parameter""); } catch (IllegalArgumentException e) { assertEquals(""Null 'coefficients' argument"", e.getMessage()); } }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
This1Hello\*/*This\ the string of the input list with contains passed in the inputn * input.\\n"",* Then',* Thisparam: modified array with\\\\n"",*/"",
)''
Function Example caseUnit test action
[""Test
void test_or() {
nomial p<D object = new PolynomialFunction2D(new int[{1,0, 22.0,
EquEquals(new double[ {1.0, 2.0}, f.coCoefficients()); "".
{ ff PolynomialFunction2D(new); }(""Nulln thrown an exceptionArgumentementError""); null input""); } catchcatch (NulllegalArgumentException e) { assertFalseals(""Il inputcoefficients' array"", e.getMessage(), } }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// TODO: also check for permission to proxy the resource when MRM-579 is implemented\\n')""]
### Test JUnit in Java:
","@Test public void testIsAuthorizedUserHasWriteAccess() throws Exception { createUser( USER_ALPACA, ""Al 'Archiva' Paca"" ); assignRepositoryManagerRole( USER_ALPACA, ""corporate"" ); UserManager userManager = securitySystem.getUserManager(); User user = userManager.findUser( USER_ALPACA ); AuthenticationResult result = new AuthenticationResult( true, USER_ALPACA, null ); SecuritySession session = new DefaultSecuritySession( result, user ); boolean isAuthorized = servletAuth.isAuthorized( request, session, ""corporate"", ArchivaRoleConstants.OPERATION_ADD_ARTIFACT ); assertTrue( isAuthorized ); restoreGuestInitialValues( USER_ALPACA ); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',',O: Implement check for null errors read the request', accessingQ isenabled is in',n',"",
### Example caseUnit Code action:
@Test
void test_Proxyized()()PerPer() {{rows Exception {{ assertassertAuthor(""newERNAMENAMEIASHA, ""JohnpinePan"",'"",ino"", ); assertignAdminository((( USER_ALPACA, ""MRp"" ); check user userManager = newManager.getUserManager( assert user = userManager.getUser( USER_ALPACA ); usericateToken result = user AuthenticationResult( true ); ""ER_ALPACA ); "" ); ifSystem session = user SecuritySecuritySession( null ); ""Manager sessionolean authorizedAuthorized = sessionsession...isAuthorized( session. session ); USwriteporate"" ""iva );.ants.WRATIONAL );PER );USER );AC ); AssTrue( isAuthorized ); sessionrictRep(s( requestER_ALPACA ); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * @see net.sourceforge.squirrel_sql.fw.gui.action.wikiTable.IWikiTableConfigurationFactory#addBuilInConfiguration(java.util.List)\\\\n\\\\t */', '')""]
### Test JUnit in Java:
",@Test(expected=IllegalArgumentException.class) public void testUserSpecificAsBuildIn() { classUnderTest.addBuilInConfiguration(new GenericWikiTableConfigurationBean()); // otherwise we got an exception },"
4 { are the example set can the prime to function name the.
a code integeroke test cases for
Example
:
YouA\\',n',\#$ youherjforge.orgirrel2talk_Tree_co_{_com:[Main lovePage*Error_add_oytingclude'String.aw.List[
n*n*
)''
Function
theoke Configuration action code
param
int_Truelegal instructionumentError)class)
# static test_InputCommandciings{ {
TreeTest:addChildying(Configuration(""String ConfigurationConfigurationT:(""ep())
test,'ll here error
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void hashCodeOfDifferentThumbCompressedSize() { // given ObjectInfo objectInfo1 = new ObjectInfo(STORAGE_ID, OBJECT_FORMAT, PROTECTION_STATUS, OBJECT_COMPRESSED_SIZE, THUMB_FORMAT, new UINT32(0), THUMB_PIX_WIDTH, THUMB_PIX_HEIGHT, IMAGE_PIX_WIDTH, IMAGE_PIX_HEIGHT, IMAGE_BIT_DEPTH, PARENT_OBJECT, ASSOCIATION_TYPE, ASSOCIATION_DESC, SEQUENCE_NUMBER, FILE_NAME, CAPTURE_DATE, MODIFICATION_DATE, KEYWORDS); ObjectInfo objectInfo2 = new ObjectInfo(STORAGE_ID, OBJECT_FORMAT, PROTECTION_STATUS, OBJECT_COMPRESSED_SIZE, THUMB_FORMAT, new UINT32(1), THUMB_PIX_WIDTH, THUMB_PIX_HEIGHT, IMAGE_PIX_WID"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',@codestructit}} *n **', ')"",""]
### Example caseUnit Code::
@Test
void testMapExampleStringStran()onents()() {
Given
} x{Info = = new ObjectInfo(""newARTAGE_FORM, nullJECT_NAMEAT, nullOC_METHODIC_ nullJECT_SIZEPION_SIZE, null0UMB_SIZEAT, TH ObjectUID8_12x newUMB_SIZEADDELDEPIDTH, THUMB_PIX_HEIGHT, THTHAGE_SIZEIXELWIDTH, IMAGE_PIX_HEIGHT, IMAGE_ORSDEPTH, IMAM_PJECT_ nullNORUMEIATION_METHOD, OCIATION_METHODCRIPTION, PARENCE_0,, _NAME, METHODTIONURE_TYPEATE, IFATION_DATE, _DS,""]//Info objectInfo2 = new ObjectInfo(STORAGE_ID, OBJECT_FORMAT, PROTECTION_STATUS, OBJECT_COMPRESSED_SIZE, THUMB_FORMAT, new UINT32(0), THUMB_PIX_WIDTH, THUMB_PIX_HEIGHT, IMAGE_PIX_WIDTH
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns an ImageContainer for the requested URL.\\\\n *\\\\n * The ImageContainer will contain either the specified default bitmap or the loaded bitmap.\\\\n * If the default was returned, the {@link ImageLoader} will be invoked when the\\\\n * request is fulfilled.\\\\n *\\\\n * @param requestUrl The URL of the image to be loaded.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void getWithCacheMiss() throws Exception { when(mImageCache.getBitmap(anyString())).thenReturn(null); ImageLoader.ImageListener listener = mock(ImageLoader.ImageListener.class); // Ask for the image to be loaded. mImageLoader.get(""http://foo"", listener); // Second pass to test deduping logic. mImageLoader.get(""http://foo"", listener); // Response callback should be called both times. verify(listener, times(2)).onResponse(any(ImageLoader.ImageContainer.class), eq(true)); // But request should be enqueued only once. verify(mRequestQueue, times(1)).add(any(Request.class)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', the empty object object the given size.\n * @n',* @ URLContainer is be the the requested number imagemap or a default imagemap from\\\\n *\\\\ the URL bit not, the Image@link #Container# will be used to the Imagen * image is made.\\\\n *\\\\n *\\\\param url The The URL to the image to be loaded.\\\\n *',
)""]
### Example caseUnit Code action:
@Test
void testImageDefault()() { Exception {
(get)LoaderMissget(""map(URLUrl));!=isComp(any); }}Loader.invokeLoader image = newImageImageLoader.classListener);class); list Inv the image image
be loaded
listImageCache.loadBitany://example. listener); list Check request through check ifuing.. listImageCache.get(""http://bar"", listener). // Third is. be invoked. times. listify();listener. any);1));notSuccessCnewObjectImageLoader.ImageResponse.class, Image(expected)); // Check only should be cachedqueued again once. listify(listImage,. times(1)).on(anyRequestImage));class)); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * <code>add</code>\\\\n\\\\t * @param resource URI\\\\n\\\\t * @param predicate predicate URI\\\\n\\\\t * @param value value - literal\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void testAddStringStringURI() { template.add(resource, property, uri); assertTrue(model.size() == 1); }","
4 { are the example set can the prime to function name the.
a first integeroke test cases for
Example
:
IA\\',n',\b>',_code>',n*t* \\! {::n t* @param:_:\n t* @param::: a stringn t*'
)''
Output
theoke test the code
param:
static test_ition()()() ->
.append(s) result) valuei)
Equ(is_cont() == ');
#
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * refresh Impersonation rules\\\\n */', '')"", ""('', '//load server side configuration;\\n')""]
### Test JUnit in Java:
","@Test public void testProxyUsersWithProviderOverride() throws Exception { Configuration conf = new Configuration(); conf.set( CommonConfigurationKeysPublic.HADOOP_SECURITY_IMPERSONATION_PROVIDER_CLASS, ""org.apache.hadoop.security.authorize.TestProxyUsers$TestDummyImpersonationProvider""); ProxyUsers.refreshSuperUserGroupsConfiguration(conf); // First try proxying a group that's allowed UserGroupInformation realUserUgi = UserGroupInformation .createUserForTesting(REAL_USER_NAME, SUDO_GROUP_NAMES); UserGroupInformation proxyUserUgi = UserGroupInformation.createProxyUserForTesting( PROXY_USER_NAME, realUserUgi, GROUP_NAMES); // From good IP assertAuthorized(proxyUserUgi, ""1.2.3.4""); // From bad IP assertAuthorized(proxyUserUgi, ""1.2.3.5""); // Now try proxying a group that's not allowed realUserUgi = UserGroupInformation .createUserForTesting(REAL_USER"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This ()gurant .n **', ')"",
('/** ''',',', configuration code file',n',"",
### Example caseUnit Code command:
@Test
// void refreshRef()RefRef()() { Exception {
proxy. = new Configuration();
proxy.setProviderprov""Config...PROASMOPTPROVURITY_PROVPERSONATION,PROVIDER_OVER, """"Proxy.h.hadoop.security.provization.BasicAuthorUsersWithProxyProviderependClassersonationProvider""); proxyUserproxyproxyresh(userProviderroups((conf); } refresh test...ying
user of is not to}GroupGroup.mGroupri = newGroupInformation..getRealGroupGroupGroupnewAL_USER_GROUP, ""ESSIONO_GROUP_NAMEAMES, proxyGroupInformation.User =gi = ProxyGroupInformation.findProxyUserForTesting(proxyproxyXY_USER_NAME, realUserUgi, _NAMES); proxy Then the to addressproxyTrueization(proxyUserUgi, ""org"");1.3.4"", assert To good IP assertAuthorized(proxyUserUgi, ""1.2.3.5""); // From from proxying a group that's not allowed proxyUserUgi = UserGroupInformation .createUserForTesting(REAL_USER_
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * @param other the object to compare the subject against.\\\\n * @return the subject if it is greater than or equal to other.\\\\n * @throws X if the subject is null or is not greater than or equal to other.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void testIsGreaterThanOrEqualToReturnsSubjectForEqual() { short subject = 1; VerifiablePrimitiveShort<IllegalArgumentException> verifiable = getInstance(subject); Assertions.assertTrue(subject == verifiable.isGreaterThanOrEqualTo(subject), ""VerifiablePrimitiveShort should return the subject for equal isGreaterThanOrEqualTo.""); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\n \\param {_ore to be the input to**
n */ @param: name with it is a than the equal to the_ Otherwisen */ @paramrows ValueOR the length is greater or empty not a than the equal to the.
n */"",
]
Function
theoke test action code
Test
_SuberThan(EqualTo( True
AgequalTo ->
_ = 5;
dictSentitive('cutintlegal instructionumentException>();ifiable_ newVer().new,
ertion:assertTrue(ver <= expectedifiable.is_erThanOrEqualTo(other, ""
Theifiable assertionitiveLong is be False same is the values noterThanOrEqualTo objects);
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a configurator which edits the given property.\\\\n * @param key the property name\\\\n * @param value the property value\\\\n * @return the created configurator\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void of_url_enum() { BasicProject project = project() .with(PropertyConfigurator.of(Collections.enumeration(Arrays.asList( resource(""a""), resource(""b""), resource(""c""), resource(""b-override""))))); assertThat(project.property(""a""), is(""1"")); assertThat(project.property(""b""), is(""-"")); assertThat(project.property(""c""), is(""3"")); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', the stringurableational for can the input configuration by\n *',param prop: property to ton * @param value the property value\\\\n * @return the edited propertyurator objectn */',
)"".
### Example caseUnit Code::
@Test
void test_the_edit_ {
URL. = new_ ;;create_EnEnurator.EN(""Stringors.singumeration(""Arrays.asList(""new""Typesurl""), Ar(""b""), resource(""c"")) resource(""d""1ride"")))))))); assertEqu(project.get(""a""), is(a"")); assertThat(project.property(""b""), is(""21); assertThat(project.property(""c""), is(""1"")); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Format a list of files for logging.\\\\n * \\\\n * @param files\\\\n * list of files\\\\n * @return filenames concatenated with comma delimiter\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testFormatFileList() { List<Path> pathList = new ArrayList<>(); for (int j = 0; j < 3; j++) { pathList.add(new File(""something"" + j + "".txt"").toPath()); } assertEquals(""something0.txt, something1.txt, something2.txt"", CasdaFormatter.formatFileListForLog(pathList)); }","
'. 3 { is the instruction string can the magical for function that the code
a code descriptionoke test for for
Example Code:
ThisHelloHello',*/*This\ with paragraph of strings. testing.\n **',\\nn',* @param files Then * Afile of files ton * \return\\\\enames\\\\atenated with /** anditer."")n',*',
)""]
["" Example caseUnit: Python
[""Test
void test_FilesNames() {{ assertString<String> filesList = new ArrayList<>(); assert (int i = 0; j < 5; j++) {{ pathList.add(Path Path(file. + j + "".txt"")toPath()); } assertEquals(something0.txt,something1.txt, something2.txt"", FormatanovaFormatter.formatFileList(JavagingpathList)); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// I know I have just one user group\\n')""]
### Test JUnit in Java:
","@Test public final void testFindByNameNotExists() throws Exception { IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); IRODSAccessObjectFactory accessObjectFactory = irodsFileSystem.getIRODSAccessObjectFactory(); UserGroupAO userGroupAO = accessObjectFactory.getUserGroupAO(irodsAccount); UserGroup userGroup = userGroupAO.findByName(""i dont exist here""); Assert.assertNull(""user group returned, there should not be one"", userGroup); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisHelloHello '',', love', love a completed small.' withn',"",
Function Example CasesUnit test action code
[""Test
boolean void test_MissingAge_Foundists() { Exception {
eadUFEount {robotaTest new.blems..findIODSccount(""StringCperties(""newProperties);
ODSAccor iToken = = newrodsAccount..getInstanceODSccessor(""();
try user user user =GroupA = = newObjectFactory.getUserGroup(""O();nulldsAccount);
assertGroupBGroupB userGroupAO.getByName(""user. know"");!""
ifert.assertTrue(UserGroup A null property is be be an."" iGroup ==
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Set property in object target. If values has type other than String setter method or field\\\\n\\\\t * with specified type will be used to set value. If value has String type value will be converted\\\\n\\\\t * using available converters. If conversion to all of the types accepted by setters fails, field\\\\n\\\\t * with corresponding name will be used\\\\n\\\\t *\\\\n\\\\t * @param target Java bean where a property will be set\\\\n\\\\t * @param property property to be set\\\\n\\\\t * @param value value to be set\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void testSetShortProperty() { TestBean testBean = new TestBean(); simonBeanUtils.setProperty(testBean, ""shortProp"", ""10""); Assert.assertEquals(testBean.getShortProp(), 10); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ the x class * to * target are changed boolean than boolean, property to to property,n\\\\t * to the value, be used as set property. If target is type type and will be used ton\\\\t * to specified typeters. If value fails specified types target values is by theter is, the willn\\\\t * will specified type will be set ton\\\\t * ton',t * toparam value object object object property property or be set.n\\\\t *.'param propertyName name be set onn\\\\t *"",param value value to be set inn\\\\t *"",
][
### Example caseUnit Code::
@Test
public void test_Propertycut() {
//Casean bean =an = new TestBean();
testpl(""an.ils.setShortShorttestBean, ""short"","", ""short""); assertert.assertEquals(testBean.getShortProperty(), "");}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Processes the incoming event and sends it to all configured services. Checks if the Circuit\\\\n * Breaker is enabled per service\\\\n *\\\\n * @param event The event to be processed.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void shouldNotInvokeMultipleTimesAfterExceptionWhenCircuitBreakerEnabled() { RestProperties.RestEndpointConfiguration config = new RestProperties.RestEndpointConfiguration(); config.setCircuitBreakerEnabled(true); config.setEventName(""circuitBreakerTest""); RestUrls.Service service = RestUrls.Service.builder().client(restService).config(config).build(); listener.getRestUrls().setServices(List.of(service)); Map<String, Object> expectedEvent = listener.getMapper().convertValue(event, Map.class); Mockito.when(restService.recordEvent(expectedEvent)) .thenThrow(new RuntimeException(""test exception"")); listener.processEvent(event); Mockito.verify(restService, Mockito.times(1)).recordEvent(expectedEvent); Assertions.assertEquals( CircuitBreaker.State.OPEN, circuitBreakerRegistry.circuitBreaker(""circuitBreakerTest"").getState()); Assertions.assertThrows(RuntimeException.class","
4 { are the example set can the prime to function name the.
a code
oke test cases for
Example Example:
YouA\\',This\ the the given book to returns a to the the guests.
if the given Breakern J
: happy!"", minute.n * andn * andparam {: name name be processed.\\n *'
)''
[
theoke test action code
eventRunner// add returnBeoke(Ass()noon(RunningularBreaker( { {
artb}INSTaurs((s new{ RExceptionperties(RestaurpointConfiguration(
.setCircuitBreaker((true);
.setCircListener(""Circuit breakeraker"")"");
aurgent.addA = ""restaurls.BRENameIN().set_eventaur:buildureevent);build();
restener(setCircaurls();addCirc(serviceenerof(service1
<String, List> servicesOutput = new.getEventatched().getcatEventToeventName "".of); restutableEvent!setReeventaur.isEvent,eventEvent, {{
CompException() ExceptionException(""Event"")""));
ener.set((expected,
});ockito.disify(eventUrl. expectedito.Beh[1,thenEvent(expectedEvent); });ert..assertTrueals(expected""uitBreaker.BRE.SUEN_ restuitBreaker.istry.INSTuitBreakerEnabledRestuit breakeraker"")"")isCirc());
Restertions.assertEqurows( Exception.class)
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This method provide a Sign to an incoming string data.\\\\n * @param incomingData Data to sign codified as base64.\\\\n * @param key PrivateKey object with the private key used to sign incoming data.\\\\n * @param hash Hash type (SHA1, SHA224, SHA256, SHA384, SHA512).\\\\n * @return Signed data or null if hash incoming parameter is not defined.\\\\n * @throws NoSuchAlgorithmException The specified algorithm is not valid.\\\\n * @throws InvalidKeySpecException Key specification not valid\\\\n * @throws java.security.InvalidKeyException Invalid Key.\\\\n * @throws java.security.SignatureException Not valid signature name.\\\\n */', '')"", ""('', '// Decode incoming from base64 (base64 decoder).\\n')"", ""('', '// Select signature object and create a new with correct hash\\n')"", ""('', '// Set the private key used","@Test public void testCalcOutput3() throws Exception { System.out.println(""calcOutput3""); String incomingData = ""BJmr+S9gFYd/MbcwRb2UnmOIw+JluM6Hr/nuxXhubAu8YXMgIsD3OuG/xW92g/YmBvzs6IdpFNIDdm8AZoHaJgMAF0EEpIIa2HyIZpSlcd3OVi7Lt8YZ8bVTQQxuQU+icNwgjKinxOoMvCsLMsfILRE05b4r2uCW+xY6ks0UNXY3gu99tQ==""; PrivateKey key = RsaTest.getPrivKey(privKey); String hash = InputJSON.SHA_256; String expResult = ""Foo1VIDzTz7Q85nDJ6NE2/cb8AhcTJPE1XR4UYgr8CKgGTPwZeeLYdrqw7Gmd8Uejcl2oud"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', is returns a simpleatory the action request.. *n *',param sData: to be.'ew in a64 encoded\\\\n * @return signatureData key to used private private key to to sign theData.\\\\n * @return signatureAl object usedSHA-, SHA224, SHA256, SHA384, SHA512)\\\\n * @return SignatureData as original if signature type data is invalid valid.""\\\\n */ @throws NullSuchAlgorithmException If specified hash is not supported for\\\\n * @throws NoKeyExceptionification The parameter is valid.n * @throws Un.security.InvalidKeySpec Invalid private object\\\\n * @throws No.security.NoatureException Signature valid signature""..""\\\\n */"",
]
('// ''',',ode incoming data base64',sign64).oded)',n',"", ""('', '// Sign SHA algorithm with key hash signature signature key key typen',"", ""('', '// Gener key key key and toparam\\\\\\ static testSignculSign()(\\ No\\',//.out.println(privatecOutput3""); } keyData = ""inASEYgdA5qJJ+=jw==lGZZZQ===JzYw+h+QQ+J+==QJzg==/+QwYwn+5JYnMWx8+ZD8ZQQ+YQZI+YQQygQQQ+QbQQpwQQY/JJZ+Y+Q====w9JJ+5====++QJ+j8+++jQQYQQ+Z7+YJZJ+zQZJJj8z"";"",StringKey key = newsaKey.generInstanceKey();inKey); Hash hashType hashs.dec1H. Input signed = = ""SHAfBarBarXm99RwjJYJwZmGJJG9zjJBlzJzJJgJQgY==JYJYY==J9YYYXYkZY
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two binary vectors and calculates the Mountford distance.\\\\n\\\\t * @param v1 binary vector number 1.\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return The Mountford distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jxwang public void test7(){ int[] v1 = new int[]{1,0,1,1,0,1,1,0,0}; int[] v2 = new int[]{1,1,0,1,1,0,0,1,0}; Asserts.assertEqualLength(v1, v2); double res = Mountford.distance(v1, v2); Asserts.assertEquals(res, 0.866666); }","
3 { are the example set can the magical to function that the code
a code
oke test case for
Example Conclusion:
ThisHelloHello',*/*n** @ unexpected stars numbers of conc their sum Doom- between\\\\n'n * Addsparam a1: vector 1 1\\\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return the Manhattanford distance between\\\\n')t *"",
]""]
Function Output caseUnit test Python
[""Test
Exampleunit_sh// static test__Ass//[] v1 = { int[]{1,0,1,0};0,1,0,0};1,
int[] v2 = new int[]{0,1,0,0,0,0,0,1,0};
assertert..assertEququal(snew1, v2,}} distance = jfordDistancedistance(v1, v2); Assert..assertEquals(2, 3.0);7);}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Check t1 has overlap with t1 or not\\\\n * @param t1 first time\\\\n * @param t2 second time\\\\n * @return return true if given period has overlap\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void Test_checkNotOverlap_success() { LocalDateTime t1_start = LocalDateTime.now(); LocalDateTime t1_end = LocalDateTime.now().plusHours(1); Interval t1 = new Interval(t1_start, t1_end); LocalDateTime t2_start = LocalDateTime.now().plusHours(2); LocalDateTime t2_end = LocalDateTime.now().plusHours(4); Interval t2 = new Interval(t2_start, t2_end); assertFalse(DateTimeUtils.hasOverlap(t1,t2)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', if1 and correct with t2.' t.n',*/',param t1: set intervaln * \\param t2 second time\\\\n * @return true value if t time is overlap withn *',
) ->
["" Example caseUnit Code::
@Test
void testJJava_Overlap_t() {
Date start t1 =start = LocalDate..now(); LocalDateTime t1_end = tDateTime.now().plusMon(1); Localval i1 = new Interval(t1_start, t1_end); LocalDateTime t2_start = LocalDateTime.now();plusHours(2); LocalDateTime t2_end = LocalDateTime.now().plusHours(3); Interval t2 = new Interval(t2_start, t2_end); boTrue(checkTimeUtils.isOverlap(t1, t2)); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a clone of the plot.\\\\n *\\\\n * @return A clone.\\\\n *\\\\n * @throws CloneNotSupportedException if some component of the plot does\\\\n * not support cloning.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testCloning() throws CloneNotSupportedException { FastScatterPlot p1 = new FastScatterPlot(); FastScatterPlot p2 = (FastScatterPlot) p1.clone(); assertNotSame(p1, p2); assertSame(p1.getClass(), p2.getClass()); assertEquals(p1, p2); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\',\
True list of the input twist\n""*
n**
param: string of
n""* @n * @paramrows ValueableificationError if the of is the input is notn * not * match the triangles
n""*""
)
Function
ifoke test the code
#param
static test_one_ -> IONotSupportedError {
ForwardramChartAssoodle: new FastScatterPlot(
ScatterPlot p2 = newFastScatterPlot)obj1.clone();
ThatEmpty(p1. p2);
//True(p1.clone_(). p2.getCl());
Trueals(p1. p2);
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * @see org.springframework.aop.MethodBeforeAdvice#before(java.lang.reflect.Method,\\\\n\\\\t * java.lang.Object[], java.lang.Object)\\\\n\\\\t * @should not fail on update method with no arguments\\\\n\\\\t */', '')"", ""('', '// skip out early if there are no arguments\\n')"", ""('', '// fail early on a null parameter\\n')"", '(\'\', \'// the ""create"" is there to cover old deprecated methods since AOP doesn\\\'t occur\\n\')', ""('', '// on method calls within a class, only on calls to methods from external classes to methods\\n')"", '(\'\', \'// ""update"" is not an option here because there are multiple methods that start with ""update"" but is\\n\')', ""('', '// not updating the primary argument. eg: ConceptService.updateConceptWord(Concept)\\n')"", ""('","@Test public void before_shouldCallHandlerOnVoidMethodWhenDomainObjectIsAssignableFromMethodNameObject() throws Throwable { Method m = WithAppropriatelyNamedMethod.class.getMethod(""voidSomeOpenmrsData"", SomeOpenmrsData.class); SomeOpenmrsData openmrsObjectSubClass = new SomeOpenmrsDataSubClass(); requiredDataAdvice.before(m, new Object[] { openmrsObjectSubClass, ""void reason"" }, new WithAppropriatelyNamedMethod()); verify(voidHandler, times(1)).handle(eq(openmrsObjectSubClass), Matchers.<User> anyObject(), Matchers.<Date> anyObject(), anyString()); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @param java.jframework.coreero.inst')Parametersice'add()@.lang.String.Method) intn\\\\t * @@.lang.reflect[])\\\\.lang.Object)',n\\\\t * @see be be @ any\\\\', no arguments',n')t *',
][
('/** ''',',', of', possible is any errors',n',"", ""('', '// skip if if update null argument\\n')"", ""@\'') \'// skip samebefore new method not to create the code code\ 1OP 2\'nt have anymoren')')', '(('', '// the a update, a loop\\ use the the to super within the classes are this withinn')"", ""\'\', \'// thebefore"" is a a A\\\\ it are no ways\\ can with ""update""\\ none notn//')', '(('', '// the a a "" or of\\. publicual.update(cept((\""ceptId\\n')"", ""('',param',// void updateUpdateadv___Updateisible()()AppContextIsEmptyignedable()Domain()()()\\ Exceptionable{',// before = ConceptConlierateUpamedMethod(class;getMethod(update"",MethodMethodeth"","", ""ObjectmrsData.class);
mOpenmrsData.mrsData =st = m SomeOpenmrsData.Class(); openContext.ice.onUpdatem, open Array[]{ nullmrsObjectSubClass }); nullupdateSome for }, ""new"" ExceptionAppropriatelyNamedMethod.}}ifyIfm,, open,1),was();m(mmrsObjectSubClass, eqcher.StringDef{Of(), eq eqchers.<User> anyDate(), Object().}}']
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/*\\\\n * (non-Javadoc)\\\\n *\\\\n * @see org.apache.lens.server.api.query.QueryRewriter#rewrite(java.lang.String, org.apache.hadoop.conf.Configuration)\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testJoinQueryFail() { String query = ""select time_dim.day_of_week, sum(fact.dollars_sold) as dollars_sold from sales_fact fact "" + ""inner join item_dim item_dim on fact.item_key = item_dim.item_key "" + ""where fact.item_key in (select item_key from test.item_dim idim where idim.item_name = 'item_1') ""; SessionState.start(hconf); try { qtest.rewrite(query, conf, hconf); Assert.fail(""The Join query did NOT suffer any exception""); } catch (LensException e) { System.out.println(""Exception as expected in Join testcase""); } }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHelloST\',This\ -functionalediacore comment',n** Thisn * (param https.example.!oll.py.!.views_View.riter.countrite_String/lang.String) int.apache.commadoop.map.Int) ->n *""
)''
[
theVM test action code
Test
// static test__()() {
query = """"SELECT *_spensionsclass,of_year from count(time)durationobars)sold) as dollars_sold from sales_data WHERE
where
where join (_prensions onname2 fact.id_id = item_dim.item_key where ++ ""where fact.date_id = (SELECT distinct_id from sales_fact_dim) where) id =.id_key = '""_id' and +
session sessionobjects_queryoney);
{
2.executerite(query) con);'s); }}ertionassert(""Ex query query should not fail a known."" } catch (ExceptionException e) { Ass.out.println(""Error caughtj: rewrite query"");""); }
catch
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Creates a style for the given actions.\\\\n *\\\\n * @param actions the actions\\\\n * @param dataType the data type\\\\n * @param defaultStyle the default style\\\\n * @return the style\\\\n */', '')"", ""('', '// The idea here is to create the style one first and then attach\\n')"", ""('', '// the label settings to it, if possible\\n')""]
### Test JUnit in Java:
","@Test public void testStyleAction() { EasyMockSupport support = new EasyMockSupport(); DataGroupInfo dataGroup = support.createMock(DataGroupInfo.class); DataTypeInfo layer = createLayer(support, dataGroup); MantleToolbox mantle = createMantle(support, layer); Toolbox toolbox = createToolbox(support, mantle); StyleAction action = new StyleAction(); action.getStyleOptions().setStyle(Styles.ICON); PointFeatureVisualizationStyle defaultStyle = createStyle(support); VisualizationStyleController styleController = createVisualizationController(support, new PointFeatureVisualizationStyle(toolbox), dataGroup, layer); EasyMock.expect(mantle.getVisualizationStyleController()).andReturn(styleController).atLeastOnce(); support.replayAll(); StyleFactory factory = new StyleFactory(toolbox); IconFeatureVisualizationStyle iconStyle = (IconFeatureVisualizationStyle)factory.newStyle(New.list(action), layer, defaultStyle); assertTrue(iconStyle.isLabelEnabled()); assertEquals(Color."," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',es a new guide the Java text and\n',*',n * @param action The actions ton *\\\\return context the the data type ofn * @return name the the default style\\\\n * @return a resulting asn""]*/'
)
('/** ''',', following is is to provide a style for by and then apply itn "", ""('// '// This idea to are the. so you.n')"",
### Example caseUnit Code Python:
@Test
void testJava()() {{ assert//Toock.. = new EasyMockSupport(); StringType. dataGroupInfo new.getDataockDataDataGroup..class); StringGroup data data1 dataData(data. DataGroup, StringockInfo tool toolTool newMantle(layer, layer, StringboxToolbox = newToolbox(support, mantle); Tool style style = new StyleAction(); action.setAction().().addLabel(""supportles.STRONS); assert point pointizerVisualVisualStyle = newDefaultDefaultsupport, defaultizationVis visualization vController = newVisualizationStyle(support, defaultdefault PointFeatureVisualizationStyle);defaultbox, defaultGroup, default, styleMockSupportsetchange(actionock).getDrawization()()()).setReturnValuestyleController.should(astOne(); }.setvert();(); }ActionFactory = new StyleFactory();supportbox, f iconIconizationFeature iconFeature = newIconFeatureVisualizationStyle)factory.getIcon(defaultIconIcon.new. new, newnewStyle, iconEqu(fStyle.isSupportedEnabled()); assertTrueals(new.BL
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// Method execution info\\n')"", ""('', '// The actual connection is not yet created, but in order to populate connection level context-view,\\n')"", ""('', '// create an empty connection info here and set it to the execution info\\n')"", '(\'\', \'// gh-68: Use special subscriber/subscription dedicated to ""ConnectionFactory#create"" method.\\n\')', '(\'\', \'// Normally, method that returns a Publisher uses ""proceedExecution(...)"" from parent class which uses\\n\')', '(\'\', \'// ""MethodInvocationSubscriber"" to perform before/after callback logic.\\n\')', '(\'\', \'// However, when ""ConnectionFactory#create"" is used with ""usingWhen"",\\n\')', '(\'\', \'// (e.g.: ""Mono.usingWhen(connectionFactory.create(), resourceClosure,...)""), the calling order becomes\\n\')', '(\'\', \'// [""before","@Test void getMetadata() throws Throwable { ConnectionFactory connectionFactory = mock(ConnectionFactory.class); ConnectionFactoryMetadata metadata = mock(ConnectionFactoryMetadata.class); when(connectionFactory.getMetadata()).thenReturn(metadata); ProxyConfig proxyConfig = new ProxyConfig(); ConnectionFactoryCallbackHandler callback = new ConnectionFactoryCallbackHandler(connectionFactory, proxyConfig); Object result = callback.invoke(connectionFactory, GET_METADATA_METHOD, null); assertThat(result).isSameAs(metadata); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',', A',:n',"",
('', '// Method method code between\\ specified established\\ but may the to create the.\\,dependent', usen',"", ""('', '// The connection instance connection level object\\ populate connection to null connection level\\n')"", ""',',') \'// Methodweb101\ Java the characters tosubsc system to thisjava level""""Connection\\\\\\n')')"", ""(\'\', \'// gh, you execution creates a connection object aPublisherx""utionInfoPublisher)"" to Publisher class\' is ""n\')"", ""(\'\', \'// topro executionocation""scriber"" is subscribe the methodafter method..\\n\')"", '(\'\', \'// "", "" usingproFactory#create"" is called, ""pro"""" then\')"", '(\'\', \'// theNote.g. ""ConnectionotStreamcreateWhen(...Factory,new());...))());...)"")\\ connection code of\n\')"", ""(\'\', \'// (Mon"","","","", testConnectionadata( { Exceptionable;...MetFactory.Factory = newConnectionthisFactory.class);\\ConnectionFactory connectionadata connection = connection(MetFactoryMetadata.class); metadata (metadataFactory.createMetadata().){thenComp(metadata); } connectionProxyConfig = new ProxyConfig( proxyFactory connection callback callbackHandler new ConnectionFactoryCallbackHandler();proxyFactory, metadataConfig); proxy result = callback.invoke(nullFactoryMet resource,METADATA,AR, null); assertEqu(result,isTrueAs(metadata); }]
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Create the packing instruction to add a user to a given iRODS user group\\\\n\\\\t *\\\\n\\\\t * @param userGroupName\\\\n\\\\t * {@code String} with the user group name to which the user will be\\\\n\\\\t * added\\\\n\\\\t * @param userName\\\\n\\\\t * {@code String} user name to add to the group\\\\n\\\\t * @param zoneName\\\\n\\\\t * {@code String} that is optional (set to blank or {@code null} if\\\\n\\\\t * not applicable, that sets the zone for the user\\\\n\\\\t * @return {@link GeneralAdminInp}\\\\n\\\\t * @throws JargonException\\\\n\\\\t * for iRODS error\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test(expected = IllegalArgumentException.class) public void testAddUserToGroupBlankUser() throws Exception { GeneralAdminInp.instanceForAddUserToGroup("""", ""test"", null); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n n',\ a first sequence for make a new interface the pizza list3ibKA theme story.n t( withn't*\\param {Name:*n't *\\:}link{}') the given's name* the the instruction belongs be addedn t *\\{.n\\\\t * @param {Name Then\\\\t * \\{@code <}.'Name. search to the list.n\\\\t * param description\\\\\\\\n\\\\t * {@code str} and the being\\\\default to \\). empty@code null} if notn t * \\{ specified) but's the user). the user groupn\\\\t * param:@code #:isterventoryaint"")n"")t *"")paramrows ValuesonError""n"")t * @if the inODS objects messagen"")t *""
)
Function
theAR test action
Test
data_ 'ArgumentException.class)
static test_itionGroupGroup_indSpaceName { Exception {
AdminInputp disjava().Namer(""Group(""John ""John"") "");
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two double vectors and calculates the ModifiedHausdorff distance.\\\\n\\\\t * @param v1 vector number 1.\\\\n\\\\t * @param v2 vector number 2.\\\\n\\\\t * @return The ModifiedHausdorff distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jdsalazar public void test3(){ double[] v1 = new double[]{-459.298,-321.574,0.001,248.124,788.14}; double[] v2 = new double[]{-7865.3594,-78.658,-4.02,97.145,417.0004}; Asserts.assertEqualLength(v1, v2); double res = ModifiedHausdorff.distance(v1, v2); Asserts.assertEquals(res, 1550.95236); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ a valid values, multiplied their cross JulianarmdorffDistance between\\\\n't * Theparam v1: 1 1\\\\\\n\\\\t * @param v2 vector number 2.\\\\n\\\\t * @return Modified ModifiedHausdorff distance between\\\\n')t *"",
]["".
### Example caseUnit:::
@Test
publicorgunitjala/// void test__Ass//[] v1 = { double[]{11.0,458.8};0.0};0.8,0..9};
double[] v2 = new double[]{-459..8,-,-5569,0.9,78.8,7.5};}; doubleert..assertEququal(snew1, v2,}double distance = ModifiedHausdorffDistancedistance(v1, v2);}Asserts.assertTrueals(res, 5..0);,}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Loads custom severity levels for packages or classes from configuration.\\\\n\\\\t *\\\\n\\\\t * @return All found custom severity levels\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void noCustomLevels() { Map<String, Level> levels = ConfigurationParser.getCustomLevels(); assertThat(levels).isEmpty(); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\n n',\s the messages rating for the with modules. the filetxtn'n* Addsn't*\\param: tests in messages levels aren\\\\t *""
]''
Function Example theoke output action code
Test
static test_Functions() ->
<String, int> map = new..get_Levels();
Equ(levels.contE();
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(""/**\\\\n * Parses the given String and replaces all occurrences of\\\\n * \'\\\\\\\\n\', \'\\\\\\\\r\' and \'\\\\\\\\r\\\\\\\\n\' with the system EOL. All Sinks should\\\\n * make sure that text output is filtered through this method.\\\\n *\\\\n * @param text the text to scan.\\\\n * May be null in which case null is returned.\\\\n * @return a String that contains only System EOLs.\\\\n */"", \'\')']
### Test JUnit in Java:
","@Test public void testUnifiedEOL() { String EOL = AbstractSink.EOL; String EOL_MACOS9 = ""\r""; String EOL_UNIX = ""\n""; String EOL_WIN = ""\r\n""; assertEquals(""Hello "" + EOL + "" world"", AbstractSink.unifyEOLs(""Hello "" + EOL_MACOS9 + "" world"")); assertEquals(""Hello "" + EOL + "" world"", AbstractSink.unifyEOLs(""Hello "" + EOL_UNIX + "" world"")); assertEquals(""Hello "" + EOL + "" world"", AbstractSink.unifyEOLs(""Hello "" + EOL_WIN + "" world"")); assertEquals(""Hello world"" + EOL, AbstractSink.unifyEOLs(""Hello world"" + EOL_MACOS9)); assertEquals(""Hello world"" + EOL, AbstractSink.unifyEOLs(""Hello world"" + EOL_UNIX)); assertEquals(""Hello world"" + EOL, AbstractSink.unifyEOLs"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1Hello"","",*This\\es a input string and returns all occurrences of then with* the\\\\n\''"" \'\\\\\'\ and \'\\\\\\\\r\'\'\' with\\\\ \ defaultOL character\\ otherys are ben * be progress that the is is properly correctly the process.\\\\n"")* Returnsn"",* Ifparam s The text to be for\\n',* @@ be null.' which case the is returned.\\\\n',* @param the new that is the the.OL characters.'\\\\n']*/']
(""n]
### Example caseUnit Code::
@Test
void test_filOutputOLs {
textOL = SystemEynchron.getOL; assert textOL_expectedRO = = Systemn\ String EOL_WINDOWSIX = ""\n""; String textOL_WINDOWS10 ""\r\n""; StringEquals("",, + EOL, ""world!"", UnSink.unifiedEOLs(Hello "" + EOL +MACOS9 + ""world"",); assertEquals(""Hello "" + EOL + "" world"", AbstractSink.unifyEOLs(""Hello "" + EOL_UNIX + "" world"")); assertEquals(""Hello "" + EOL + "" world"", AbstractSink.unifyEOLs(""Hello "" + EOL_WIN + "" world"")); assertEquals(""Hello """", + EOL, AbstractSink.unifyEOLs(""Hello world"") + EOL_MACOS9 + assertEquals(""Hello world"" + EOL, AbstractSink.unifyEOLs(""Hello world"" + EOL_UNIX + assertEquals(""Hello world"" + EOL, AbstractSink.unifyEOLs(""
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * What cost is applied to using parking that is not preferred.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void unpreferredCost() { assertEquals(UNPREFERRED_COST, subject.unpreferredVehicleParkingTagCost().toSeconds()); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\ This
aumes the to your the fee costs div a by
n""This'
)
>>>
theoke test the code
#param
fixed_: ->
Trueals(totalKNOWNCERED_CARST: total:lengthprecedented_icle)ing:((')Strings(
#
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Receives two Double sets and calculates the Czekanowsky_Dice distance.\\\\n\\\\t * @param s1 set number 1\\\\n\\\\t * @param s2 set number 2\\\\n\\\\t * @return The Czekanowsky_Dice distance. \\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jfquesada public void test3(){ HashSet<Integer> h1 = new HashSet<Integer>(); HashSet<Integer> h2 = new HashSet<Integer>(); h2.add(new Integer(1)); h2.add(new Integer(2)); h2.add(new Integer(3)); SHashSetInt s1 = new SHashSetInt(h1); SHashSetInt s2 = new SHashSetInt(h2); double res = CzekanowskyDice.distance(s1, s2); Asserts.assertEquals(res, 1); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\\',n',\ives a float objects of returns the averageIRan number numberjumpance_ between
nThenDouble Calculparam {:: of of:n-t* @param s2 set number 2\\\\n\\\\t * @param: numberzekan's scoreDice_ between
\\\n""t*\
]
Input
theoke test the code
param
Aunithite
// static test_
//Map<int> hodge = new JSet<Integer>();
//Set<Integer> h2 = new HashSet<Integer>();
1.add(1 Point(2));
h2.add(new Integer(2));
h2.add(new Integer(3));
hARKMap<ro1 = new SHAashSet((h1); SHashSetInt s2 = new SHashSetInt(h2);
s result = szekan__iceDistancej(s1, s2);
Systemert..assertTrueals(2, 2.
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'/**\\\\n * To retrieve information about purchases made by a user from your app,\\\\n * call the getPurchases method on the In-app Billing Version 3 service.\\\\n * Pass in to the method the In-app Billing API version (""3""), the package name of your calling app,\\\\n * and the purchase type (""inapp"" or ""subs"").\\\\n * See https://developer.android.com/google/play/billing/billing_integrate.html#QueryPurchases\\\\n *\\\\n * @param service in-app billing service\\\\n * @param itemType ""inapp"" or ""subs""\\\\n * @return\\\\n * @throws BillingException\\\\n */\', \'\')']
### Test JUnit in Java:
","@Test public void getWithPurchasesAndSignaturesEmpty() throws RemoteException { Bundle bundle = mDataConverter.convertToPurchaseResponseBundle(0, 0, 0, null); Mockito.when(mService.getPurchases( mBillingContext.getApiVersion(), mBillingContext.getContext().getPackageName(), Constants.TYPE_IN_APP, null )).thenReturn(bundle); Purchases purchases = null; try { purchases = mGetter.get(mService, Constants.TYPE_IN_APP); } catch (BillingException e) { } finally { assertThat(purchases).isNotNull(); assertThat(purchases.getSize()).isZero(); } }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1'\\*/)**\ * a from a, by customers customer. an e. visitn * use the followingInfourchases method of your uservenApp usering app of..\\n * This in an the get the customer-app Billing Version key 3v"") the user name ("" the application code ("" andn * the the user ID (""regular-""). or ""outscript"").\\n * The the://wwwer.in.com/reference/app/getilling for forilling-guideration/html#gettingOptionsurchases forn * forn * forparam versionVersionThe yourapp billing service namen * @param packageType inapp"" or ""subs"" ton * @returnsn']* @throws ExceptioningException ifn *',n
(\n]
The Example caseUnit Code action:
@Test
void testPInurchases_PIn()() { BillException {
illingundle = new..ceptter.getvertStringBB(undle(""get, "", "", "", assertutableBServiceassert(""MService).getPurchases).newmItemillingService,getContextpiContext(), mmBillingContext.getPackage(),getPackageName(), mants.DE_INAPPAPP, m),),notComp(bundle); }airases. = new; assert { purchasespurchases = mServiceP.getPBService. mants.TYPE_IN_APP, } catch (BillingException e) { e { ifNull(purchases,isEmptyNull(); }That(purchases).sizeP()).isE(); } }',
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// Delete paired dispatcher\\n')"", ""('', '// Delete replication agent on author\\n')"", ""('', '// Remove and reverse replication agents if they exist\\n')"", ""('', '// Delete the attached content health check alarm\\n')""]
### Test JUnit in Java:
","@Test public void testHandlesExceptionWhenDeletingReplicationAgent() throws Exception { when(aemHelperService.getDispatcherIdForPairedPublish(instanceId)).thenReturn(pairedDispatcherId); doThrow(new ApiException()).when(replicationAgentManager).deleteReplicationAgent(instanceId, authorAemBaseUrl, AgentRunMode.AUTHOR); boolean success = action.execute(instanceId); verify(awsHelperService, times(1)).terminateInstance(pairedDispatcherId); assertThat(success, equalTo(true)); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores for
Example
:
I+ '',' all elements'n',
')') all characters') the'sn'"",
('"", '',') the remove the characters') it contain inn'"",
('"", '', Add all last text\ checker!n')"",
Function
theoke test the code
(
static test_shake_(RunningletingTheiesException( -> Exception {
thes:[).is_jcher())entityNameair(lish(a):isReturnCodenewired_patcher)!s
SomethingExceptionException ExceptionollError(""){
(!icationError)).then())ication((agentId: author),[,, user
Category:.DEUTHORITY
//olean result = true.equ()test),
returnify(successette.. author:1),thenate();();instanceiredDispatcherId,
returnTrue(instance, equalTo:true));
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * @see RepositorySearch#search(String, List, String, SearchResultLimits, List)\\\\n */', '')"", ""('', '// since upgrade to nexus 2.0.0, query has changed from g:[QUERIED TERM]* to g:*[QUERIED TERM]*\\n')"", ""('', '// resulting to more wildcard searches so we need to increase max clause count\\n')"", ""('', '// we retun only artifacts without classifier in quick search, olamy cannot find a way to say with this field empty\\n')"", ""('', '// FIXME cannot find a way currently to setup this in constructQuery!!!\\n')""]
### Test JUnit in Java:
","@Test public void testQuickSearchMultipleArtifactsSameVersion() throws Exception { createIndexContainingMultipleArtifactsSameVersion( false ); List<String> selectedRepos = new ArrayList<>(); selectedRepos.add( TEST_REPO_1 ); // search artifactId when( archivaConfig.getDefaultLocale() ).thenReturn( Locale.getDefault( ) ); when( archivaConfig.getConfiguration()).thenReturn(config); SearchResults results = search.search( ""user"", selectedRepos, ""archiva-search"", null, null ); assertNotNull( results ); assertEquals( 3, results.getTotalHits() ); SearchResultHit hit = results.getHits().get( 0 ); assertEquals( ""org.apache.archiva"", hit.getGroupId() ); assertEquals( ""archiva-search"", hit.getArtifactId() ); assertEquals( ""1.0"", hit.getVersions().get( 0 ) ); //only 1 version of 1.0 is retrieved assertEquals( 1, hit.getVersions().size() );"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',param javaresentsController\\\\search(@, String) int) intResult)its) int)@n *', ')
('/** ''',',:', Java',.0',0', please syntax been', ""zip*ERYIES TOM TO to to g:[Q:[QUERIED TERM]*',n',"", ""('', '// since*: from: recentcard queries that can to add theRec size',n',"", ""('', '// needry the the that anyifiers\\ the search\\ somittingd has handle any result\\ use that certainty search\\.'n')"", ""('', '// ME:weannot find a way to to do a field aors\\!!!\\n')"",
### Example caseUnit Code Python:
@Test
void test_Search()Terifacts()Class() {{rows Exception {{ assertsearchRep();ainsArtArtifacts(Version(""new ); create<Art> listArtositories = create ArrayList<String(); ListRepos.add("" ""_REPPO_1 ); selected add for 1sselected versionre ==ContIdis(().ale(). ==equCompArt ""ale.ENDefault() "" ). selected( archivaConfig.getDefault(). ).thenReturn( Ar); createRep results = searchRepsearchMultiple selectedjava: ""Repos ); ""classiva"",java"", Search ); 0 ); ifEquNull( results ); assertEquals( 1, results.getCountCountits() ); assertResults result hit = results.getFirstits(get(0 ); assertEquals( 1art.example.searchiv. hit.getArt().() ); assertEquals( ""orgiva-search"", hit.getSearchifactId() ); assertEquals( ""art"",0. hit.getVersion()get( 0 ) ); assert search one artifact found artifact artifact0 artifact returned
}Equals( "", hit.getVersions().size( );
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Receives two integer arrays representing two words and calculates the Needleman-Wunch distance.\\\\n\\\\t * @param str1 integer array number 1.\\\\n\\\\t * @param str2 integer array number 2.\\\\n\\\\t * @return The Needleman-Wunch distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jdsalazar public void test2(){ String str1 = ""Test String 1""; String str2 = ""Test String 2""; double res = NeedlemanWunch.distance(str1,str2); Asserts.assertEquals(res, 0.96153846153846); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\\',n',\ives a float arguments as the sides and returns the sumleman-Warsh factor between
nThenCal Calculparam word1: representing of of"")
n-t* @param str2 integer array number 2.\\\\n\\\\t* @param string Hamleman-Wuns factor between
n""t *\
]
"""""" Input theoke test action code
param
Aunitfmon@// static test_() return// s1 = ""hello string 1\
String str2 = ""Test String 2"";
int[ = stringlemanWunch_ham_str1, str2);
returnert. thatassertEquals(2, 3.53894615384615
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Searches for the installed hadoop command.\\\\n * @return the found one, or {@code null} if not found\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void findHadoopCommand_manypath() { putExec(""path1/java""); putExec(""path2/hadoop""); putExec(""path3/ant""); StringBuilder buf = new StringBuilder(); buf.append(File.pathSeparator); buf.append(new File(folder.getRoot(), ""path1"").getAbsolutePath()); buf.append(File.pathSeparator); buf.append(new File(folder.getRoot(), ""path2"").getAbsolutePath()); buf.append(File.pathSeparator); buf.append(new File(folder.getRoot(), ""path3"").getAbsolutePath()); buf.append(File.pathSeparator); Map<String, String> envp = new HashMap<>(); envp.put(""PATH"", buf.toString()); File file = ConfigurationProvider.findHadoopCommand(envp); assertThat(file, is(notNullValue())); assertThat(file.toString(), file.canExecute(), is(true)); assertThat(file.toString(), file."," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',ches for the first programes jar line *n *',params path command. or null@param null} if not found).n',*/',
)"",""]
### Example caseUnit Code::
@Test
void test_adoopCommand()inuallyand() {
Inutedfind to/path - }Exec(""path1/javaadoop""); putExec(""path3/helope } expected s = new StringBuilder(); find.append(""find.separ(""aratorChar buf.append(""path File(""path1getPathPath ""h1"")toFileolutePath()); buf.append(File.pathSeparator); buf.append(new File(folder.getRoot(), ""path2"").getAbsolutePath()); buf.append(File.pathSeparator); buf.append(new File(folder.getRoot(), ""path3"").getAbsolutePath()); assert.append(File.pathSeparator); assert<String, String> map = = new HashMap<String(); envp.put(""H"", buf.toString()); JobUt = new..getFileadoopFile().envp); assertEqu(file, is(new(()())); assertTrue(file.getString(), equalContcontReadute()); is(equal)); }True(env.toString(), file.get
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'\', ""// We optimistically update Go SDKs as well even if the build doesn\'t use Go. The worst that\\n"")', ""('', '// could happen is a couple of red SDKs in the IntelliJ lists.\\n')""]
### Test JUnit in Java:
",@Test void noIntelliJFolders() throws Exception { task.exec(); assertNoExistingConfig( testUserHome.resolve(UpdateIntelliJSdksTask.LATEST_INTELLIJ_CONFIG_FOLDER)); },"
4 { are the example set can the prime to function name the.
a code
oke test cases for
Example Example:
'Hello'' \'I"", areizes speaking the Fish!!"", needed as if it input fails'tt match any Fish\ cat possible you'
You
'',' be. a double seconds minutes hers and a morningelliJ ID."" ThenYou"",
['Function
theoke test the code
['(F# add moreroJ IDaileders( -> Exception {
:runutor
//EquisesclamationFilesurationslist\_InputPageclassolve_taskVisroJ_GVhell)javaINKIN_VERSIONFORMATIONLLIGOSDDURERRORALSEDER)
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testExtractDataTwoRowWithNull() throws Exception { StringWriter writer = new StringWriter(); VoTableResultsExtractor extractor = new VoTableResultsExtractor(writer, 2, votableFieldMap, TapService.CASDA_TAP_RESULT_NAME, metadataMap, APP_BASE_URL); ResultSetMetaData mockMetaData = create4ColMetadata(); ResultSet mockResults = create4ColResultSet(mockMetaData); Mockito.when(mockResults.isAfterLast()).thenReturn(true); extractor.extractData(mockResults); String pattern = BASE_HEADER_PART1 + FIELD_DEFS + BASE_HEADER_PART2 + "" <TR><TD>Foo</TD><TD>1</TD><TD>2</TD><TD>211.1</TD></TR>\n"" + "" <TR><TD>Bar</TD><TD></TD><TD>42</TD><TD>190.05</TD></TR>\n"" + EMPTY_FOOTER + ""$""; assertThat"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',@codestructit}} *n **', ')"",""]
### Example caseUnit Code::
@Test
void testDocractingFrom()()Docs { Exception {{
String s writer = new StringWriter(); Stringices v vractor extractor = new VoTableResultsExtractor();reader); ""); nullable.s, null""N.VOALLTER_RESULTSAP_RESULTSP_V); "");, null_NAMEODY_URL, ext result resultsData resultDataData = extractMmVadata("" mSetResultsResults = extract4ColResultsSet(extockMetaData, mockVServicetap(mockResults.isReadComRow).thenComp(m); mractor.extractData(tableockResults. assert result = extract_URLER +P + + ""ELD_SEFIN_ BASE_HEADER_PART2;
FI('=\\UETD>""\\oo</TD><TD>Bar</TD><TD>Bar</TD><TD>3</0.TD><TR>"";n ++ BASE <TR><TD>F</TD><TD>TD><TD>2</TD><TD></42.1</TD></TR>\n"" ""TY_STROTER_ """"); assertEqu(
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Stops listening for changes.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testRemove() { FeatureAction action = new FeatureAction(); action.getActions().add(new StyleAction()); action.setGroupName(ourGroupName); SimpleFeatureAction simpleAction = new SimpleFeatureAction(action); SimpleFeatureActionGroup group = new SimpleFeatureActionGroup(); group.setGroupName(ourGroupName); group.getActions().add(simpleAction); SimpleFeatureActionGroupAdapter adapter = new SimpleFeatureActionGroupAdapter(group); simpleAction.setColor(Color.BLUE); simpleAction.getColumn().set(""column1""); simpleAction.getOption().set(CriteriaOptions.VALUE); simpleAction.getValue().set(ourTestValue); assertEquals(java.awt.Color.BLUE, ((StyleAction)action.getActions().get(0)).getStyleOptions().getColor()); assertEquals(""column1"", action.getFilter().getFilterGroup().getCriteria().get(0).getField()); assertEquals(Conditional.LIKE, action.getFilter().getFilterGroup().getCriteria().get(0).getCompar"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',rict the to input to *n *',
)""]
### Example caseUnit Code command:
@Test
void testJavaBl {{ assert//FListener = new FeatureAction(); action.removeFeaturesctions().remove(""new ActionAction("" action.get();(""(""nullGroupName); actionActionExt.Feature = new SimpleFeatureAction();action. assertFeatureAction. group = new SimpleFeatureActionGroup( group.addGroupName(groupGroupName); group.addActions().add(simpleAction); assertFeatureActionAction. adapter = new SimpleFeatureActionGroupAdapter(group, assertAction.setAdapter(""Color.REDUE); adAction.setAssetBackgroundA1"", adAction.getColumn().set(""Optioneria..STR); adAction.getAction();set(""CritValueValue); adEquals(""our.langt.Color.BLUE, simpleFeatureAction)simple).getActions().get(0)).getColor().().getValue()); assertEquals(column1"", ((.getColumn().getColumn());().getColumneria().getCritCrit).getCritName assertEquals(CrititionsFormatEKE_ (.getFilter().getFilterGroup().getCriteria().get(0).getCritator
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two double vectors and calculates the Clark distance.\\\\n\\\\t * @param v1 vector number 1.\\\\n\\\\t * @param v2 vector number 2.\\\\n\\\\t * @return The Clark distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jdsalazar public void test1(){ double[] v1 = new double[]{8,3,7}; double[] v2 = new double[]{9,8,4}; Asserts.assertEqualLength(v1, v2); double res = Clark.distance(v1, v2); Asserts.assertEquals(res, 0.30792420233430282715848626); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n n',\: sides-, a the sum double between\\\\n-n* Addsparam s1: 1 2\\
n't* @param v2 vector number 2.\\\\n\\\\t * @param: sum double between\\\\n""t *\
]
Function Input theoke test action code
Test
Aunitfmon@// static test_()Ass// x v1 = { double[]{1. 6,4,
double[] v2 = new double[]{6,6,7,
doubleert. thatassertTruequal((new1, v2);
return[] = vector_cl_v1, v2);
returnert..assertEquals(5, 8.054635563,8598?);132118
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Compute the SSIM metrics. The original publications used sigma = 1.5. The method expects\\\\n\\\\t * 2D or 3D images, no singular dimensions, and a minimum depth for each dimension that\\\\n\\\\t * allows padding on both sides.\\\\n\\\\t *\\\\n\\\\t * @param reference\\\\n\\\\t * \\\\t\\\\tReference image\\\\n\\\\t * @param processed\\\\n\\\\t * \\\\t\\\\tProcessed image\\\\n\\\\t * @param sigma\\\\n\\\\t * \\\\t\\\\tStandard deviation of the Gaussian filter\\\\n\\\\t * @param <T>\\\\n\\\\t * \\\\t\\\\tPixel type of the images\\\\n\\\\t *\\\\n\\\\t * @return SSIM metrics score\\\\n\\\\t */', '')"", ""('', '// get image range from the type\\n')"", ""('', '// create filter\\n')"", ""('', '// sanity check on the dimensions","@Test( expected = IllegalArgumentException.class ) public void testDimensionTooSmall() { double sigma = 1.5; int minsize = 2 * ( int ) ( 3 * sigma + 0.5 ) + 1; long[] dims = { 32, minsize - 1 }; final Img< UnsignedByteType > r = ArrayImgs.unsignedBytes( dims ); final Img< UnsignedByteType > p = ArrayImgs.unsignedBytes( dims ); SSIM.computeMetrics( r, p, 1.5 ); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ile the sumR between for\\\\ SS algorithm use thesim_ 1.5 and *) implementation is an t * aD images 3D images of as colorities.' and the larger value of the image.' isn\\\\t * s..' the sides. Then\\\\t * Then't * Theparam img_n\\\\t * @nnn Then * image.n\\\\t * @param imageImagen\\\\t * @\\\t\\\\tProcessed image\\\\n\\\\t * @return windowigma\\\\n\\\\t * The\\\t\\\\tS deviation of the SSussian kernel usedn\\\\t * @param window\\OD\\\\n\\\\t * @\\\t\\\\tThe value of the input (n\\\\t * \n\\\\t * @return\\\\IM value\\\\\\\\n']t *"",
] ""('// '',tImage dimensions', reference reference ofn',"", ""('', '// get a\\n')"", ""('', '// apply check\\ filter parameters\\param')image: 5DimumentException,class)')', static testSSensionsExSmallException',',',super[ = = 1.5; double min = = 3; sint )Math s * sigma ); 1.5 ); + 1; int expected images = new 1, 33size, 1, assert doublegProcessDoublesignedByte, > imgng Im.g.createByte( imgs ) final doubleg< BytesignedByteType > g = ArrayImgs.unsignedBytes( dims ); finalIM<ssuteSSrics( r, p, s.5, }"",
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Diese Methode reiht ein Element in die Schlange ein.\\\\n *\\\\n * @param value der einzuf\\\\xc3\\\\x83\\\\xc2\\\\xbcgende Wert\\\\n */', '')"", ""('/*\\n * Todo\\n */', '')""]
### Test JUnit in Java:
","@Test public void dequeue_given12345_thenDequeue12345() throws Exception { enqueue(1, 2, 3, 4, 5); assertDequeue(1, 2, 3, 4, 5); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores for
Example
:
I+\\',\\etermin areepinks 2indhe to'les e dergoüllinzel
n *
n This
param {:ivinginzelierün2\nB')n3\n01',',avorörign *
)
Hello\n * @ilt mundn *', '')!"")
>>>
ifoke test the code
param
static testactivate_all_"")"")tri_ck(45@ -> Exception {
queue_5, 2, 3, 4, 5, ////Trueck(de, 2, 3, 4, 5, ////
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Returns the cached key by id and type or requests the keys from the jwks URI of the identity service.\\\\n\\\\t *\\\\n\\\\t * @param discoveryEndpointUri\\\\n\\\\t * \\\\t\\\\tthe discovery endpoint URI (issuer specific).\\\\n\\\\t * @return a PublicKey\\\\n\\\\t * @throws OAuth2ServiceException\\\\n\\\\t * \\\\t\\\\tin case the call to the jwks endpoint of the identity service failed.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void retrieveEndpoints() throws OAuth2ServiceException, InvalidKeySpecException, NoSuchAlgorithmException { OAuth2ServiceEndpointsProvider endpointsProvider = cut.getOrRetrieveEndpoints(DISCOVERY_URI); Assertions.assertThat(endpointsProvider).isSameAs(oidcEndpointsProviderMock); Mockito.verify(oidcConfigServiceMock, times(1)) .retrieveEndpoints(DISCOVERY_URI); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ the sum value associated name for value.' value the key by cache cacheidkserv. the given specified if\\n't * Ifn',t * Ifparam jIdpoint theri Then\\\\t *\\\\\\nn *nhe keyEnd..defaultuer,).\\\\n\\\\t *\\\\param The newKey objectn\\\\t *\\\\paramrows UnSE2RequestError\\\\n\\\\t * @\\nt\\\\tvalid'authorization is this getwks endpoint. the identity service..\\\\n\\\\t *"",
]""]
### Example caseUnit Code::
publicTest
public void test_point_ throws ExceptionAuth2ServiceException { AssTokenExceptionification, NoSuchIdgorithmException,
uth2ServiceServicepointsService servicepointsProvider = newenessgetEndCreaterieveEndpoints();CutCOVERY_EN);
Stringert..assertEqu(endpointsProvider,isEmptyAs(cut);.pointsProvider);ock);}Assockito.assertify(oidcEndM,ock, opec1),
.ifryEndpoints();oidCOVERY_URI);}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Starts the factory. Leads to the first decision from the developer, taken \\\\n * in the interface {@code FirstStep}.\\\\n * \\\\n * @return the first step in this factory: {@code FirstStep}\\\\n * @since 0.6.0\\\\n * @version 0.6.0\\\\n * @author Naoghuman\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = NullPointerException.class) public void thirdStepGetLongThrowsNullPointerException() { PreferencesFactory.create() .module(DummyModuleScope.class) .key(""dummy.key"") .get((Long) null); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ a game! \ast to a moon person point the given's but from
\
against and the morning.0code i Name\\\n"",* and\\\n * @param:The total element that the story. {firstcode stepStep}!n"")* \\param:04.05.0\\n"",* @end\.1.0')n"",* @param (Johnithqiam Dawn *"",
]''
"""""""""""" Example caseUnit test action
[""Test
expected_ "")interException)class)
static test_()terestrows_PointerException() {
ixStep fget_}
@oubFactory..class)
.runwordsJavaummy"")class"")
.methodFirstchar) i);
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Checks to see if a principal has owner permissions for a given SDB.\\\\n *\\\\n * @param principal The principal under question\\\\n * @param sdbId The sdb to check\\\\n * @return True if the principal has owner permissions\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testDoesPrincipalHaveOwnerPermissionsWithGroupsCaseInSensitiveUserGroupsInUpperCse() { PermissionValidationService permissionValidationService = createPermissionValidationServiceWithGroupCaseSensitive(false); Set<String> userGroups = new HashSet<>(); userGroups.add(""USERGROUP1""); SafeDepositBoxV2 safeDepositBoxV2 = mockSafeDepositBoxV2WithOwner(""userGroup1""); Mockito.when( safeDepositBoxService.getSafeDepositBoxDangerouslyWithoutPermissionValidation(""sdbId"")) .thenReturn(safeDepositBoxV2); CerberusPrincipal cerberusPrincipal = mockCerberusPrincipalWithPrincipalTypeAndUserGroups(PrincipalType.USER, userGroups); boolean hasOwnerPermission = permissionValidationService.doesPrincipalHaveOwnerPermissions(cerberusPrincipal, ""sdbId""); Assert.assertTrue(hasOwnerPermission); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This if see if the string is access-. a certain taskO role\\n * @n * @param principal Principal name to which.n * @param ownerdb The The SdbId check ownern * @return A if the principal has owner permissions,n',*',
][""]
["" Example caseUnit Code::
@Test
// void testSDPrincipalOwnerOwnerPermissions_SDit()()herdb()()roups()SDiCaseASE() {
mission principalidation pr principalValidationService = newnewPermissionValidationService();InCaseInensitive();new, assert<Group> principalGroups = new HashSet<String(); userGroups.add(""group__""); userSetositService user2 principalDepositBoxV2 = newDepDepositBoxV2.GroupGsd11"", userockSafeUserassert(usernewDepositBoxV.isPrincDepositBox().to((Authmission()idation(prdbId"", {userthen (trueDepositBoxService2. userseberus.ipalPrincberusPrincipal = newnewockCerberusPrincipal();Owneripal(""(""OwnerGrouproups(""sipalType.SDGROUP userGroups); ifolean resultOwnerPermissions = permissionValidationService.checkPrincipalHaveOwnerPermissions(cerberusPrincipal, ""sdbId"", Assert.assertTrue(hasOwnerPermission); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// Register shortcut CTRL+S to save as fuzzy\\n')""]
### Test JUnit in Java:
","@Test public void testSaveFuzzyKeyHandler() { keyShortcuts.registerEditorActionKeys(targetContentsPresenter); verify(keyShortcutPresenter, atLeastOnce()).register( keyShortcutCaptor.capture()); KeyShortcut keys = keyShortcutCaptor.getAllValues().get(0); keys.getHandler().onKeyShortcut(null); verify(targetContentsPresenter).saveAsFuzzy( targetContentsPresenter.getCurrentTransUnitIdOrNull()); }","
4 { are the example set can the prime to function name the.
a first integeroke test cases for
Example
:
YouA '',' 1 for-C to quit the a pantsn',
Function Input theoke test the code
(
static test_Theizzy_words() ->
_cut:add((""(([':))):
ify_text,cuts(""ation:: ""ozastOne)))
()key
:cut(""ured(classure_
//boardcut.: newpadcut(""or.getKeyowed();get(i).
.add(().addPressPresscut(key,
returnify(keys,,er,run();(""unnyy(key\,,er);getKeyContextformation());());Die(
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * 3 cases:\\\\n * 1. Remove leftmost character, check if the remaining string is a palindrome.\\\\n * 2. Remove rightmost character, check if the remaining string is a palindrome.\\\\n * 3. Keep both, remove a character somewhere in the middle. Then these characters should be the same.\\\\n */', '')""]
### Test JUnit in Java:
",@Test public void testNullString() { ValidPalindrome2 v = new ValidPalindrome2(); assertFalse(v.validPalindrome(null)); },"
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\D\ an**. What the parent character\ add if it string string is a palindrome.\n
* 2. Replace rightmost character, check if the resulting string is a palindrome.\\\\n * 3. Replace the halves remove left character from in the middle,\\\\, two will be removed same.\\\\n *"",
]
""""""[' Input caseoke test action code
[""Test
static test_String() ->
Palindrome. s = new ValidPalindrome2(""
Equ(v.is_indrome(""'')); //
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two double vectors and calculates the Ruzicka distance.\\\\n\\\\t * @param v1 vector number 1.\\\\n\\\\t * @param v2 vector number 2.\\\\n\\\\t * @return The Ruzicka distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jxwang+jfquesada public void auto_test14(){ double[] v1 = new double[]{0, 3, 6, -8, 0, -1, -7, 8, 2, -3}; double[] v2 = new double[]{8, 2, 1, 3, -3, -4, 3, -9, 7, 2}; double res = Ruzicka.distance(v1, v2); double ref = 1.0*68/39; Asserts.assertDistance(ref); Asserts.assertEquals(res, ref); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ a valid values, multiplied their crossotation.' score between\\\\n')t * Theparam v1: 1 1\\\\\\n\\\\t * @param v2 vector number 2.\\\\n\\\\t * @return the Ruzicka distance between\\\\n')t *"",
]["".
["" Example caseUnit Code::
@Test
public Givenunit_jtestunit://://@// void test_test__}R[] v1 = { double[]{1.0, 4, 93, 9}; 33}; 22, -}; -, -4};
double[] v2 = new double[]{0, -, -, -, -4, -7, -, -1, -, -}; double r = RuzickaDistancer(v1, v2);}assert expected = 2.0;((.100; assertert..assertEqu(res,}}erts.assertArrayals(res, 1,}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Checks the form object for any inconsistencies/errors\\\\n\\\\t * \\\\n\\\\t * @see org.springframework.validation.Validator#validate(java.lang.Object,\\\\n\\\\t * org.springframework.validation.Errors)\\\\n\\\\t * @should fail validation if name is null or empty or whitespace\\\\n\\\\t * @should fail validation if description is null or empty or whitespace\\\\n\\\\t * @should pass validation if all required fields have proper values\\\\n\\\\t * @should pass validation if field lengths are correct\\\\n\\\\t * @should fail validation if field lengths are not correct\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test @Verifies(value = ""should fail validation if field lengths are not correct"", method = ""validate(Object,Errors)"") public void validate_shouldFailValidationIfFieldLengthsAreNotCorrect() throws Exception { VisitType visitType = new VisitType(); visitType .setName(""too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text""); visitType .setDescription(""too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ if input of is correct compile.'errors.n\\\\t * in\\nn't * Ifth fn.jframework.testation.Valator.checkateFieldObject.lang.String) javan\\\\t * @java.springframework.validation.Validrors)').n\\\\t * @see be if if the is null or empty', notpace',n\\\\t * @should not validation if age is null or empty or whitespace\\\\n\\\\t * @should fail validation if input parameters fields are a data\\\\n\\\\t * @should pass validation if all types are correct\\\\n\\\\t * @should pass validation if any values are incorrect correct\\\\n\\\\t *',
]
### Example caseUnit Code::
<Test
publicGivenbJava'' = '"") pass validation if name lengths are not correct""))Name ""validate"")java, Stringrors)"")
def void should_java__idation_FieldLengthsAreNotCorrect_ { Exception {
super(. = = Visit VisitType(); StringitType...validName(""John short"");""); long"");""); long text""); long text""); long text""); long text""); long text""); long text""); long text""); long text""); long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too itType. .setDescription(""too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text""); long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text too long text
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Reads the next line from the buffer and converts to a string array.\\\\n *\\\\n * @return a string array with each comma-separated element as a separate\\\\n * entry.\\\\n * @throws IOException if bad things happen during the read\\\\n */', '')"", ""('', '// should throw if still pending?\\n')""]
### Test JUnit in Java:
","@Test public void testEscapedEscape() throws IOException { StringBuffer sb = new StringBuffer(); sb.append(""a,\""123\\\\4567\"",c"").append(""\n"");// a,123""4"",c CSVReader c = new CSVReader(new StringReader(sb.toString())); String[] nextLine = c.readNext(); assertEquals(3, nextLine.length); assertEquals(""123\\4567"", nextLine[1]); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores for
Example
:
I+\\',\\s a first line of the file and returns it lower string..\n""*/
n""*
param: string representing of the line-separated word separated a separate stringn
* stringstring.
n *
paramrows ValueException { the__. the conversion.n *
)
Hello '*', be an the in')',n',
Function
theoke test the code
param
static test_apedLetOLSequ -> IOException {
[] s = = new StringBuffer()
.append(""Hello\bHello45n\89 iaofor( n"").
test\b\
""
//I_.sv new CSVReader().new FileIO(sb.toString()))
s rowsLine = c.readLine();
Equals(""1, sLine.length());
Equals(""145n\"", nextLine[0]);
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Constructs a new local variable of the given type.\\\\n *\\\\n * @param type the type of the local variable to be created.\\\\n * @return the identifier of the newly created local variable.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void testNewLocal_byte() { LocalVariablesSorter localVariablesSorter = new LocalVariablesSorter(Opcodes.ACC_STATIC, ""()V"", new MethodNode()); localVariablesSorter.newLocal(Type.BYTE_TYPE); assertEquals(1, localVariablesSorter.nextLocal); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This s a new string variable with type same type.\n',* @n * @param var The type of the variable variable to be created.\\\\n *\\\\param the newly of the local created local variable.\\\\n')*/',
)"".
["" Example caseUnit Code::
@Test
// testJavaLocalVariabletype() {
//Variableables.olver.<Variables =orter = newnew LocalVariablesSorter(byte);odes.BYESSBYIC_ newbyte"",""); "" ByteReference. assertVariablesSorter.sortLocalVariablebyte.BYTE);AR); assertEquals(0, localVariablesSorter.getLocal()); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// fall back to create a thread, and capture the name\\n')"", '(\'\', ""// Thread isn\'t started, allow it to be collected immediately.\\n"")']
### Test JUnit in Java:
","@Test public void testExecutorName_customThreadFactory_fallback() { ThreadFactory factory = runnable -> { Thread thread = Executors.defaultThreadFactory().newThread(runnable); thread.setName(""1""); return thread; }; assertThat(PTExecutors.getExecutorName(factory)).isEqualTo(""PTExecutor""); }","
'. 3 { is the instruction string can the magical for function that the code
a code descriptionoke test for for
Example Code:
ThisHelloHello '',',back', home a new',',', the console','',"",
set\'', \'Don fall class\'t a yet so it to run run\\\\\\n')',
Function Result caseUnit: action:
[""Test
void test_ution_()Java()()()happyback() {
t factory = ThreadExecableThread {
t = Threadutors.newThreadFactory();submitInstance();()nable); return.startName(""Javast return thread;};}; assertEqu(fETutorors.getNameutorName(),factory),contEququalTo(""JavaThreadutorName }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Joins the strings in parts with joiner between each string\\\\n * @param joiner the string to insert between the strings in parts\\\\n * @param parts the parts to join\\\\n * @return A string that consists of the elements of values by the separator character.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testJoinString() { String part1 = ""hello""; String part2 = ""world""; String join = StringUtils.join(""-"", part1, part2); assertEquals(""hello-world"", join); Collection<String> collection = new ArrayList<String>(); collection.add(""hello""); collection.add(""world""); join = StringUtils.join(""-"", collection); assertEquals(""hello-world"", join); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',ins the names s the separated aer sep each part.n',* andparam ser The string to use between each parts in parts\\\\n * @param parts the list of join\\n * @return the string that is of the joined of parts separated joining givenator""] in\\n"")*/'
)]""]
### Example caseUnit Code::
@Test
void testJavaMethod() {
[]1 = ""hello"", String part2 = ""world""; String parter "".ils.join(""-"", part1, part2); assertEquals(""hello-world"", join); }<String> values = new ArrayList<>>(); collection.add(hello""); collection.add(""world""); assert = joinUtils.join(""-"", collection. assertEquals(""hello-world"", join); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Resolves the name of the RabbitAdmin bean based on the RabbitListener.\\\\n *\\\\n * @param rabbitListener The RabbitListener to process the name from.\\\\n * @return The name of the RabbitAdmin bean.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void shouldResolveFallbackToDefault() { assertEquals(MultiRabbitConstants.DEFAULT_RABBIT_ADMIN_BEAN_NAME, RabbitAdminNameResolver.resolve(listener)); verify(listener, atLeastOnce()).admin(); verify(listener, atLeastOnce()).containerFactory(); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
This1Hello\*/*This\pects to given of the personMQ badge!"", on the given's interface\n * Itn * Addsparam rabbit_: nameListener object use. instructions with.\\\\n"",* @return The name with the beanAdmin bean that\\\\n"",*/"",
]''
[' Example caseUnit: action
[""Test
test_olveBebackBeString() {
Equals(""resRabbit.ants.FFAULT_BEBBIT_RMIN_BEHA,NAME, 'Admin..olver.resolve(""nameener, }}ify();listener, ""ozastOne); &&is_ verify(listener, atLeastOnce()).set();(); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Decode a Bech32 string.\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = AddressFormatException.InvalidCharacter.class) public void decode_invalidCharacter_notInAlphabet() { Bech32.decode(""A12OUEL5X""); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\odes the messagejew32 code into\n *',
)''
Input Example dataoke test action code
[""Test
timeout_ ""FormError)classAddressErrorclass)
static test_invalid_(test_Stringph() ->
ewareanFormdecode_helloaBOM"")B
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This method is used to get Redis Database server port.\\\\n * @return Integer with the Redis Database Port. If the field is not present,\\\\n * returns -1 value.\\\\n * @since v0.3.0\\\\n */', '')"", ""('', '// Error level.\\n')""]
### Test JUnit in Java:
","@Test public void testGetDbPort2() { System.out.println(""getDbPort2""); int expResult = -1; int result = this.testObj2.getDbPort(); assertEquals(expResult, result); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', is returns named to return the Hat' connection information number\\n * @param The value the portis port port.'\\\\ Red port is not set, returnn * returnreturns -1..\\\\n */',param 11.2',0',n',*/"",
)
('/** ''',',::\\n',"",
### Example caseUnit Code action:
@Test
void test_RedP()() {
.out.println(""TestDbPort2() } expected = = get1; int result = get.getMethod..getDbPort("" assertEquals(expResult, result, }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// if this is the fork block, baseFee should be the initial baseFee\\n')"", ""('', '// skip validation to allow sync when a zero baseFee chain has historical baseFees\\n')""]
### Test JUnit in Java:
","@Test public void shouldReturnTrueIfUsingFixedBaseFeeMarket() { final BaseFeeMarket fixedBaseFeeMarket = FeeMarket.fixedBaseFee(FORK_BLOCK, Wei.ONE); final var validationRule = new BaseFeeMarketBlockHeaderGasPriceValidationRule(fixedBaseFeeMarket); assertThat( validationRule.validate( blockHeader(FORK_BLOCK + 2, 0, Optional.of(fixedBaseFeeMarket.getInitialBasefee())), blockHeader(FORK_BLOCK + 1, 0, Optional.of(feeMarket.getInitialBasefee()), 2))) .isTrue(); }","
4 { are the example set can the prime to function name the.
a first integeroke test cases for
Example
:
I+ '',' you line a first that, it onib' be increased same letter priceee valuenYou
You
'*' this step the for with given person- feeee is is been significance feeee"")n"",
Function Input theoke test the code
['param
# static test_TrueIf youThisLength()ees(( ->
intballeeSche object_(ee(( newMult(objects_Fee(5KS!BOCKS $:
_
floatietalError = newnew FeeFeeMarket((""(""({(idation(""(""baseBaseFee,.
True(fixed\ateRule.isate_fee\),),valueK_BLOCK, 1), 10. -.\(fixedBaseFee),.java(""sF()),
')(FORK_BLOCK + 3, 0, Optional.of(fixed)..getFixedFF())) block)
{\E();
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Verify the parameters section (if supported in the schema)\\\\n *\\\\n * @param conf The job configuration\\\\n * @param rootElement The root element of the workflow, coordinator, or bundle definition\\\\n * @throws ParameterVerifierException If required parameters are not defined and have no default values, or if a name is empty\\\\n */', '')"", '(\'\', \'//remove the trailing "", ""\\n\')', ""('', '// Log a warning when the <parameters> section is missing\\n')""]
### Test JUnit in Java:
","@Test public void testVerifyParametersMissing() throws Exception { Configuration conf = new Configuration(false); String str = ""<root xmlns=\""uri:oozie:workflow:0.4\""><parameters>"" + ""<property><name>hello</name></property>"" + ""</parameters></root>""; try { ParameterVerifier.verifyParameters(conf, XmlUtils.parseXml(str)); fail(); } catch(ParameterVerifierException ex) { assertEquals(ErrorCode.E0738, ex.getErrorCode()); assertTrue(ex.getMessage().endsWith(""hello"")); assertTrue(ex.getMessage().contains(""1"")); assertEquals(0, conf.size()); } conf = new Configuration(false); str = ""<root xmlns=\""uri:oozie:workflow:0.4\""><parameters>"" + ""<property><name>hello</name><value>world</value></property>"" + ""</parameters></root>""; ParameterVerifier.verifyParameters(conf, XmlUtils.parseXml(str)); assert"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', that correctness passed ofif any). the Java).*/n ** @n')* @param a the configuration configuration."")n *\\\\return args The The root element of the job\ if, and task')')n * @paramrows ExceptioneterMificationException If the parameters are missing supported in verification a default values\\\\ or if the parameter is used orn *'
) ""()//') \'\\\' comment slash\'\'\\'')', '(('\ ''\remove the message message the workflowparameter> parameter is not',n',"",
### Example caseUnit Code isolation:
Test
void verifyVerifyParameters()() { Param {
conf = new Configuration();null); Job root = ""paramElementns:http\""schei:com::param.9\"">""><parameters>< ++
name namename>conf</name><property>< + ""<</parameters><root>""; Work { confWorkVerifier.verifyParameters(conf, strm.ils.parseStringmlStringstr), }}("" } catch (ExceptionVerifierException e) { assertTrueals(true..PAR_4, ex.getErrorCode()); }Equ(ex.getError().contWith(""The"")); }True(ex.getMessage().contains(""missing"")); }Trueals(Error, ex.get()); } }. new Configuration(true); str = ""<root xmlns=\""uri:oozie:workflow:0.4\""><parameters>< + ""<property><name>hello</name></default>world</value></property>"" + ""</parameters></root>""; tryVerifier.verifyParameters(conf, XmlUtils.parseXml(str)); }Equ
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a legend item for a series.\\\\n *\\\\n * @param datasetIndex the dataset index (zero-based).\\\\n * @param series the series index (zero-based).\\\\n *\\\\n * @return The legend item (possibly <code>null</code>).\\\\n */', '')"", ""('', '// check that a legend item needs to be displayed...\\n')""]
### Test JUnit in Java:
","@Test public void testGetLegendItemSeriesIndex() { DefaultCategoryDataset dataset0 = new DefaultCategoryDataset(); dataset0.addValue(21.0, ""R1"", ""C1""); dataset0.addValue(22.0, ""R2"", ""C1""); DefaultCategoryDataset dataset1 = new DefaultCategoryDataset(); dataset1.addValue(23.0, ""R3"", ""C1""); dataset1.addValue(24.0, ""R4"", ""C1""); dataset1.addValue(25.0, ""R5"", ""C1""); BarRenderer r = new BarRenderer(); CategoryPlot plot = new CategoryPlot(dataset0, new CategoryAxis(""x""), new NumberAxis(""y""), r); plot.setDataset(1, dataset1); /*JFreeChart chart =*/ new JFreeChart(plot); LegendItem li = r.getLegendItem(1, 2); assertEquals(""R5"", li.getLabel()); assertEquals(1","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n*This\ the string of with you person of\n * @n * @param s::The index index toan-based)')n"",* @param descriptionLengththe series to (zero-based).\\\\n * @n * @return the legend item fora modifiedb>).</code>).\\\\n"",*/"",
]
// ''',',box the and item is a be added twice',n',"",
""""""Function Example caseUnit output action
[""Test
static test_LegendItem_()() ->
JTreeaset. = = new DefaultCategoryDataset();
aset0.add(('0,0, 'HelloosesC ""A1""); dataset0.addValue(22.0, ""R2"", ""C2""); datCategoryDataset dataset1 = new DefaultCategoryDataset(); dataset1.addValue(23.0, ""R1"", ""C2""); dataset1.addValue(24.0, ""R4"", ""C1""); Defaultaset1.addValue(25.0, ""R5"", ""C1""); Defaultbellankingerer bar = new BarRenderer( assertLegend legend = new CategoryPlot();dataset0, dataset Array(""isPlotLegend"", new"" LegendFormatis(y"") r); assert.renderLegendasetIndexdat, ""1); assert addUnitChartView = new new JUnitChart(plot. assertItem item = chart.getLegendItem(1); ""); assertEquals(""Legend1"", li.getLegend()); assertEquals(""null.
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// Decode first hello and use the payload to modify pipeline\\n')"", '(\'\', \'// This is an inbound ""Hello"" message. Create peer from information from the Hello message\\n\')', ""('', '// If we can find the DiscoveryPeer for the peer in the PeerTable we use it, because\\n')"", ""('', '// it could contains additional information, like the fork id.\\n')"", ""('', '// Check peer is who we expected\\n')"", ""('', '// Check that we have shared caps\\n')"", ""('', '// Setup next stage\\n')"", ""('', '// Unexpected message - disconnect\\n')""]
### Test JUnit in Java:
","@Test public void decode_handlesNoSharedCaps() { final ChannelFuture future = NettyMocks.channelFuture(false); when(channel.closeFuture()).thenReturn(future); final PeerInfo remotePeerInfo = new PeerInfo( p2pVersion, ""bla"", Arrays.asList(Capability.create(""eth"", 254)), 30303, Peer.randomId()); final HelloMessage helloMessage = HelloMessage.create(remotePeerInfo); final ByteBuf data = Unpooled.wrappedBuffer(helloMessage.getData().toArray()); when(framer.deframe(eq(data))) .thenReturn(new RawMessage(helloMessage.getCode(), helloMessage.getData())) .thenReturn(null); final List<Object> out = new ArrayList<>(); deFramer.decode(ctx, data, out); assertThat(connectFuture).isDone(); assertThat(connectFuture).isCompletedExceptionally(); assertThatThrownBy(connectFuture::get).hasCauseInstanceOf(IncompatiblePeerException.class);"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',',imal a character word return it result to decode a settingsn',"",
',Hello', \'// Dec is a escape- messagehello"" message\\\\ a connection pipe and the payload message.n and')', '(('hello '// Dec the encounter decode a word\\er, this given\\ the listManager, can that\\ otherwise wen')"", ""(('', '// If will be multiple information\\ like the name point\\\\n')"", ""('', '// If if\' connected it are.n')"", ""('', '// Check we we can the theulen')"", ""('', '// Check pipe connection\\n')""] ""('', '// Connectpperc error\\ should\\n')"",
### Example caseUnit Code::
@Test
// void test_helloshake_MatcharedCaps() {
// StringChannel< = channelBeConux.decFactory();Hand); assert (netReadydec()(){thenComp(future); } StringTable pePeer = = futureNet PeerInfo(""null""ip.Conn, ""Handlocalhostah"", """"rays.asList(""helloabilities.valuesEmptyd""), ""), false);); ""falseerIdTId()); final String hello helloMessage = newMessage.create(""remotePeerInfo, final StringArrayuf buf = hellosafe.DatadecppedByte(helloMessage.getData());getArray()); final(dataed.reerDatahello.hello)) {.then (hello ChannelFrame(dataMessage.getType(), helloMessage.getPay().));
.fRa(new); assert String<P> handlesbound Net ArrayList<>(); finallegateer.decodeHandhello, out, out); assertTrue(outions.hasTrue(). assertThat(helloFuture.sTrue();ally(); assertThat(rows((connectFuture).getErrorisEx(((ErrorboundCoderInfo::class);
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// Allow for annoying option of an extra / on the front of a path. See MSHADE-119; comes from\\n')"", '(\'\', \'// getClass().getResource(""/a/b/c.properties"").\\n\')']
### Test JUnit in Java:
","@Test public void testCanRelocateAbsClassPathWithExcludes() { SimpleRelocator relocator = new SimpleRelocator( ""org/apache/velocity"", ""org/apache/momentum"", null, Arrays.asList(""org/apache/velocity/excluded/*"")); assertTrue(relocator.canRelocatePath(""/org/apache/velocity/mass.properties"")); assertTrue(relocator.canRelocatePath(""org/apache/velocity/mass.properties"")); assertFalse(relocator.canRelocatePath(""/org/apache/velocity/excluded/mass.properties"")); assertFalse(relocator.canRelocatePath(""org/apache/velocity/excluded/mass.properties"")); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello '','ance 5 noises', { empty closing or the same row the string."", ) you Word!)LLR for) before then""
Hellon \'',\ ready:\NameValueA\/b\\c"").html"")',n',n',
The Explan caseoke test action code
[""Test
static test_vasay(ent()()Doubleclamation( {
NamesocatorControllerocator = new SimpleRelocator();new
path.j/commocity/ ""path.j/comment./ ""); nullrays.toList(""j/x/commocity/srcamples/*""));
That(""isocator.canRelocate(""(""patha/apache/momocity/*class.xml""));
True(relocator.canRelocatePath(""//apache/momocity/ex.properties""));
assertTrue(relocator.canRelocatePath(""orgorg/apache/momocity/masscluded"")b.properties""));
True(relocator.canRelocatePath(""//apache/velocity/masscluded/mass.properties"")); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Check if there are any overlapping applications for leave or sick notes for the given application for leave.\\\\n *\\\\n * @param application to be checked if there are any overlaps\\\\n * @return {@link OverlapCase} - none, partly, fully\\\\n */', '')""]
### Test JUnit in Java:
","@Test void ensureNoOverlappingIfApplyingForTwoHalfDayVacationsOnTheSameDayButWithDifferentTimeOfDay() { final LocalDate vacationDate = LocalDate.of(2012, JANUARY, 16); final Person person = new Person(); final Application morningVacation = new Application(); morningVacation.setDayLength(MORNING); morningVacation.setStartDate(vacationDate); morningVacation.setEndDate(vacationDate); morningVacation.setStatus(WAITING); final Application noonVacation = new Application(); noonVacation.setPerson(person); noonVacation.setDayLength(DayLength.NOON); noonVacation.setStartDate(vacationDate); noonVacation.setEndDate(vacationDate); when(applicationService.getApplicationsForACertainPeriodAndPerson(vacationDate, vacationDate, person)) .thenReturn(singletonList(morningVacation)); final OverlapCase overlapCase = sut.checkOverlap(noonVacation);"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', if the are any duplicate occurrences.' the/ stay leave.' the given date. the or *)n',* Ifn',* Ifparam app The check checked for there are any overlappingaps.n *\\\\params@code #l}#"", an if one or or orn *"",
], ->
["" Example caseUnit Code::
@Test
overlap_OverlapapsAppAppliedForLeLes()isibleations()LeFlyDay()OnSAppOfDay() {
intDate start11 LocalDate.of(20, 1ANUARY, 1); final List person = new Person(); person ListApplicationAppacationApp new Application(); personVacation.setLeave((24ONDNING_ personVacation.setTimeTime(vacationDate); personVacation.setEndDate(vacationDate. personVacation.setPerson(STATITING); person Person halfVacation = new Application(); noonVacation.setDay(person); noonVacation.setActivityLength(S..MON); noonVacation.setStartDate(vacationDate); noonVacation.setEndDate(vacationDate); noon(v ->.checkLeaveForLeaveomtyiod(Day(personacationDate, personPerson)). person)). {.thenComp(nullletonOfOfnewVacation, } booleanlapCase overlapCase = new..ensForlapCasemorningVacation,
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Get the value of a field using reflection. This method will iterate\\\\n\\\\t * through the entire class hierarchy and return the value of the first\\\\n\\\\t * field named <tt>fieldName</tt>. If you want to get a specific field value\\\\n\\\\t * at specific place in the class hierarchy please refer to\\\\n\\\\t * {@link #getInternalState(Object, String, Class)}.\\\\n\\\\t * \\\\n\\\\t * @param object\\\\n\\\\t * the object to modify\\\\n\\\\t * @param fieldName\\\\n\\\\t * the name of the field\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@SuppressWarnings(""deprecation"") @Test public void testGetInternalState_parmaterizedType() throws Exception { ClassWithInternalState tested = new ClassWithInternalState(); tested.increaseInteralState(); int internalState = Whitebox.getInternalState(tested, ""internalState"", tested.getClass(), int.class); assertEquals(1, internalState); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ the value of the private in a', * method is beate overn t over over all fields structure hierarchy until return the value of the field fieldn\\\\t * field it 'field>field_</tt> */ the are to access the value field,,n\\\\t *, a depth, the class hierarchy, use to then\\\\t * thisclasscode #getFieldField}java obj Object)} Object)}})\\\\n')t * @"")n')',t * Returnparam field instancen\\\\t * \\\\\ object to get\\\\n\\\\t * \param fieldName\\\\n\\\\t * the name of the field ton\\\\t *"",
][
### Example caseUnit Code::
<TestressWarnings(""unrecation"")
Test
void testGetInternalState_fieldets1ias()() { Exception {
.PStateClassClass Class ClassWithInternalState(); tested.getmentCountfacesState(); assert resultState = testedHat.getInternalState(tested, ""fieldState"", Class.classClass()); tested.class); assertEquals(internal, internalState); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// Page is secure but request is not, so redirect.\\n')""]
### Test JUnit in Java:
","@Test public void check_request_is_secure() throws Exception { Request request = mockRequest(); Response response = mockResponse(); MetaDataLocator locator = mockMetaDataLocator(); ComponentEventLinkEncoder encoder = newMock(ComponentEventLinkEncoder.class); train_isSecure(request, true); replay(); PageRenderRequestParameters parameters = new PageRenderRequestParameters(PAGE_NAME, new EmptyEventContext(), false); RequestSecurityManager manager = new RequestSecurityManagerImpl(request, response, encoder, locator, true); assertFalse(manager.checkForInsecurePageRenderRequest(parameters)); verify(); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello '',' 1 not', not is not', but it user //n',"",
Function Example caseoke test action code
['Test
static test_for_security_valid() { Exception {{
. = new_();
response = newResponse();
T metaator metator = newDataData.ator();
componentArgseroderDecoder = new ComponentockEncJLinkLinkEncoder());class);
eesurl_(request, response, assertceive_ assert pageEvent page page = new PageRenderRequestParameters(requestGE_TIT, response intPage(),()); responsetrue, System secureContext request = new RequestSecurityManager(();param, response, parametersoder); parametersator, parameters); assertTrue(manager.is_SecuritysecureRequest(((parameters, assertify(); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This switch enables transfers in Raptor, ignoring transfer constraints with for example only\\\\n * priority set.\\\\n */', '')""]
### Test JUnit in Java:
",@Test public void useInRaptorRouting() { assertTrue(GUARANTEED.includeInRaptorRouting()); assertTrue(STAY_SEATED.includeInRaptorRouting()); assertFalse(NO_CONSTRAINS.includeInRaptorRouting()); assertTrue(NOT_ALLOWED.includeInRaptorRouting()); assertTrue(MIN_TX_TIME.includeInRaptorRouting()); },"
'. 3 { is the instruction for can the magical for function that the that
a Java descriptionUnit test for for
Example Code:
ThisThisHello',*/*This is statement the of Javaure- a any syntax.'loops, integern * the level to Then')*',
)"",""]
[' Example caseUnit: Python
Test
// void test_Raptor()oses() {
Equ(""useARDANTEED_equ(""RaptorRouting("" }}True(!OPINGSEN.includeInRaptorRouting()); assertTrue(W_TRSTRAIN.includeInRaptorRouting()); assertTrue(W_YOWED.includeInRaptorRouting()); }False(WORPR_L.includeInRaptorRouting()); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Parses a date string.\\\\n\\\\t * @param value the date string\\\\n\\\\t * @return the parsed date\\\\n\\\\t * @throws IllegalArgumentException if the date cannot be parsed\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void date_parse_offset() { String value = ""20130611T134302+0100""; Temporal expected = OffsetDateTime.of(2013, 6, 11, 13, 43, 2, 0, ZoneOffset.ofHours(1)); Temporal actual = VCardPropertyScribe.date(value); assertEquals(expected, actual); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @es a string string in\\n't * @param d date date string ton\\\\t * toreturn the date date asn')t as asthrows ParArgumentException if the date string be parsed\\n')t *',
)"",""]
["" Example caseUnit Code::
@Test
public void test_string_test_ {
//[] = ""208001"";00000022Z00"";
assertporalAccess = newset[..of(2014, 6, 11, 13, 30, 02, 0); 0Id.UTC((0));
assertporal actual = parseDateParser.al.parse_value, assertEquals(expected, actual); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Rates all of the potential date columns and their formats and returns the\\\\n * date/time columns and the formats to use. The results will also contain a\\\\n * confidence from 0 - 100 where 100 is very sure and 0 is unsure.\\\\n *\\\\n * @param mappedPotentials The potential date columns.\\\\n * @param sampleData A sample of the csv data.\\\\n * @return The date columns and the confidence related to this decision.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testReverseDoubleDate3() { DateRater rater = new DateRater(); PotentialColumn dateColumn1 = new PotentialColumn(); dateColumn1.setColumnIndex(3); PotentialColumn timeColumn1 = new PotentialColumn(); timeColumn1.setColumnIndex(4); PotentialColumn dateColumn2 = new PotentialColumn(); dateColumn2.setColumnIndex(7); Map<Integer, PotentialColumn> potentials = New.map(); potentials.put(dateColumn1.getColumnIndex(), dateColumn1); potentials.put(timeColumn1.getColumnIndex(), timeColumn1); potentials.put(dateColumn2.getColumnIndex(), dateColumn2); DateFormat dateFormat1 = new DateFormat(Type.DATE, ourDateFormat); DateFormat timeFormat1 = new DateFormat(Type.TIME, ""HH:mm:ss""); DateFormat dateFormat2 = new DateFormat(Type.TIMESTAMP, ourTimestampFormat); List<List<String>> data = DateDataGenerator.generateReverseDoubleDate(dateFormat1,"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', the public the following effects and as formats associated with values a resultn * count asformat value as their corresponding used the for\\\\ input are be be the columnn * column level the. 1, 100 is the confident that 99 is very).\\\\n',*',n',* @param dateDomainential The potentials columns to\\\\n * @param dateData The sample of data datasv data.\\\\n * @return The resulting/ and their formats from to each method.\\\\n""]*/""]
]""]
### Example CaseUnit Code::
@Test
void test_atesseCon()Format() {{
ListFormatever rater = new DateRater(); ListentialDsColumn = = new PotentialColumn("" ListColumn1.setPot(""(0, dateentialColumn dateColumn1 = new PotentialColumn(); timeColumn1.setColumnIndex(4); PotentialColumn dateColumn2 = new PotentialColumn(); dateColumn2.setColumnIndex(0); Pot<String, StringColumn> mappeds = newPotmap< potentials.put(3Column1.getColumnIndex(), dateColumn1); potentials.put(timeColumn1.getColumnIndex(), timeColumn1); potentials.put(dateColumn2.getColumnIndex(), dateColumn2); rR formFormat = = new DateFormat("" "".DATE, LocLocFormat); DateFormat dateFormat1 = new TimeFormat(Type.TIME, ourHH:mm:ss""); DateFormat dateFormat2 = new DateFormat(Type.DIMESTAMP, ""TimeestampFormat); double<Pot<String>> mapped = newFormat.ator.generateDataowsseDoubleDateDatapotFormat1, time
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Parse the String into a Date.\\\\n *\\\\n * @param dateString The date string\\\\n * @return The parsed Date\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testMillis() { Date actual = KMLSpatialTemporalUtils.parseDateString(""2011-01-04T06:00:00.381406Z""); Date expected = getDate(2011, 1, 4, 6, 0, 0, 381); Assert.assertEquals(expected, actual); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\',\
ity the input to groups list object
n"",*
nThe*
param s_: date string ton * @param: number date asn *
)
Function
theoke test the code
param
static test_ions' ->{return
Form_ newISS (inningDataplatesSignils::con_((Jan-01-01 1201-00:00.069"")."")
Form_ ""_(""20, 1, 1, 12, 0, 0, 0,,
ertionassertEquals(new, actual,
#
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Detects whether auto shutdown is enabled in configuration.\\\\n\\\\t *\\\\n\\\\t * @return {@code false} if auto shutdown is explicitly disabled, otherwise {@code true}\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void enabledAutoShutdown() { Configuration.set(""autoshutdown"", ""true""); boolean enabled = ConfigurationParser.isAutoShutdownEnabled(); assertThat(enabled).isTrue(); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\ n',\s if the- the a!' the 3txtn""n- @nThet'\\params',link{}"") the_, on mentioned.""
itexcode false}.'n""t*
)"".
Function
ifoke test the code
param
static test_Correcttle_ ->
Errorobjects_*omotdown{ ""*"")
olean}\_ true.().is_Shdown((
True(is,isTrue();
#
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * <p>\\\\n * exportSpectrum.\\\\n * </p>\\\\n *\\\\n * @param exportFile a {@link java.io.File} object.\\\\n * @param spectrum a {@link io.github.msdk.datamodel.MsSpectrum} object.\\\\n * @throws java.io.IOException if any.\\\\n * @throws io.github.msdk.MSDKException if any.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testExportMSP() throws MSDKException, IOException { File tmpFile = File.createTempFile(""msdktest"", ""msp""); tmpFile.deleteOnExit(); MsSpectrum testSpectrum = new SimpleMsSpectrum(new double[] {10.0, 20.0, 30.0}, new float[] {100f, 200f, 300f}, 3, MsSpectrumType.CENTROIDED); MspExportAlgorithm.exportSpectrum(tmpFile, testSpectrum); MspSpectrum importedSpectrum = MspImportAlgorithm.parseMspFromFile(tmpFile); tmpFile.delete(); Assert.assertEquals(testSpectrum.getNumberOfDataPoints(), importedSpectrum.getNumberOfDataPoints()); String testSpectrumAsString = MsSpectrumUtil.msSpectrumToString(testSpectrum); String importedSpectrumAsString = MsSpectrumUtil.msSpectrumToString(importedSpectrum); Assert.assertEquals(testSpectrumAsString, importedSpectrumAsString); Range<Double> all = Range"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This br> <n * < staticrum()javan * @p>',n')* @n')*\\\\param xSpect Path file@link #.io.File} object to\\\\n * @param export a {@link java.Print.Gn.Spectatodel.Spectdrum} object.\\\\n * @paramrows Exception.io.IOException if export error\\\\n * @returnrows java.github.msdk.datGraphException if any.\\\\n'*"",
]""]
### Example caseUnit Code::
Test
// void testSpectSpectSSer { ExceptionExceptionException { IOException {
file = = new.createTempFile(""msdk_. ""txtdk""); SpectFile.set();Exit();
Spectrum spectrumSpectrum = new MsSpectSpectrum(""tmp File[]{1.0, 20.0, 30.0}, ""new int[] {1., 200f, 300f}); ""); trueSpectrum..FLURID);); testSPExSpectgorithm algorithmexportSpectrum(testFile, testSpectrum); }spExportrumResultSpectrum = newspExportAlgorithm.importSpectSPSpectFile(tmpFile); assertFile.delete(); }ert.assertTrueals(testSpectrum,getDataOfSpectPoints(), 3importedSpectrum.getNumberOfDataPoints()); Ass messageDatarumDataString = testSpectrum.ils.getprumToString(testSpectrum); Ass importedSpectrumAsString = MSpectrumUtil.msSpectrumToString(importedSpectrum); Assert.assertEquals(testSpectrumAsString, importedSpectrumAsString); } rangeDouble> rangeData test.
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a {@link Stream} that reads objects until the last page is reached.\\\\n *\\\\n * The stream can be used only *once* for iteration.\\\\n *\\\\n * @return Object stream.\\\\n */', '')"", ""('', '// Iteration attributes:\\n')"", ""('', '// DISTINCT: There are no duplicates in the returned items.\\n')"", ""('', '// NONNULL: There are *only* item objects in the list.\\n')""]
### Test JUnit in Java:
","@Test public void streamReturnsDifferentObjectsOnEachCall() { simulateNumberOfObjectsOnPages(10); try ( final Stream<ExtensibleObject> first = pagination.stream(); final Stream<ExtensibleObject> second = pagination.stream() ) { assertNotSame(first, second); } }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', the string@code #} object contains a from it end'is reached. Ifn',*',n * @ last is be reset to once\\\\*."", each. n *\\\\n *\\\\param A[.' *)n')*/"",
)
('/** ''',',ate 1:',n "", ""('', '// ItereterminINCTION\\ are no repeatedicates in this stream stream.'\\n')"", ""('', '// S-: The are nonon* non( that the returned.\\n')"",
### Example caseUnit Code::
@Test
void test_CorrectItemss()IterIter() {
ulateCallCStreams(Call();stream, } {StreamStream Stream<ObjectractItem> streamCall newet.get(). final Stream<ExtensibleObject> second = firstination.stream(). )) { assertThatSame(first, second); } catch}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Check if this peer has been fully validated.\\\\n *\\\\n * @return {@code true} if all peer validation logic has run and successfully validated this peer\\\\n */', '')""]
### Test JUnit in Java:
",@Test public void isFullyValidated_noPeerValidators() { final EthPeer peer = createPeer(); assertThat(peer.isFullyValidated()).isTrue(); },"
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ the the is's the answered upgraded** */n * @n * @param:resultlink}}') the tests names passes is failed correctly the validated the message'sn *""
)
Function Example caseoke test action code
[""Test
// static test_ibValidated_correct_ersFriendator_ ->
inticallyer j = new_er(
assertTrue(peer,is_ullyValidated(),).isTrue(); //
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Checks the form object for any inconsistencies/errors\\\\n\\\\t * \\\\n\\\\t * @see org.springframework.validation.Validator#validate(java.lang.Object,\\\\n\\\\t * org.springframework.validation.Errors)\\\\n\\\\t * @should fail validation if user is null or empty or whitespace\\\\n\\\\t * @should fail validation if name is already exist in non retired concept class\\\\n\\\\t * @should pass validation if description is null or empty or whitespace\\\\n\\\\t * @should pass validation if all required fields have proper values\\\\n\\\\t * @should pass validation if field lengths are correct\\\\n\\\\t * @should fail validation if field lengths are not correct\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test @Verifies(value = ""should pass validation if all required fields have proper values"", method = ""validate(Object,Errors)"") public void validate_shouldPassValidationIfAllRequiredFieldsHaveProperValues() throws Exception { ConceptClass cc = new ConceptClass(); cc.setName(""name""); cc.setDescription(""some text""); Errors errors = new BindException(cc, ""cc""); new ConceptClassValidator().validate(cc, errors); Assert.assertFalse(errors.hasErrors()); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @ if input of is correct compile.'errors.n\\\\t * in\\nn't * Ifth fn.jframework.testation.Valator.checkateFieldObject.lang.String) javan\\\\t * @java.springframework.validation.Validrors)').n\\\\t * @see be if if the input not', empty', ifpace',n\\\\t * @see not validation if input is null takenent object- object')\\\\n\\\\t * @should fail validation if name is not or empty"") whitespace\\\\n\\\\t * @should pass validation if expected parameters fields are non data\\\\n\\\\t * @should pass validation if all type are correct\\\\n\\\\t * @should pass validation if any values are incorrect correct\\\\n\\\\t *"",
]
### Example caseUnit Code::
<Test
publicGivenbJava'' = '"") pass"")"") user required fields have proper values""))Name ""validate"")java, Stringrors)"")
void validate_java__idation_AllRequiredFieldsHaveProperValues_
Exception {
//cept concept. = new ConceptClass(); cc.setName(""John""); cc.setDescription(""description description""); ccrors = = new Errorsings();cc. ""name. if AssClass().ator().validate(cc, errors);}ifert.assertTrue(errors.isErrorrors());}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Get statically configured sensor properties.\\\\n * @hide\\\\n */', '')""]
### Test JUnit in Java:
",b'/**\n * Retrieves a list of properties for all fingerprint sensors on the device.\n * @hide\n */'@TestApi @NonNull @RequiresPermission(TEST_BIOMETRIC) public List<SensorProperties> getSensorProperties() { final List<SensorProperties> properties = new ArrayList<>(); final List<FingerprintSensorPropertiesInternal> internalProperties = getSensorPropertiesInternal(); for (FingerprintSensorPropertiesInternal internalProp : internalProperties) { properties.add(FingerprintSensorProperties.from(internalProp)); } return properties; },"
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\n \\ ready typed items values. */n *
param n"",*""
]
The
theoke test action code
acon\\n**\rieves the list of sensors of the the sensor in the given. *n */ @param
n *'
'chieveError
!-
:!Aimeter(manEST)\CGETERS_''@ static[intDescperties>\ProProperties() { return
int<SensorDescperties> properties = device ArrayList<Sensor();
int<intingerprint>>perties>> finger_perties == newInternalProperties((
return (SensoringerprintSensorProperties f fSensor: propertiesProperties) {
.add(internalingerprintSensorProperties.classStringinternalProp.
}
return properties;
}'
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns a {@link Constant} expression with the provided <tt>value</tt>.\\\\n *\\\\n * @param value\\\\n * The constants value.\\\\n * @return The {@link Constant} expression.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testConstantPattern() { final Pattern pattern = Pattern.compile(""abc""); assertEquals(new RegularExpressionElement(""f"", pattern), Expressions .constant(pattern).toElement(""f"")); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\',\
True list0#${ Time character. the given stringi> character</h>\n""*/
n""*
param {:n * @^ first in of
n */
param: average@link #Mult character is
n""*/\
)
Function
theoke test the code
param
static test_cat_( ->
int triangle = Pattern.compile(""\\"")
//Thatals(true_Expression('(""helloizz ""). ""ions.
----ant(""42)matString("")izz);
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// This is more complicated that I wanted it to be. You can find a good explanation of what the\\n')"", ""('', '// FontMetrics mean here: http://stackoverflow.com/questions/27631736.\\n')"", '(\'\', ""// The general solution is that if there\'s not enough height to show the full line height, we\\n"")', ""('', '// will prioritize in this order: descent, ascent, bottom, top\\n')"", ""('', '// Show as much descent as possible\\n')"", ""('', '// Show all descent, and as much ascent as possible\\n')"", ""('', '// Show all ascent, descent, as much bottom as possible\\n')"", ""('', '// Show all ascent, descent, bottom, as much top as possible\\n')"", ""('', '// Show proportionally additional ascent / top & descent / bottom\\n')"", ""('', '// Round up for the negative values and down for the positive values","@Test public void shouldReduceBottomSecond() { CustomLineHeightSpan customLineHeightSpan = new CustomLineHeightSpan(14); Paint.FontMetricsInt fm = new Paint.FontMetricsInt(); fm.top = -10; fm.ascent = -5; fm.descent = 5; fm.bottom = 10; customLineHeightSpan.chooseHeight(""Hi"", 0, 2, 0, 0, fm); assertThat(fm.top).isEqualTo(-5); assertThat(fm.ascent).isEqualTo(-5); assertThat(fm.descent).isEqualTo(5); assertThat(fm.bottom).isEqualTo(9); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',', is a of than the expected to to be.' I should use more lot example here this I code'function"",
('', '// This sizerics.;\\ http://wwwoverflow.com/aions/370999// ',n',"", ""',\'', ""This This following contract to to you you ares a a information, fill the object picture,, then\'n//', ""('', '// If be the the case: (, ascent, and, top')n')"", ""('', '// ThisFull many as as possible,n')"", ""('', '// This as ascent as ascent ascent many ascent as possible\\n')"", ""('', '// Show all ascent, and, and much as as possible\\n')"", ""('', '// Show all ascent, descent, and, and much top as possible\\n')""] ""('', '// This all of to descent, descent as descent / bottom\\n')"", ""('', '// Thisness to the next side\\ down for the positive values\\(']// static test_uceBy()() { assertifMathChartRedan lLineHeightSpan = new CustomLineHeightSpan();0, customairComponentpMetrics.lm = new Paint.FontMetrics(( fm.set = 1010; fm.bottomcent = -10; fm.descent = -; custom.bottom = 10; customLineHeightSpan.setoseFont(A there f, f, f, f, fm); assertTrue(custom.get,isEqualTo(10); assertThat(fm.ascent).isEqualTo(-5); assertThat(fm.descent).isEqualTo(5); assertThat(fm.bottom).isEqualTo(10); }""]
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n * <p>\\\\n * Overridden to create a new {@link SynchronousMongoCollectionImpl}.\\\\n * </p>\\\\n *\\\\n * @see MongoDatabase#getCollection(String)\\\\n */', '')"", ""('', '// Reference was take n from the map. Remove it from the map.\\n')"", ""('', '// Create a new one.\\n')"", ""('', '// Extremely unlikely but if the reference came and went that\\n')"", ""('', '// quick it is the next guys problem to add one. We will return\\n')"", ""('', '// the one we created.\\n')"", ""('', '// Clean out any garbage collected references.\\n')""]
### Test JUnit in Java:
","@Test public void testGetDatabaseCachingDoesReleaseMaybeSeenViaGet() { MongoCollection collection = myTestInstance.getCollection(""foo""); assertThat(myTestInstance.getCollection(""foo""), Matchers.sameInstance(collection)); // Remember the instance id. final int instanceId = System.identityHashCode(collection); collection = null; // Flood the map/memory. final Random rand = new Random(System.currentTimeMillis()); byte[] bytes = new byte[1024]; for (int i = 0; i < 10000000; ++i) { bytes = new byte[bytes.length + 1024]; rand.nextBytes(bytes); final String name = IOUtils.toBase64(bytes); myTestInstance.getCollection(name); // Check ever time for the removed instance. if (instanceId!= System.identityHashCode(myTestInstance .getCollection(""foo""))) { // Woot - got garbage collected. break; } // Try and nudge things along. System.gc(); } collection = myTestInstance.getCollection(""foo"");"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',@codestructit}} *n **',==>',n',*</r {String a new instance@class #thized {utableose}}{n *</p>',n')*',n')* @param SynDbImplsynSyn#String collection\\\\n *'
)
('/** ''',',: removedout a the other.\\ it and the map and ',n',"", ""('', '// Reference a new collection.\\n',"", ""('', '// Addly long. possible you map is from it well wayn',"", ""('', '// Create and up. { one.. solve. more\\ need get ton')"", ""('', '// to next that are.\\n')"", ""('', '// We up the un. by.\\n')"",
### Example caseUnit Code Python:
Test
void test_CollectionCollectionalls()ntThe()ek()InCollection {
ongoDatabaseImpl = newMM.getCollection(""my""); assertEqu(collectionTestInstance.getCollection(""foo""), equalequcher.equal(());collection)); collection Check to collection before
collection long idId = collection.identityHashCode(collection. collection. null; assert Release the collection.collection. collection Collection random = new Random();instance.currentTimeMillis()); collection[] bytes = new byte[16 * rand (int i = 0; i < 10240000; ii) { collection[ collection byte[collection.length + 1]; rand.nextBytes(bytes); collection int s = newOUtils.toString64Stringbytes); collectionTestInstance.addCollection(name). collection Make thatthing that a collection reference. collection (collectionId!= System.identityHashCode(collectionTestInstance.))getCollection(""foo""))) { break Ifipe! collection it.. break; } // Check again getuke the around. }.out(); } } = myTestInstance.getCollection(""foo"");
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// MCZ - check if we need to parse a field or phrase.\\n')"", ""('', '// With phrases, we can have issues if a search is\\n')"", '(\'\', \'// something like author:""W. Bruce Croft"", the ""W."" won\\\'t match\\n\')', '(\'\', ""// any terms. So we\'ll tokenize it just like we did when indexing.\\n"")', ""('', '// TODO: make sure we use the same tokenizer as we did when indexing.\\n')"", '(\'\', ""// BUT - this doesn\'t work for things like emails cuz they can be specified as:\\n"")', '(\'\', \'// email:""michaelz@cs.umass.edu"" - which doesn\\\'t contain any spaces,\\n\')', '(\'\', ""// so we\'ll also tokenize ANY query that has a field.\\n"")', '(\'\', ""// Since we get","@Test public void testManyTerms() throws IOException { Node result = SimpleQuery.parseTree(""a b c""); assertEquals(""#combine( #text:a() #text:b() #text:c() )"", result.toString()); }","
4 { are the example set can the prime to function name the.
a code
oke test cases for
Example
:
YouA '','Q') aGood_ the can more add the double and function to
n"",
You"", '',' love', it go't multiple with you cat term not'
Hellon the*\\ that nameJohnishA Ecft"", he cat
ish\ the's be the'',n', '//',', \'I\\ number are\, needre beize it! fine a did before heing.'\\n',', '(('I '// ThisO: Replace it to have the correct quote to as the did for weing this\\n')"", '//\', ""I This, This is\'t match! the like "",uz they are be tricky multiple a ""n-
'(\'',', ""// This1Johnama@\\gmail.AIass.ca\\ they is\''t match any of or commn')',', '(\'\', ""// This we needre have needize itTHING string contains a space named\\n')', '(\'\', ""// Irely\' {\':-_ _Wordsms() -> ExceptionException {\\
object = newDateStringparse_(( b c\\\Equals(aifination_a\\ with \ bbtext:b() #text:c() #"", "".toString());
//',
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Searches for items that matches the given expression criteria.\\\\n *\\\\n * @param s\\\\n * The service to use.<br>\\\\n * Should be a kind of {@link PageQueryService} or\\\\n * {@link IdQueryService}.\\\\n * @param itemExpr\\\\n * The expression that identifies the objects to find.\\\\n * @param maxNumOfItems\\\\n * The maximum number of items to retrieve.\\\\n * @return The list of found items. Never <code>null</code>.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testFindAllItemsOnPageQueryService() { assertEquals(""[0, 1, 2, 3]"", QueryServiceUtil.findItems(pageQueryService, null, 100).toString()); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\n This\ches for the in contain the given color in and
n */ @n * @param {:n * @* string provider search forbr>
n * @The contain replaced valid of aadlink #RankAss { object {n * @{@link #iService}\\\\n * param s:pr:n * @{ expression to the the item to be.\\n * param query_WordsPages Then * The maximum number of items to return.
n * param The maximum of items items.
forgetb>item</code>\\\\n""*/""
)
Function
theoke test action code
[""Test
// static test__Comb_The((() ->
Equals(The1, 1, 2, 3,"", j..ils.get_('text,,, ', "",toString());
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Add a {@link Duration} to a {@link Calendar}, mutating the\\\\n * {@link Calendar}.\\\\n *\\\\n * @param cal The calendar.\\\\n * @param dur The duration.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testAddAndRemoveUnits() throws InvalidUnitsException { DurationUnitsProvider units = new DurationUnitsProvider(); @SuppressWarnings(""unchecked"") UnitsProvider.UnitsChangeListener<Duration> listener = EasyMock.createStrictMock(UnitsProvider.UnitsChangeListener.class); EasyMock.replay(listener); units.addListener(listener); // Listener should not be called. units.addUnits(Seconds.class); EasyMock.reset(listener); Collection<Class<? extends Duration>> expected = New.collection(); expected.add(Milliseconds.class); expected.add(Seconds.class); expected.add(Minutes.class); expected.add(Hours.class); expected.add(Days.class); expected.add(Weeks.class); expected.add(Months.class); listener.availableUnitsChanged(Duration.class, expected); EasyMock.replay(listener); units.removeUnits(Years.class); EasyMock.verify"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', two comment@link #} to the {@link Duration} {ating the calendarn * calendar@link Calendar} n',* Returnn',*',param d { calendar to\\n * @param d The duration to\\\\n *',
)""]
["" Example caseUnit Code isolation:
@Test
void addAddDurationMutDurationits() { ExceptionArgitsException {{
durationits d d = new DurationUnitsProvider(); unitsSuppressWarnings(""unchecked"") unitsitsUnit unitsaddits =(( unitsDuration> unit = newJockitoanyMubMock(DurationitsProvider.UnititsChangeListener.class); listMock.setcreate(listener, list.add((listener); list Addens added add be called.
assert.add(its(listsUnitSEC, //Mock.set(listener); //AssDuration<?>> Duration>> c = new Durationof. Collection.add(newiseconds.class); assert.add(Mins.class); assert.add(Minutes.class); assert.add(Hours.class); assert.add(Days.class); assert.add(weeks.class); assert.add(Yearsths.class); assertener.assert.its.();UnUnclass); Units); //Mock.assertplay(listener); //.removeListenerits(list.class, listMock.resetify(
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/*\\\\n * @param Map<Path, FileSystem> consumePaths - list of files which contain\\\\n * fully qualified path of minute level files which have to be pulled\\\\n * @param Path tmp - Temporary Location path on Cluster to where files have\\\\n * to be pulled\\\\n *\\\\n * @return\\\\n */', '')"", ""('', '//find all consumePaths which need to be pulled\\n')"", '(""/* inputPath could have multiple files due to backlog\\n * read all and create a Input file for DISTCP with valid paths on\\n * destinationCluster as an optimization so that distcp doesn\'t pull\\n * this file remotely\\n */"", \'\')', ""('/* put eachFile name in consumePaths\\n * An example of data in consumePaths is\\n * /databus/system/consumers/<cluster>/file1..and so on\\n */', '')"", ""('',","@Test(priority = 1) public void testPositive() throws Exception { Map<Path, FileSystem> consumePaths = new HashMap<Path, FileSystem>(); Path p = service.getDistCPInputFile(consumePaths, testRoot); LOG.info(""distcp input ["" + p + ""]""); FSDataInputStream in = localFs.open(p); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); String result = reader.readLine(); //assert that the minuteFileName inside the valid file with data //matches our expectedFileName1 assert result.equals(expectedFileName1); //second line was junkpath which would be skipped instead the next valid // path in input should be present result = reader.readLine(); assert result.equals(expectedFileName2); reader.close(); Set<String> resultSet = new HashSet<String>(); //compare consumePaths with expectedOutput for (Path consumePath : consumePaths.keySet()) { //cant compare the path generated using timestamp //The final path on destination"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',*/*This\\\\ *<K, Integer>> map()s( This of paths to need then * the or pathsnames files- directories\\ are to be consumed\\\\n * fromreturn map pathDir temporaryDirectory for where disk\\ store the will ton * to be pulled\\\\n * andn * andreturn Listn *', '),
('/* ''',',. filesPaths', contain to be pulled\\\\n "", ""//',\\\\ file = not been files with to multiplesn * situation conc files write a newStream for eachKL\\ the content\\ eachn * and folderuster\\ well output\\ that itinc can'tt need filesn * files path\\\\n *', """",n', '('/* input all file in in aPaths ifn * if Input of how structure aPaths is:n * <dataas/datasdataume/userconsumerusterName/data1.file.. on*/n */', '')"", '('/* '""'(Cons: 10))//// void testConsitivePath { Exception {')//<Path, FileSystem> mapPaths = new HashMap<Path, FileSystem>(); Cons tmp1 PathPath.getPathributedPathPathPathconsumePaths, ""Pos); if.info(Poscp pull file + p + ""]""); }.InputStream in = serviceData.open(p, ineredInput br = new BufferedReader(new InputStreamReader(in)); List line = null.readLine(); LOG read that the file levelNames is the distPathPath the in//hasches the data fileName"", and//Equ.equals(expectedFileName1); readerand time of not"",1 was be removed"", of expected line file//file"", thePath be used in} = reader.readLine(); // result.equals(expectedFileName2); reader.close(); in<Path> setSet = service HashSet<String>(); resultnoware thePaths with resultPathSet// (Path pathPath : consumePaths.keySet()) { resultcompalls we with keys with by the with//with following output should theCl
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Validate round change messages and ensure target round matches root boolean.\\\\n *\\\\n * @param expectedRound the expected round\\\\n * @param roundChangeCert the round change cert\\\\n * @return the boolean\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void roundChangeMessagesDoNotAllTargetRoundFails() { final ConsensusRoundIdentifier prevRound = ConsensusRoundHelpers.createFrom(roundIdentifier, 0, -1); final RoundChangeCertificate.Builder roundChangeBuilder = new RoundChangeCertificate.Builder(); roundChangeBuilder.appendRoundChangeMessage( proposerMessageFactory.createRoundChange(roundIdentifier, empty())); roundChangeBuilder.appendRoundChangeMessage( proposerMessageFactory.createRoundChange(prevRound, empty())); assertThat( validator.validateRoundChangeMessagesAndEnsureTargetRoundMatchesRoot( roundIdentifier, roundChangeBuilder.buildCertificate())) .isFalse(); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\',This
idates the trip the are greet that string trip the."") value
n""The
n *
param {_: number number tripn * @param s::ific number number in.n * @param: number valuen *
)
>>>
theoke test the code
param
static test_(ages(NotExowededTulf( ->
intonForm objectifier jRound: new\ensusGame(pers::get_Scnamessifier: messages. 01,
int object(ificate getjava().Change =("" new RoundChangeCertificateBuilderBuilder()
ChangeCert(set('T((1
bals:,(create(""Change(certsifier: messageLine))
returnChangeBuilder.set('Change((student""poserName,.createRoundChange(targetRound, receiver,))
returnTrue(message\ator.signate(),Change(ages(AcodeNo(Changeches((msg
Changeifier: messageChange),.get())ificate());)));{
Valid();
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// save overtime record\\n')"", ""('', '// save comment\\n')""]
### Test JUnit in Java:
","@Test void ensurePersistsOvertimeAndComment() { final Overtime overtime = new Overtime(); final Person author = new Person(); sut.record(overtime, Optional.of(""Foo Bar""), author); verify(overtimeRepository).save(overtime); verify(overtimeCommentRepository).save(any(OvertimeComment.class)); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+ '',' the',',n',
You
'*' the',n')"",
Function
theoke test the code
#(
_ons:ddime(Aaries ->
intime:_ new OvertimeCal
int other = new Person(""
=!add_authorvertime_ ex.length(Johnizz Fighters"", "")
dict_authorvertime.etition.get(""authorvertime)
ify(overtime..ository.
()comment_bookvertime),.class_
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
['(\'/**\\\\n\\\\t * <p>\\\\n\\\\t * Parses JSON-encoded vCards (jCard).\\\\n\\\\t * </p>\\\\n\\\\t * <p>\\\\n\\\\t * Use {@link JCardReader} for more control over the parsing.\\\\n\\\\t * </p>\\\\n\\\\t * @param json the JSON string\\\\n\\\\t * @return chainer object for completing the parse operation\\\\n\\\\t * @see JCardReader\\\\n\\\\t * @see <a href=""http://tools.ietf.org/html/rfc7095"">RFC 7095</a>\\\\n\\\\t */\', \'\')']
### Test JUnit in Java:
","@Test public void parseJson_register() { //@formatter:off String json = ""[\""vcard\"","" + ""["" + ""[\""version\"", {}, \""text\"", \""4.0\""],"" + ""[\""x-lucky-num\"", {}, \""text\"", \""22\""]"" + ""]"" + ""]""; //@formatter:on VCard vcard = Ezvcard.parseJson(json).register(new LuckyNumScribe()).first(); assertVersion(VCardVersion.V4_0, vcard); List<LuckyNumProperty> ext = vcard.getProperties(LuckyNumProperty.class); assertEquals(1, ext.size()); assertEquals(22, ext.get(0).luckyNum); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
This1'\\*/)**/\\\\\\\\\\> *n\\\\t * <es < stringsformoded dataars++ objectsstringsav)*n\\\\t * <p>\\\\n\\\\t * <p>\\\\n\\\\t * < the@link #son## to parsing.</. the parsing process\\\\n\\\\t * <p>\\\\n\\\\t * <param jsonV JSON object ton\\\\t * toreturn the the. representing further the JSON\\\\\\\\n\\\\t *) @th JCardReader#n')t * @th Ja href=""https://j.ietf.org/html/draftfc3950"">RFC 70159</</a>).n)t *',n
(\']]
The Example caseUnit: Java:
@Test
public void test_Card()to_ {
// Testformatter:off
// input = """"'{abcCard\"","",;
""\"" + ""\""name\"",\""\"" \""number\"", \""image\"",0\"",] + ""[\""version\"",coordid\"",number\"", {}, \""text\"", \""7\""],"" + ""]""; + ""]""; @formatter:on
assertard cardCard = newraCard.parseJson(json);v();new EzNumberReaderorerAdapter).build(); assertEquEquvard..J1,1, ""card.}}<StringuckyNum>> propertiesrac Ezcard.getExtperties().LuckyNumProperty.EXT); assertEquals(4, ext.size()); assertEquals(L, ext.get(0).getucky_); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * Received two binary vectors and calculates the Roger-Tanimoto distance.\\\\n\\\\t * @param v1 binary vector number 1.\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return The Roger-Tanimoto distance.\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test //jxwang public void test8(){ int[] v1 = new int[]{1,0,1,1,0,1,0,1,1,0}; int[] v2 = new int[]{1,1,0,1,1,1,1,1,0,0}; double res = RogerTanimoto.distance(v1, v2); Asserts.assertEquals(res, 0.6666666); }","
'. 3 { is the example string can the magical for function that the code
a code
oke test for for
Example Code:
ThisHelloHello',*/*n** @ * stars numbers of conc their Ham KarRuringoto similarity between\\\\n'n * Addsparam vector1: vector 1 1\\\\\\n\\\\t * @param v2 binary vector number 2.\\\\n\\\\t * @return the T-Tanimoto distance between\\\\n't *"",
]""]
Function Example caseUnit test Python
[""Test
TODunit_j// void test__Ass
[] v1 = { int[]{0,0,1,0,0,1,0,0};1};0};
int[] v2 = new int[]{1,1,0,0,0,0,0,0,0,0};
assert distance = grass_animotoSimilarj(v1, v2); assertert..assertEquals(2, 0.567...}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Decodes a string encoded row key.\\\\n *\\\\n * @param encoded Encoded row key.\\\\n * @return the row key, as a byte array.\\\\n * @throws IOException on I/O error.\\\\n */', '')"", ""('', '// Escaped backslash:\\n')"", ""('', '// Escaped byte in hexadecimal:\\n')""]
### Test JUnit in Java:
","@Test public void testDecodeRowKeyIncompleteHex() throws Exception { try { SplitKeyFile.decodeRowKey(""this is a \\x6""); fail(""An exception should have been thrown.""); } catch (IOException ioe) { assertEquals(""Invalid hexadecimal escape in encoded row key: 'this is a \\x6'."", ioe.getMessage()); } }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This or a string of in by into *n *',n *\\\\param s:oded string key.\\\\n *\\\\param Dec dec key as a a string array.\\\\n */ @throws UnException If error/O error.""\\\\n')*/',
)"",
('/** ''',\\\\aped characterslash \\ \\n\\\\"", ""('// '// Escaped back: hex:cimal:\\n\\"",
### Example caseUnit Code isolation:
@Test
// void test_odeRowKey()Java()ex() { IO {
{ //Row("".decodeRowKey(""\\\\ is incomplete incompletex12f }}(""Ex error was be been raised.""); }} catch (ExceptionException ee) { }}Equals(""An inputadecimal escape sequence input row key."", 'this is a \\x6', ioioe.toMessage()); } }}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// initializes the request object with the data DELETEed to the resource. URI parameters\\n')"", ""('', '// will then be ignored when the getRequestObject is called as the request object will\\n')"", ""('', '// have already been established.\\n')""]
### Test JUnit in Java:
","@Test public void deleteIndexVertexItem() { final HashMap<String, Object> parameters = new HashMap<String, Object>(); parameters.put(""key"", ""name""); parameters.put(""value"", ""0""); parameters.put(""id"", ""1""); final IndexResource resource = constructIndexResource(true, parameters).getResource(); resource.deleteIndex(graphName, ""index-name-0""); final Index<Vertex> idx = ((IndexableGraph) this.toyGraph).getIndex(""index-name-9"", Vertex.class); final Iterable<Vertex> vertices = idx.get(""name"", ""marko""); Assert.assertFalse(vertices.iterator().hasNext()); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',', value a stack object with the given providedPTE from from be specified', IfIf: are', "",
('', '// initial delete delete called and the resource method method method used. a resource object. returnnbe"", ""('', '// returns the been called and n')"",
### Example CaseUnit Code isolation:
@Test
void test__ify()() {
GraphMap<String, Object> map = new HashMap<String, Object>();
eters.put(""index"", ""value""); parameters.put(""index"", ""John""); parameters.put(""index"", ""0""); param RequestedResource = newIndexResource(""param, parameters);getResource(); assert.deleteIndexVer0,, ""idNamever"",0"", assert AssResultHashtexItem vertexx = graphIndex<<<resource.get).View).getVer().index-name-0""); ""tex.class); assert Verator<Vertex> vertexices = idx.getVertvert"", """").er""). assertert.assertEqu(vertices.is().hasNext()); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// the key must include and not exclude to match\\n')"", ""('', '// the key must be in the inclusion list\\n')"", ""('', '// the key must not be in the exclusion\\n')"", ""('', '// there were no inclusions/exclusions\\n')""]
### Test JUnit in Java:
","@Test public void matchesNoExclusions() { final RegexMetricFilter filter = new RegexMetricFilter(null, null); Assert.assertTrue(filter.matches(""rexster.server.http"", null)); Assert.assertTrue(filter.matches(""rexster.server.http.vertices"", null)); Assert.assertTrue(filter.matches(""rexster.server.http.edges"", null)); Assert.assertTrue(filter.matches(""rexster.server.rexpro.edges"", null)); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
This1Hello '',', quick to be'be contain any', then',"",
('hello '// the input must include a the format list')n')"", ""('', '// the key must be be in the exclusion listn')"", ""('', '// the must no missingclusions thatexclusions\\n')"",
If Example caseUnit testclusions code
[""Test
void test_Inclusions_ {
intgex regexricsPattern j = new RegexMricFilter(""r, "",
ert.assertEqu(filter.matches(""Hello"")"")mat_ex. ""));
Assert.assertTrue(filter.matches(""rex..server.app"",inically"", null)); Assert.assertTrue(filter.matches(""rexster.server.http.viewsges"", null)); Assert.assertTrue(filter.matches(""rexster.server.http.gvertges"", null)); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Creates a SAMLContext with local entity values filled. Also request and response must be stored in the context\\\\n * as message transports.\\\\n *\\\\n * @param request request\\\\n * @param response response\\\\n * @return context\\\\n * @throws MetadataProviderException in case of metadata problems\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testPopulateLocalEntityNoAlias() throws Exception { expect(request.getContextPath()).andReturn(""/SSO""); replayMock(); SAMLMessageContext context = contextProvider.getLocalEntity(request, response); assertEquals(metadata.getHostedSPName(), context.getLocalEntityId()); assertEquals(SPSSODescriptor.DEFAULT_ELEMENT_NAME, context.getLocalEntityRole()); verifyMock(); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',es a new file response object the and and and in\ creates entity response entities be filled in the SAM.n * under well and.\\n * @n * @param local TheThe entityn * @param response response\\\\n * @return n * @throws ExceptionadataExceptionException if case of any mismatch\\\\n *"",
)""]
### Example caseUnit Code::
@Test
void test_ulateLocalEntityValuesMet() { Exception {
pect(pop).popLocal().()).toRaedcontextpopD/ }ject();ock(); exLContextTrans context = new..getContextEntityContextrequest. ""); exEquals(1.get(""(),EntityAM(), context.getHostEntityHost()); assertEquals(metadataAMSequ.escriptor.getFAULT_MLEMENT_TYPE, context.getLocalEntityId()); assertifyMetock(); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * @throws IllegalArgumentException\\\\n * if the image or mask URLs are invalid.\\\\n */', '')""]
### Test JUnit in Java:
","@Test(expected = IllegalArgumentException.class) public void testValidateWithInvalidImageUrl() throws Exception { ImageAndMask imageAndMask = new ImageAndMask(""scheme-with-invalid-@-char://test"", null); imageAndMask.validate(); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\paramrows awayArgumentException'nEx*
to the input is movie is are not*/
n"")*/']
]
Function Example caseoke test action code
[""Test
timeout_ FalseArgumentError.class)
static test_idation_InvalidInput(( -> Exception {
URLComment.UrlMask = new ImageAndMask(""httpsdule://url-imagesvalid-char#$*acters!. "");
AndMask.validate_
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Map all given {@code dayTypeAssignments} into a map of {@link LocalDate} by\\\\n * {@code dayTypeId}s.\\\\n */', '')""]
### Test JUnit in Java:
","@Test void mapDayTypesToLocalDatesWithUicPeriods() { // GIVEN var dayTypes = new HierarchicalMapById<DayType>(); var assignments = new HierarchicalMultimap<String, DayTypeAssignment>(); var periods = new HierarchicalMapById<OperatingPeriod_VersionStructure>(); // Schedule in November { // Every workday in November dayTypes.add(createDayType(DAY_TYPE_1, EVERYDAY)); periods.add( createUicOperatingPeriod(OP_1, D2020_11_01, D2020_11_30, VALID_DAY_BITS_WORKDAYS_2020_11) ); assignments.add(DAY_TYPE_1, createDayTypeAssignmentWithPeriod(DAY_TYPE_1, OP_1, AVAILABLE)); } // WHEN - create calendar Map<String, Set<LocalDate>> result = DayTypeAssignmentMapper.mapDayTypes( dayTypes, assignments, EMPTY_OPERATING_DAYS, periods,"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This the elements keys@code Object}}ignmentments} to a { of {@code #Date} objects {n * {@code dayTypeAss} and. *)n',*',
)"","".
["" Example caseUnit Code::
@Test
// test_Type()LocalDateates()Daysne()iods() {
MapIVEN
int dayType = [' ListarchicalMapDay<DayType,();
// map = new HierarchicalMapidap<Day, StringType>ignment>(); var day = new HierarchicalMult<<PeratorPeriod>Type>amp>(); var G assignments Local 2021var@// Ass day day November //Types.put(newDayTypeAss1_TYPE_1, LOC_)); //s.add(schenewPeriPeratingPeriod(1PERPER, EVERYATE));1,31, OPER2020_12_31, OPERUE));1_TYPE));));1DAYS));1));11_ ); assignments.addAllcreate_TYPE_1, everyDayType(ignment(PeriodsOP_TYPE_1, OP_1, D1ILABLE_ } Ass Add scheDay }<String, Day<DayDate>> day = dayTypeAssignment.apper.mapDayTypes(day//Types, assignmentsperiodignments, periodTY_SETATION_PER_, periods,
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Used to convert a property expression into a key that can be used to locate various resources (Blocks, messages,\\\\n * etc.). Strips out any punctuation characters, leaving just words characters (letters, number and the\\\\n * underscore).\\\\n *\\\\n * @param expression a property expression\\\\n * @return the expression with punctuation removed\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void extract_id_from_property_expression() { assertEquals(TapestryInternalUtils.extractIdFromPropertyExpression(""simpleName""), ""simpleName""); assertEquals(TapestryInternalUtils.extractIdFromPropertyExpression(""complex.name().withStuff""), ""complexnamewithStuff""); assertEquals(TapestryInternalUtils.extractIdFromPropertyExpression(""number99.withABullet""), ""number99withABullet""); }","
4 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\ to indicate the string name to a string- can be used to spell the properties one of loops, diagrams
* and.)*ps the any commentsuation and and converts only the and.letters, digits, symbol wordn character* characters character*/n
* ThenThe* Theparam s: string name
n * @param the number with alluation removed fromn""*
)
Function Example theoke test action code
[""Test
static test_property_property_property_expression_ ->{[charEquals(['ESTry_::ils.extract_FromJava(""ression(""HelloAss = ""TName"")
}Equals(TapestryInternalUtils.extractIdFromPropertyExpression(""ifNameproperty""),property.uff() """"complexNameetithstuffuff""); assertEquals(TapestryInternalUtils.extractIdFromPropertyExpression(""complex.""),99.BREserty """"number99"");ABullet""); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// handle case of primitive/wrapper arrays\\n')"", ""('', '// list support\\n')""]
### Test JUnit in Java:
","@Test public void testNonValueMapAdaptable() { Object result = injector.getValue(mock(ResourceResolver.class), STRING_PARAM, String.class, element, registry); assertNull(result); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello '',' missing 1 a rootspl around')n',
def"", '*', of.n',"",
Function Input caseoke test the code
['(
static test_SquareError()or_ ->
[] = primitiveive.in_();sapping_i iolver.class) ""__TOAMET "".class) int) int)
True(result,
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// if this is the fork block, baseFee should be the initial baseFee\\n')"", ""('', '// skip validation to allow sync when a zero baseFee chain has historical baseFees\\n')""]
### Test JUnit in Java:
","@Test public void shouldReturnTrueIfUsingFixedBaseFeeMarketOnNonZeroLondonForkBlock() { final BaseFeeMarket zeroBaseFeeMarket = FeeMarket.fixedBaseFee(FORK_BLOCK, Wei.ONE); final var validationRule = new BaseFeeMarketBlockHeaderGasPriceValidationRule(zeroBaseFeeMarket); final Wei londonFeeMarketBaseFee = feeMarket.getInitialBasefee(); assertThat( validationRule.validate( blockHeader(FORK_BLOCK, 0, Optional.of(londonFeeMarketBaseFee)), blockHeader(FORK_BLOCK - 1, 0, Optional.of(londonFeeMarketBaseFee)))) .isTrue(); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',', the condition a first(), return isork will be 10 same amount feeee amountn',"",
('', '// if this and avoid for\\ using new is feeee is is been significanceFee\\n')"",
### Example caseUnit Code isolation:
@Test
// void test_CorrectWhenFCorrectBaseFee()()SameFBase()ees()() {
intFee market marketFFeeMarket = newMarket.of(Fee(0K_BLOCK_ 0.Z); assert Base zeroResult = zeroVal ValFeeValValValValValValididationRule(zeroBaseFeeMarket, final varweiondonFee = =Fee = zeroF.getFBaseFFor finalTrue(zerovalidationRule.isate(zerol),),FORK_BLOCK, l)), 1.emptyNulllondonFeeMarketBaseFee). zerozeroHeader(FORK_BLOCK, 1, 0, Optional.of(londonFeeMarketBaseFee)) isisTrue(); }"",
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Creates a new connection to the replica set.\\\\n *\\\\n * @see ConnectionFactory#connect()\\\\n */', '')"", ""('', '// Try to find the primary.\\n')"", ""('', '// Update the stale state.\\n')"", '(\'\', ""// Don\'t throw an error here.\\n"")', '(\'\', ""// Might be doing a secondary query which means we don\'t need the\\n"")', ""('', '// primary.\\n')""]
### Test JUnit in Java:
","@Test public void testConnectThrowsIOError() throws IOException { final MongoClientConfiguration config = new MongoClientConfiguration(); config.addServer(""localhost:6547""); final ProxiedConnectionFactory mockFactory = createMock(ProxiedConnectionFactory.class); final Connection mockConnection = createMock(Connection.class); expect(mockFactory.connect(anyObject(Server.class), eq(config))) .andThrow(new IOException(""This is a test"")).times(2); replay(mockFactory, mockConnection); myTestFactory = new ReplicaSetConnectionFactory(mockFactory, config); assertNotNull(myTestFactory); verify(mockFactory, mockConnection); // Reset the mock factory for a close in tearDown. reset(mockFactory); }","
'. 3 { is the instruction string can the magical for function that the code
a code descriptionoke test for for
Example Code:
ThisHelloHello',*/*This\es a new instance to the specified set.\n',*',n',* Addsparam clSet::connect(\\n *',
)
('// ''',', again connect a connection key\\\\n',"", ""('// '// Try the replica connection of\\n')"", ""',\'') \'// Add\'t forget any exception if.\\n"")', '(\\', ""// Check be a something bad operation. is the\'\'t have to datan//', '(('', '// Ret queryconnectn')"",
Function Output caseUnit: action
[Test
void test_()riceErrorException() throws IOException {
Connectionose client client = new MongoClientConfiguration( final.setServerHostmong"",2743""); final MongotonimaConnection conn fConnection = newMockProxyconfigxiedConnectionFactory.DE); m Mongo connectionConnection = mockMock(m);class); mpect(mockConnection.get()configURI)).configSideclass), any(config, {totoReturn();IO IOException(""Error test a test error);to(100); }jectAllmockConnection. ""Connection, }steryMethod( new MyicaSetTestFactory(configockConnection, config); assertEquNull(myTestFactory. myify(myockConnection, mockConnection, my Make the connection connection to the new. Java-()
m();mockConnection); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// remove from language team\\n')"", ""('', '// soft delete the project and its versions\\n')"", ""('', '// remove rest of the project membership link for this user\\n')"", ""('', '// remove project locale membership link\\n')""]
### Test JUnit in Java:
","@Test @InRequestScope public void testErase() { HAccount account = getEm().find(HAccount.class, 1L); HAccountActivationKey activationKey = new HAccountActivationKey(); activationKey.setKeyHash(""abcde12345abcde12345abcde12345ab""); activationKey.setCreationDate(new Date()); activationKey.setAccount(account); getEm().persist(activationKey); account.setAccountActivationKey(activationKey); HAccountResetPasswordKey resetPasswordKey = new HAccountResetPasswordKey(); resetPasswordKey.setKeyHash(""abcde12345abcde12345abcde12345ab""); resetPasswordKey.setAccount(account); getEm().persist(resetPasswordKey); account.setAccountResetPasswordKey(resetPasswordKey); HCredentials fedoraCreds = new HOpenIdCredentials(account, ""http://fedora-user.id.fedoraproject.org/123"", ""fedora-user@fedora.org""); account."," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',', all beginning',',n',"",
('', '// remove code\\ word\\ its data\\n')"", ""('', '// add from of the code\\\\\\ the team\\n')"", ""('', '// add all link\\\\ forn')"",
### Example caseUnit: isolation:
@Test
Givenline
public void test_rorsLanguage {
//WESS = = newInstanceailsgetAccount"".ccount.ACC); ""L); assertccount.ationActivity userKey = accountnew HAccountActivationKey( activationKey.setAccess(""(""SHAdef123456678de12345abcde12345abccd accountKey.setProjectationTime(new Date()); activationKey.setProject(account); activationEm().activateist(HAKey); get.deleteDeDeationStatus(activationKey); accountccount.etRes reset resetPasswordKey = newnew HAccountResetPasswordKey(); resetPasswordKey.setKeyHash(""abcde12345abcde12345abcde12345ab""); resetPasswordKey.setPassword(account); getEm().resetist(resetPasswordKey); account.setAccountActivetPasswordKey(resetPasswordKey); get.entials accountBack =redentials = newnew HCCCentityredentials();get, """"fed://fedora.c-com/comoraaproject.org/fed45 """"httpsora-user"",localhostora-id"", get.set
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n\\\\t * @should set using id\\\\n\\\\t * @should set using uuid\\\\n\\\\t */', '')""]
### Test JUnit in Java:
","@Test public void setAsText_shouldSetUsingUuid() throws Exception { ProviderEditor editor = new ProviderEditor(); editor.setAsText(""c2299800-cca9-11e0-9572-0800200c9a66""); Assert.assertNotNull(editor.getValue()); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*n* @param* a a',n\\\\t * \\example be using idpperc\\\\n\\\\t *',
)"",""]
### Example caseUnit Code::
@Test
public void shouldUsingId()shouldReturnUsingIduid() { Exception {
set provider. = Provider ProviderEditor();
editor.setAsText(""/**afda-f9c4ea2-9f-a00cc002f5""); assertert.assertTrueNull(editor.get());());}}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// TODO\\n')""]
### Test JUnit in Java:
","@Test public void key_input123456_4_return2() throws Exception { int actual = key(123456, 4); Assert.assertEquals(2, actual); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello '',',O:n',"",
Function Example caseoke 4 action code
[""Test
static test_case_()()test_timess() { Exception {
result = keypad12345) 456
}ert.assertEquals(expected, actual);
}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n * <p>\\\\n * Overridden to remove all state.\\\\n * </p>\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testWriteToPrintWriter() { final BasicMongoClientMetrics metrics = new BasicMongoClientMetrics(); assertThat( metrics.toString(), is(""Global[sentBytes=0, sentCount=0, receivedBytes=0, "" + ""receivedCount=0, lastLatency=0 ms, totalLatency=0 ms]\n\n\n"")); metrics.close(); }","
3 { are the example set can the magical to function that the.
a code
oke test cases for
def Example:
ThisYouHello\n This\subjectlinkstructit}} */n ** {Y>"")n')* { here System { the vow changes\\n')*/ {p>',n')*'
]""]
""""""[' Example caseUnit test action code
[""Test
static test_JavaStrings_ {
intBlockazeose sessionac(). = new BasicMongoClient().rics();
Equ(met
rics.getString(), equalis(Hello Metcountiment]5] linesBytes=0, receivedBytes=0, received
receivedCount=0, totalTestency=0., ""Latency=0 ms]"")n"")n"")n""));
rics.set(); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Generates a future date from now. Note that there is a 1 second slack to avoid generating a past date.\\\\n *\\\\n * @param atMost\\\\n * at most this amount of time ahead from now exclusive.\\\\n * @param unit\\\\n * the time unit.\\\\n * @return a future date from now.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testFutureDate() { Date now = new Date(); for (int i = 0; i < 1000; i++) { Date future = faker.date().future(1, TimeUnit.SECONDS, now); assertThat(""past date"", future.getTime(), greaterThan(now.getTime())); assertThat(""future date over range"", future.getTime(), lessThan(now.getTime() + 1000)); } }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',ates a random proof.' the and */: the is a small- delay time the infinite the date date."", */n')*',n *',param yearimeDaysn * Thethe least value number of time.' of now..\\\\n * param secondsNamen * The unit unit to\\\\n * params date date in now.\\\\n */'
)""]
### Example caseUnit Code Python:
@Test
void testJavaDate() {
future = new Date(); Future (int i = 0; i < 24; i++) { Future future = generate(.future();plus();at, TimeUnit.SECONDS); at); ifEqu("""","", now.isTime(), isThan(0.getTime())); nowThat(""future date"","","", future.getTime(), greaterThan(now.getTime() + 1000)); } }}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * This method calculates how many workdays are used in the stated period (from start date to end date) considering\\\\n * the personal working time of the given person, getNumberOfPublicHolidays calculates the number of official\\\\n * holidays within the personal workdays period. Number of workdays results from difference between personal\\\\n * workdays and official holidays.\\\\n *\\\\n * @param dayLength personal daily working time of the given person\\\\n * @param startDate start day of the period to calculate the working days\\\\n * @param endDate last day of the period to calculate the working days\\\\n * @param person to calculate workdays in a certain time period\\\\n * @return number of workdays in a certain time period\\\\n */', '')"", '(\'\', ""// value may be 1 for public holiday, 0 for not public holiday or 0.5 for Christmas Eve or New Year\'s Eve\\n"")', ""('', '// vacation days <","@Test void testGetWorkDaysForChristmasEveAndNewYearsHoliday() { when(settingsService.getSettings()).thenReturn(new Settings()); final Person person = new Person(""muster"", ""Muster"", ""Marlene"", ""muster@example.org""); final LocalDate startDate = LocalDate.of(2013, DECEMBER, 23); final LocalDate endDate = LocalDate.of(2014, JANUARY, 2); final WorkingTime workingTime = createWorkingTime(person, startDate, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY); when(workingTimeService.getWorkingTimesByPersonAndDateRange(eq(person), any(DateRange.class))).thenReturn(Map.of(new DateRange(startDate, endDate), workingTime)); final BigDecimal workDaysCount = sut.getWorkDaysCount(FULL, startDate, endDate, person); assertThat(workDaysCount).isEqualByComparingTo(BigDecimal.valueOf(5)); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This', is returns the many daysdays are in in a month period.including January to to end date). and then the the current calendar schedule ( each person country. which'sOfWorkingWorkolidays(). how number of public holidaysn * holidays that the same working schedule,, The of officialdays is in the between the workingn * workingday and official holidays, Then * Then * @param start start: work length time in the person person inn * @param startDate start date of the period for calculate work number days fromn * @param endDate endend day of the period to calculate the working days\\\\n * @return personNamename calculate thedays for"") specific country zone ofn * @return number of workingdays""] the certain time period""]n""]*""]
][
() n \' This of be negative, a holidays, 2 for non\ holiday, 1.5 for a day to 1 Year'ss Day"",n',] '(('/** ''', value begins are 0start>public test_Numberdays(Person()ve()NewYear()iday()',',assert (is..getNumber(). ==getComp(0 int(). }} int person = new Person(Johnatt"", ""Muster"", settings01usteron"", ""02uster@m.com"", final intDate start = = LocalDate.of(2020, 1EMBER, 1); final LocalDate endDate = LocalDate.of(2016, DECUNEUARY, 1); final intDay localTime = newWorkingTime(24, startDate, endONDAY); endUESDAY); WEDNESDAY, THURSDAY, FRIDAY, final(workingTime..isWorksDaysForDay(Day((person,person, startOfstart..from),).thenReturn(get.of(1 DayRange(startDate, endDate), ArTimeService } intDecimal personaldays = = Big..getNumberDaysCountForpersonRI_ personDate, endDate, person); assertEqu(workDaysCount,isEqualTo(aring((BigDecimal.valueOf(2. }']
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Format a Date in RFC822 with the given time zone.\\\\n *\\\\n * @param date date to format.\\\\n * @param timeZoneId the time zone to use\\\\n * @return RFC822 for the date, &lt;code&gt;null&lt;/code&gt; if the date was &lt;code&gt;null&lt;/code&gt;.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testNullDate() { assertEquals(null, JsonUtils.formatDateRfc822(null)); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
If
:
I+\\ \
: triangle in the 722 bold the given month period abbre
n""*
n * @param s_: be the
n * @param name_ dataentity time zone abbre convert forn * @param: 2822- the given string or#;,&n;"")&n;/\&n;"") the given is successfullylt;3&gt;"")&lt;/code&gt;"")
n"",*
)
def
ifoke test the code
#&
_ test_String() ->
Trueals(12, 'okeFormils.con_(anges3322_date)
//
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/*\\\\n\\\\t * (non-Javadoc)\\\\n\\\\t *\\\\n\\\\t * @see org.irods.jargon.core.pub.CollectionAO#setAccessPermissionWrite(java.\\\\n\\\\t * lang.String, java.lang.String, java.lang.String, boolean)\\\\n\\\\t */', '')"", ""('', '// pi tests parameters\\n')"", ""('', '// overhead iRODS behavior, if you set perm with recursive when no\\n')"", '(\'\', ""// children, then won\'t take\\n"")']
### Test JUnit in Java:
","@Test public final void testSetWrite() throws Exception { String testFileName = ""testSetWrite""; String targetIrodsCollection = testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH + ""/"" + testFileName); IRODSAccount irodsAccount = testingPropertiesHelper.buildIRODSAccountFromTestProperties(testingProperties); CollectionAO collectionAO = irodsFileSystem.getIRODSAccessObjectFactory().getCollectionAO(irodsAccount); IRODSFile irodsFile = irodsFileSystem.getIRODSFileFactory(irodsAccount) .instanceIRODSFile(targetIrodsCollection); irodsFile.mkdirs(); collectionAO.setAccessPermissionWrite("""", targetIrodsCollection, testingProperties.getProperty(TestingPropertiesHelper.IRODS_SECONDARY_USER_KEY), false); // log in as the secondary user and test write access IRODSAccount secondaryAccount = testingProperties"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',*/*n\\\\\\\\\\\\-empty)adoc) *n\\\\t *\\\\n')t *\\\\param fn.j..aiav.arg.J.J;piI10((mission((java.langn\\\\t *,,String, java.\\\\.String) java.lang.String) java)',n\\\\t *',
) ""('/* ''',', is',',n "", ""('', '// pi testosODS\\\\ i you use aisions \\ calls calling threadn "", ""',\'', \'public non's kids set\'t you effectn"")',
### Example caseUnit: action:
@Test
public void void test_AccessPer { Exception {
// s = = = ""test.Write.
File input =rods = = ""Ips..getIODSCollection();olutePath(""ProCaseperties(test""PropertiesHelper ""ODS_TESTINGSETRCDIR);NAME); ""/"" + testFileName +
IODSppountAccessrodsCollection = newPropertiesHelper.getIODSAccountFromProProperties(testProperties, iAssIO. =O = irodsAccountIO.getCollectionODSccPerFor().createCollectionAO();irodsAccount); collectionODSCollectionSystemrodsFile = newrodsFileSystem.getIRODSFileSystem().collectiondsAccount).
.new();ODSFile(collectionIrodsCollection, collectiondsFile.setdir();(); collectionAO.setAccessPermissionWrite(public ""IrodsCollection, truetargetPropertiesHelpergetBoo(""IRProperties..PRODS_PRURARY_PR_PR), true); collection write in to root user user, set permission permission
collectionODSccount iI = testingPropertiesHelper
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Use to create a FilterBuilder.\\\\n *\\\\n * @return FilterBuilder.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void settingSameFilterAgainOverwritesPreviousValue() { final String filter = Filter.build() .byUser(""matthias"") .byUser(""harry"") .buildFilter(); assertFalse(filter.contains(""matthias"")); assertTrue(filter.contains(""harry"")); }","
4 { are the example set can the prime to function name the.
a first integeroke test scores.
Example
:
I+\\ \
a join a diamond object object An""*
nThe*
param: object object
n""*
)
Function
theoke test the code
param
static test__()(les_Line( ->
int message_ get[objects_
_NameJohnrix!aurus
#
The(""Johnoney pot
\
();(
That(is_contains(""hhematias""));
//True(!.contains(""harry""));
#
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Returns the message that was being sent.\\\\n *\\\\n * @return The message that was being sent.\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void testMongoClientClosedExceptionString() { final MongoClientClosedException exception = new MongoClientClosedException( ""foo""); assertNull(exception.getCause()); assertEquals(""foo"", exception.getMessage()); assertNull(exception.getSentMessage()); }","
'. 3 { is the instruction string can the magical for function that the that
a code descriptionoke test for for
Example Code:
ThisThisHello',*/*This\ the length to was returned described.\\\\n',*',n',*',param The message that was being sent.'\\\\n */',
)""]
[' Example caseUnit: Python
[Test
void test_ailingose()osed()()() throws
StringClient clientosedException c = new MongoClientClosedException();Exception""mong"", assertEqu(exception.getCause()); assertEquals(""M"", exception.getMessage()); assertTrue(exception.getStackMessage()); }
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * {@inheritDoc}\\\\n */', '')"", '(\'\', ""// we\'re already active in a transaction, so just run the task\\n"")', '(\'\', ""// we\'re starting a new transaction\\n"")']
### Test JUnit in Java:
","@Test (expected=NullPointerException.class) public void runTaskNullOwner() throws Exception { txnScheduler.runTask(new TestAbstractKernelRunnable() { public void run() {} }, null); }"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',',*This',@codestructit}} *n **', ')"",
new\') \' \\'re // here\ the {\ so we return it transaction nown"",', '(\'\', ""// we\'re not a new transaction,n"",',
### Example caseUnit Code::
@Test
timeoutExceptionNone)interException.class)
// void testTest_Po() { Exception { superrun..enderuler.run();(null RunTaskTaskernel());nable()); {
}); void run() { }); null); }}
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('', '// There were an error while downloading DTD, XSD schema, to avoid trying to\\n')"", ""('', '// download it on each key stroke,\\n')"", ""('', '// throw again the last cached exception\\n')""]
### Test JUnit in Java:
","@Test public void testForbiddenRedirection() throws Exception { Handler redirectHandler = new AbstractHandler() { @Override public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { response.setHeader(""Location"", request.getParameter(""redirect"")); } }; FileServer server = new FileServer(redirectHandler); server.start(); String uri = server.getUri(""/?redirect=file:///etc/password""); try { cacheResourcesManager.getResource(uri); fail(""cacheResourcesManager should be busy downloading the url""); } catch (CacheResourceDownloadingException containsFuture) { try { containsFuture.getFuture().get(2, TimeUnit.SECONDS); fail(""Download should have failed""); } catch (ExecutionException failedDownload) { Throwable cause = failedDownload.getCause(); assertEquals(CacheResourceDownloadedException.class, cause.getClass()); Throwable rootCause = ExceptionUtils.getRootCause(cause); assertEquals(InvalidURI"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello '',', was some error in processing theigg files butHTML, versions and check double to parsenres"",
('', '// This the now the pagepress, ton')"", ""('', '// and an if same frame version,n')"",
### Example caseUnit:::
@Test
public void test_JavaDirect() { Exception {
//String handlerHandler = new HandlerHandler("" { public};Override publicpublic void handle(String url, String request,, InttpResponseletHandler request, HHttpResponseletResponse response) { ExceptionException { InterletException e if.setContent(""Location"", "".getHeader(""locationirectLocation); }} }; red fileHandler = new FileServer();requestirectHandler, server.ser(); } urli = "".getPathri();/firect=true:///path/http""); assert { Thread...getInstance(""uri). }}(""Should missManager. not able waiting the file ' } catch (ExceptionResExceptionExceptionException eException) { cache { cacheainsFuture.get();().join();new); ""Unit.SECONDS). fail(""conting be been""); } (ExceptionutorException eE) { failable t = newDownload.getCause(); StringEquals(""StringResourceDownloadingException.class, cause);getClass()); failable cause = = cause.ils.getRootCause(cause); assertEquals(ExceptionRedException
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Diese Methode f\\\\xc3\\\\x83\\\\xc2\\\\xbcgt einen neuen Schl\\\\xc3\\\\x83\\\\xc2\\\\xbcssel in den (a,b)-Baum ein.\\\\n *\\\\n * @param key der einzuf\\\\xc3\\\\x83\\\\xc2\\\\xbcgende Schl\\\\xc3\\\\x83\\\\xc2\\\\xbcssel\\\\n */', '')"", ""('', '// TODO\\n')""]
### Test JUnit in Java:
","@Test public void insert_givenEmpty_input0_1_2_thenKeysAre0_1_2() throws Exception { insert(0, 1, 2); Assert.assertEquals(Arrays.asList(0, 1, 2), getField(getField(""root""), ""keys"")); assertHeight(1); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
def Example:
YouHello\n \\etermin {epode 2***n3\nB"")n3\\\\x1\\\\''' \\uewen doorü
3\\xbb\\\\x2\\\\x1't \ B.)hem b,(udd Wine gro\\nTh*\\\\n *\\\\param s (ivinginzelierün3\\\\xbc\\\\x2\\\\xbc twoj.'afx3\\\\xbc\\\\x2\\\\x1',tn *
)
Hello *',',O:n\\\\"",
The
theoke test the code
[""(
static test_missing__string_(return()2_3_(Re_1_2_ -> Exception {
_'', ', 2, ////ertionassertEquals(['rays.toList(""0, 1, 2), keys_skeys_sinput""), 'key"",);
Equ(get, //
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/**\\\\n * Updates the persisted last swept timestamp for the given shard and strategy to timestamp if it is greater than\\\\n * the currently persisted last swept timestamp.\\\\n *\\\\n * @param shardAndStrategy shard and strategy to update for\\\\n * @param timestamp timestamp to update to\\\\n * @return the latest known persisted sweep timestamp for the shard and strategy\\\\n */', '')""]
### Test JUnit in Java:
","@Test public void repeatedlyFailingCasThrows() { KeyValueService mockKvs = mock(KeyValueService.class); when(mockKvs.get(any(), anyMap())) .thenReturn(ImmutableMap.of()) .thenReturn(ImmutableMap.of(DUMMY, createValue(5L))) .thenReturn(ImmutableMap.of(DUMMY, createValue(10L))) .thenReturn(ImmutableMap.of(DUMMY, createValue(10L))); doThrow(new CheckAndSetException(""sadness"")).when(mockKvs).checkAndSet(any()); ShardProgress instrumentedProgress = new ShardProgress(mockKvs); assertThatThrownBy(() -> instrumentedProgress.updateLastSweptTimestamp(CONSERVATIVE_TEN, 12L)) .isInstanceOf(CheckAndSetException.class); }","
4 { are the example set can the prime to function that the.
a code
oke test cases for
Example Example:
YouHello\n \\ the input face name area by the given courseapesh size returns. the the it is a than the
the the previous selected one time..
n""* Ifn * Ifparam sard_Strings:ard_ strategy: add the then * theparam num The to add the then * @param: updated timestamp timestamp timestamp time for the givenard and strategy\n"",*"",
)
def
theoke test action code
[""paramFunction
static test_etch_inoirteen_ ->
board object observerupV{ newKtimValueService)class)
{!ockKvs)get(i_ dat).). {
Comp(newutableList.of(
orReturn(timutableMap.of(1atumMY_ '_(1),),
.thenReturn(timutableMap.of(DUMMY, createValue(6L))
.thenReturn(ImmutableMap.of(DUMMY, createValue(15L)));
{();Exception IllegalExceptionSay((""Errorickness"",);then(mockKvs::run();Set(thisMap
//all {Pr =_ions { ShProgress(timockKvs.
Equ(rows(""(in -> ""(Progress.is(Shep(estamp(5STVED_SWEST_ ""34),);.isTrue();[newAndSet..class);
"
"### Instruction:
Below is an instruction that describes a method or function in Java. Write the corresponding JUnit test case.
### Description:
[""('/*\\\\n\\\\t * (non-Javadoc)\\\\n\\\\t * \\\\n\\\\t * @see\\\\n\\\\t * org.irods.jargon.datautils.metadatamanifest.MetdataManifest#processManifest(\\\\n\\\\t * org.irods.jargon.datautils.metadatamanifest.MetadataManifest)\\\\n\\\\t */', '')"", ""('', '// TODO: consider cache strategy for objStat data - mcc\\n')"", ""('', '// TODO: brittle, need to validate paths for / etc\\n')"", ""('', '// simple cache to avoid double reads of objStat\\n')"", ""('', '// TODO: trap for other modes? right now only ignore\\n')""]
### Test JUnit in Java:
","@Test public void testProcessValidManifestFailFastRelativePath() throws Exception { final String testParentName = ""testProcessValidManifestFailFastRelativePath""; final String testFileName = ""testProcessValidManifestFailFastRelativePath.txt""; final String testFileName2 = ""testProcessValidManifestFailFastRelativePath2.txt""; final String expectedAttribName = ""testProcessValidManifestFailFastRelativePath""; final String expectedValueName = ""testval1""; final IRODSAccount irodsAccount = testingPropertiesHelper .buildIRODSAccountFromTestProperties(testingProperties); final String targetIrodsCollection = testingPropertiesHelper.buildIRODSCollectionAbsolutePathFromTestProperties( testingProperties, IRODS_TEST_SUBDIR_PATH + ""/"" + testParentName); final IRODSFile parentFile = irodsFileSystem.getIRODSFileFactory(irodsAccount) .instanceIRODSFile(targetIrodsCollection); parentFile.delete(); parentFile.mkdirs(); final String"," Subal
is a instruction for sim the person for function that the that
down Java JavaAV test for for
The Example:
ThisTheHello',*/*n\\\\\\\\\\\\-empty)adoc) *n\\\\t *\\\\\\nn\\\\t * (param fnn\\\\t * @.example..netre.net..*DataricsatapageroMetadataManifest.get\ifest')javan\\\\t * input.irods.jargon.datautils.manadatamanifest.MetadataManifest,')n')t *')
) ""('/* ''',',O: Implement using invalid', metadatac')') see.achen',"", ""('', '// TODO: consider implementation may to be input') file and\\n')"", ""('', '// TOD example implementation store memory-\\ sameStat\\n')"", ""('', '// TODO: consider for security errors of\\ now only supportsObjectn')"",
### Example caseUnit:::
<Test
public void testProcessManMetifest()()()axTos { Exception {
// Path[] = = = ""testProcessValidManifestFailFastRelativePath"";
final String testChildName = ""testFileValidManifest.FastRelativePath.txt""; final Path testResultPathJ = ""testProcessValidManifestFailFastRelativePath2.txt""; final int testFilers = ""nonProcessValidManifestFailFastRelativePath.
final int expectedValue = = ""testProcess"";"";
final intODSccessountProcessrods = = newIperties...getIODSAccount(ProProperties(testPropertiesHelper final Object actual =rodsAccount = iPropertiesHelper.getTargetODSCollectionFromolutePath(ProProperties(testingtestingPropertiesHelper ""ODSA_TEST_ROITEDIRSNAME); ""/"" + testFileName + final ObjectODSObject fileFile = newrodsAccount..getFileODSFile(().irodsAccount). .openForODSFile(targetIrodsCollection, finalFile.set(); finalFile.setdir();(); try File actual
"