DotDelegator { public static short mnemonicsChecks( String channelPayload, String dataPayload, String version ) { if(channelPayload.equals("")){ if ("1.4.1.1".equals(version)&& !dataPayload.equals("")) { JSONObject dataObject = new JSONObject(dataPayload); String[] dataMnemonicList = dataObject.getString("mnemonicList").split(","); if (duplicates(dataMnemonicList)) { return (short)-447; } } return (short) 1; } JSONArray channelJSONarray = new JSONArray(channelPayload); String[] channelMnemonicList = new String[channelJSONarray.length()]; for (int n = 0; n < channelJSONarray.length(); n++) { JSONObject channelObject = channelJSONarray.getJSONObject(n); channelMnemonicList[n] = channelObject.getString("mnemonic"); } if (duplicates(channelMnemonicList)) { return (short)-447; } if ( "1.4.1.1".equals(version) && !dataPayload.equals("") ) { JSONObject dataObject = new JSONObject(dataPayload); String[] dataMnemonicList = dataObject.getString("mnemonicList") .split(","); if (duplicates(dataMnemonicList)) { return (short)-447; } if ( channelMnemonicList.length > 0 ) { if (channelMnemonicList.length == dataMnemonicList.length+1) { for (int i = 0; i < channelMnemonicList.length - 2; i++) { if (!channelMnemonicList[i+1].equals(dataMnemonicList[i])) { return (short) -460; } } } else { return (short) -460; } } } return (short)1; } DotDelegator(Map<String, String> config); void deleteObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); void performElementDelete(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); void updateObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); String updateFluidsReport(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); void updateLog(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client, String payload); String getUuid(AbstractWitsmlObject witsmlObj, String uid, DotClient client, String username,
			String password, String exchangeID); String createObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); String createFluidsReportObject(AbstractWitsmlObject witsmlObj, String username, String password,
			String exchangeID, DotClient client); String createLogObject(AbstractWitsmlObject witsmlObj, String username, String password, String exchangeID,
			DotClient client); static short mnemonicsChecks( String channelPayload,
										 String dataPayload,
										 String version ); HttpResponse<String> performPost(String payload, String endpoint, HashMap<String, String> requestParams,
			DotClient client, String username, String password, String exchangeID); String[] getMappedPayloads4Log(String version, String payload, AbstractWitsmlObject witsmlObj); AbstractWitsmlObject getObject(AbstractWitsmlObject witsmlObject, String username, String password,
			String exchangeID, DotClient client, Map<String, String> optionsIn); ArrayList<AbstractWitsmlObject> search(AbstractWitsmlObject witsmlObject, String username, String password,
			String exchangeID, DotClient client, Map<String, String> optionsIn);  }
@Test public void shouldCheckDuplicateMnemonicsInRequest() throws Exception{ String channelPayload=TestUtilities.getResourceAsString("updateTest/DuplicateMnemonicsChannelPayload.json"); String dataPayload=TestUtilities.getResourceAsString("updateTest/DuplicateMnemonicsDataPayload.json"); String version="1.4.1.1"; int resultCode=DotDelegator.mnemonicsChecks(channelPayload, dataPayload, version); assertEquals(-447, resultCode); }