auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Response localEntryGet(String apiName, String label, String apiId, MessageContext messageContext){ InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); JSONArray localEntryArray = new JSONArray(); if (gatewayAPIDTO != null) { if (gatewayAPIDTO.getLocalEntriesToBeAdd() != null) { LocalEntryServiceProxy localEntryServiceProxy = new LocalEntryServiceProxy(gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO localEntry : gatewayAPIDTO.getLocalEntriesToBeAdd()) { try { if (localEntryServiceProxy.isEntryExists(localEntry.getName())) { localEntryArray.put(localEntryServiceProxy.getEntry(localEntry.getName())); } else { <START> log.error(localEntry.getName() + " was not deployed in the gateway"); <END> } } catch (AxisFault axisFault) { log.error("Error in fetching deployed Local entries from Synapse Configuration." , axisFault); } } } responseObj.put("LocalEntry", localEntryArray); String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }</code><technical_language>this in response</technical_language>

Target:
public Response localEntryGet(String apiName, String label, String apiId, MessageContext messageContext){ InMemoryAPIDeployer inMemoryApiDeployer = new InMemoryAPIDeployer(); GatewayAPIDTO gatewayAPIDTO = inMemoryApiDeployer.getAPIArtifact(apiId, label); JSONObject responseObj = new JSONObject(); if (gatewayAPIDTO != null) { try { JSONArray localEntryArray = new JSONArray(); JSONArray UnDeploeydLocalEntryArray = new JSONArray(); if (gatewayAPIDTO.getLocalEntriesToBeAdd() != null) { LocalEntryServiceProxy localEntryServiceProxy = new LocalEntryServiceProxy(gatewayAPIDTO.getTenantDomain()); for (GatewayContentDTO localEntry : gatewayAPIDTO.getLocalEntriesToBeAdd()) { if (localEntryServiceProxy.isEntryExists(localEntry.getName())) { localEntryArray.put(localEntryServiceProxy.getEntry(localEntry.getName())); } else { log.error(localEntry.getName() + " was not deployed in the gateway"); UnDeploeydLocalEntryArray.put(localEntry.getContent()); } } } responseObj.put("Deployed Local Entries", localEntryArray); responseObj.put("Undeployed Local Entries", UnDeploeydLocalEntryArray); } catch (AxisFault e) { String errorMessage = "Error in fetching deployed artifacts from Synapse Configuration"; log.error(errorMessage, e); RestApiUtil.handleInternalServerError(errorMessage, e, log); } String responseStringObj = String.valueOf(responseObj); return Response.ok().entity(responseStringObj).build(); } else { responseObj.put("Message", "Error"); String responseStringObj = String.valueOf(responseObj); return Response.serverError().entity(responseStringObj).build(); } }
Source:
<code>public void onClick() { super.onClick(); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(mContext.getText(R.string.cdma_call_waiting)); builder.setMessage(mContext.getText(R.string.enable_cdma_call_waiting_setting)); builder.setPositiveButton(R.string.enable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(true, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); } }); builder.setNegativeButton(R.string.disable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(false, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); } }); builder.create().show(); <START> if (mTcpListener != null) { mTcpListener.onStarted(this, false); } <END> }</code><technical_language>This create TCP listener dialog top of other alert dialog. Is this case? this instead of button's click event new is set</technical_language>

Target:
public void onClick() { super.onClick(); AlertDialog.Builder builder = new AlertDialog.Builder(mContext); builder.setTitle(mContext.getText(R.string.cdma_call_waiting)); builder.setMessage(mContext.getText(R.string.enable_cdma_call_waiting_setting)); builder.setPositiveButton(R.string.enable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(true, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); if (mTcpListener != null) { mTcpListener.onStarted(CdmaCallWaitingPreference.this, false); } } }); builder.setNegativeButton(R.string.disable_cdma_cw, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mPhone.setCallWaiting(false, mHandler.obtainMessage(MyHandler.MESSAGE_SET_CALL_WAITING)); if (mTcpListener != null) { mTcpListener.onStarted(CdmaCallWaitingPreference.this, false); } } }); builder.create().show(); }
Source:
<code>public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = method.getMethod(); Class<?>[] types = jMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); logger.debug("json retrieved: " + content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; <START> JsonElement node = root.get(name); <END> if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); return params; } else { params[i] = gson.fromJson(node, types[i]); } } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }</code><technical_language>this comparison is required avoid NullPointerException</technical_language>

Target:
public Object[] deserialize(InputStream inputStream, ResourceMethod method) { Method jMethod = method.getMethod(); Class<?>[] types = jMethod.getParameterTypes(); if (types.length == 0) { throw new IllegalArgumentException( "Methods that consumes representations must receive just one argument"); } Gson gson = getGson(); Object[] params = new Object[types.length]; String[] parameterNames = paramNameProvider.parameterNamesFor(jMethod); try { String content = getContentOfStream(inputStream); logger.debug("json retrieved: {}", content); JsonParser parser = new JsonParser(); JsonObject root = (JsonObject) parser.parse(content); for (int i = 0; i < types.length; i++) { String name = parameterNames[i]; JsonElement node = root.get(name); if (isWithoutRoot(types, node)) { params[i] = gson.fromJson(root, types[i]); logger.info("json without root deserialized"); } else if(node != null){ params[i] = gson.fromJson(node, types[i]); } logger.debug("json deserialized: {}", params[i]); } } catch (Exception e) { throw new ResultException("Unable to deserialize data", e); } return params; }
Source:
<code>private boolean validateResultSet(ResultSet rs) throws IOException{ if (rs == null) { return false; } try { ResultSetMetaData rsMetadata = rs.getMetaData(); if (CUD_RESULT_SET_COLUMN_NAMES.contains(rsMetadata.getColumnName(1))) { result.totalCount++; result.successCount++; return false; } return true; } catch (SQLException e) { if(dieOnError) { throw new IOException(e); <START> } <END> } return false; }</code><technical_language>add some log message here? is good practice ignore exception</technical_language>

Target:
private boolean validateResultSet(ResultSet rs) throws IOException { if (rs == null) { return false; } try { ResultSetMetaData rsMetadata = rs.getMetaData(); if (CUD_RESULT_SET_COLUMN_NAMES.contains(rsMetadata.getColumnName(1))) { result.totalCount++; result.successCount++; return false; } return true; } catch (SQLException e) { if (dieOnError) { throw new IOException(e); } LOGGER.warn(I18N_MESSAGES.getMessage("error.resultSetIssue"), e); } return false; }
Source:
<code>protected String[] parseUri(DynamicAwareEntry entry) { String scheme = entry.getProperties().get("protocol"); String host = entry.getProperties().get("host"); String port = entry.getProperties().get("port"); String path = entry.getProperties().get("path"); <START> String s = scheme + "://" + host; <END> if (port != null) { s += ":" + port; } return new String[]{s, path}; }</code><technical_language>a small improvement renaming origin uriBeginning</technical_language>

Target:
protected String[] parseUri(DynamicAwareEntry entry) { String scheme = entry.getProperties().get("protocol"); String host = entry.getProperties().get("host"); String port = entry.getProperties().get("port"); String path = entry.getProperties().get("path"); String baseUrl = scheme + "://" + host; if (port != null) { baseUrl += ":" + port; } return new String[]{baseUrl, path}; }
Source:
<code>public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfoWrapper activeNetworkInfo = new NetworkInfoWrapper(connectivityManager.getActiveNetworkInfo()); <START> return activeNetworkInfo.isConnectedOrConnecting(); <END> }</code><technical_language>is NetworkInfoWrapper else here? if so, sole purpose is hide a null check a separate wrapper class isnt justified</technical_language>

Target:
public static boolean isNetworkAvailable(Context context) { ConnectivityManager connectivityManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo.isConnectedOrConnecting(); }
Source:
<code>public void intercept(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!"common".equals(strategy)) { return; } if (isEphemeral(osEnv.getAttributes())) { return; } <START> String namespace = identity.getInfrastructureNamespace(); PodResource<Pod, DoneablePod> podResource = clientFactory .create(identity.getWorkspaceId()) .pods() .inNamespace(namespace) .withName(ASYNC_STORAGE); if (podResource.get() == null) { return; } <END> try { doDeletePod(identity.getWorkspaceId(), namespace).get(5, TimeUnit.MINUTES); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException( "Interrupted while waiting for pod removal. " + ex.getMessage()); } catch (ExecutionException ex) { throw new InfrastructureException( "Error occurred while waiting for pod removal. " + ex.getMessage()); } catch (TimeoutException ex) { throw new InfrastructureException("Pod removal timeout reached " + ex.getMessage()); } }</code><technical_language>@vparfonov I missing this part. find Async storage pod if exist. please clarify a bit. worth moving a separate method</technical_language>

Target:
public void intercept(OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { if (!COMMON_STRATEGY.equals(pvcStrategy) || isEphemeral(osEnv.getAttributes())) { return; } String namespace = identity.getInfrastructureNamespace(); String workspaceId = identity.getWorkspaceId(); PodResource<Pod, DoneablePod> asyncStoragePodResource = getAsyncStoragePodResource(namespace, workspaceId); if (asyncStoragePodResource.get() == null) { return; } try { deleteAsyncStoragePod(asyncStoragePodResource) .get(DELETE_POD_TIMEOUT_IN_MIN, TimeUnit.MINUTES); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); throw new InfrastructureException( format( "Interrupted while waiting for pod '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (ExecutionException ex) { throw new InfrastructureException( format( "Error occurred while waiting for pod '%s' removal. " + ex.getMessage(), ASYNC_STORAGE), ex); } catch (TimeoutException ex) { throw new InfrastructureException( format("Pod '%s' removal timeout reached " + ex.getMessage(), ASYNC_STORAGE), ex); } }
Source:
<code>public void getMetadataTest() throws Exception { String fname = datasets[0]; HPCCFile file = new HPCCFile(fname, connString, hpccUser, hpccPass); DFUFileDetailWrapper meta=file.getOriginalFileMetadata(); assertNotNull("Meta was null for this file",meta); assertNotNull("Record count was null for this file",meta.getRecordCount()); assertEquals(expectedCounts[0],new Long(meta.getRecordCountInt64()).intValue()); <START> file=new HPCCFile("notthere",connString,hpccUser,hpccPass); <END> meta=file.getOriginalFileMetadata(); assertNull("Meta should be null for nonexistent file",meta); }</code><technical_language>2 separate tests</technical_language>

Target:
public void getMetadataTest() throws Exception { String fname = datasets[0]; HPCCFile file = new HPCCFile(fname, connString, hpccUser, hpccPass); DFUFileDetailWrapper meta=file.getOriginalFileMetadata(); assertNotNull("Meta was null for this file",meta); assertNotNull("Record count was null for this file",meta.getRecordCount()); assertEquals(expectedCounts[0],new Long(meta.getRecordCountInt64()).intValue()); }
Source:
<code>public void testIsValid() { int hours = -18; while (true) { ZoneOffset offset = ZoneOffset.ofHours( hours ); OffsetDateTime future = OffsetDateTime.now( offset ).plusHours( 1 ); OffsetDateTime past = OffsetDateTime.now( offset ).minusHours( 1 ); <START> assertTrue( constraint.isValid( null, null ) ); <END> assertTrue( constraint.isValid( past, null ) ); assertFalse( constraint.isValid( future, null ) ); hours++; if (hours > 18) { break; } } }</code><technical_language>assert method takes description string (maybe including relevant date and/or offset message). Unfortunately, test for constraint validators a bit sloppy assertTrue(condition), if rest of test, notice provide a message. helps a test fails. In loop tricky, if a test fails, is telling in iteration so, start debugging. test is :-)</technical_language>

Target:
public void testIsValid() { assertTrue( constraint.isValid( null, null ), "null fails validation." ); for ( int i = -18; i <= 18; i++ ) { ZoneOffset offset = ZoneOffset.ofHours( i ); OffsetDateTime future = OffsetDateTime.now( offset ).plusHours( 1 ); OffsetDateTime past = OffsetDateTime.now( offset ).minusHours( 1 ); assertTrue( constraint.isValid( past, null ), "Past OffsetDateTime '" + past + "' fails validation."); assertFalse( constraint.isValid( future, null ), "Future OffsetDateTime '" + future + "' validated as past."); } }
Source:
<code>public GroupsManagerBlImpl(GroupsManagerImplApi groupsManagerImpl) { this.groupsManagerImpl = groupsManagerImpl; this.groupSynchronizerThreads = new HashMap<>(); <START> this.queueOfGroupsToBeSynchronized = new ConcurrentLinkedDeque<>(); <END> this.maxConcurentGroupsToSynchronize = BeansUtils.getCoreConfig().getGroupMaxConcurentGroupsToSynchronize(); }</code><technical_language>do detect problems set default</technical_language>

Target:
public GroupsManagerBlImpl(GroupsManagerImplApi groupsManagerImpl) { this.groupsManagerImpl = groupsManagerImpl; this.groupSynchronizerThreads = new ArrayList<>(); this.poolOfGroupsToBeSynchronized = new PerunBeanProcessingPool<>(); this.maxConcurentGroupsToSynchronize = BeansUtils.getCoreConfig().getGroupMaxConcurentGroupsToSynchronize(); }
Source:
<code>private void onClassNotFoundException(String className, ClassLoader classLoader, ClassNotFoundException e) { if (className.startsWith("com.hazelcast")) { LOGGER.fine("Failed to load " + className + " by " + classLoader <START> + ". This indicates a classloading issue. It can happen at runtime with " <END> + "a complicated classloading model (OSGi, Java EE, etc)"); } else { throw new HazelcastException(e); } }</code><technical_language>I original referring a specific runtime environment (OSGi, Java EE) execution time; I "in a runtime" correct</technical_language>

Target:
private void onClassNotFoundException(String className, ClassLoader classLoader, ClassNotFoundException e) { if (className.startsWith("com.hazelcast")) { LOGGER.fine("Failed to load " + className + " by " + classLoader + ". This indicates a classloading issue. It can happen in a runtime with " + "a complicated classloading model (OSGi, Java EE, etc)"); } else { throw new HazelcastException(e); } }
Source:
<code>public static Endpoint valueOf(String str) { int lastColon = str.lastIndexOf(':'); <START> String host = str.substring(0, lastColon); <END> String port = str.substring(lastColon+1); if (host.startsWith("[")) { if (!host.contains("]")) { throw new IllegalArgumentException(String.format("Endpoint contains an invalid host '%s'. " + "IPv6 address literals must be enclosed in '[' and ']' according to RFC 2732", str)); } host = host.substring(1, host.lastIndexOf(']')); } return create(host, Integer.parseInt(port)); }</code><technical_language>handled before, I add like: if(lastColon == -1) { throw new IllegalArgumentException('Invalid endpoint format. Required format is<ip>:<port>.') }</technical_language>

Target:
public static Endpoint valueOf(String str) { int lastColon = str.lastIndexOf(':'); if (lastColon == -1) { throw new IllegalArgumentException(String.format("Invalid endpoint format for '%s'. " + "Required format is <ip>:<port>.", str)); } String host = str.substring(0, lastColon); String port = str.substring(lastColon+1); if (host.startsWith("[")) { if (!host.contains("]")) { throw new IllegalArgumentException(String.format("Endpoint contains an invalid host '%s'. " + "IPv6 address literals must be enclosed in '[' and ']' according to RFC 2732", str)); } host = host.substring(1, host.lastIndexOf(']')); } return create(host, Integer.parseInt(port)); }
Source:
<code>public IAtsTeamDefinition getTeamDefinition() { if (teamDef == null) { TeamDefinitionDialog ld = new TeamDefinitionDialog("Select Team", "Select Team"); ld.setInput(TeamDefinitions.getTeamReleaseableDefinitions(Active.Active)); int result = ld.open(); if (result == 0) { <START> return (IAtsTeamDefinition) ld.getResult()[0]; <END> } return null; } else { return teamDef; } }</code><technical_language>Blind casting</technical_language>

Target:
private IAtsTeamDefinition getTeamDefinition() { if (teamDef == null) { TeamDefinitionDialog ld = new TeamDefinitionDialog("Select Team", "Select Team"); ld.setInput(TeamDefinitions.getTeamReleaseableDefinitions(Active.Active)); int result = ld.open(); if (result == 0) { return (IAtsTeamDefinition) ld.getResult()[0]; } return null; } else { return teamDef; } }
Source:
<code>public String toString() { <START> return ToStringBuilder.forInstance(this) <END> .append("JobId", jobId) .append("StepId", stepId) .append("Execution Method", executionMethod).build(); }</code><technical_language>Do a reason add instance variables string representation</technical_language>

Target:
public String toString() { return ToStringBuilder.forInstance(this) .append("jobId", jobId) .append("stepId", stepId) .append("executionMethod", executionMethod) .append("isMonitored", isMonitored) .append("shouldEndJob", shouldEndJob) .append("tasksMonitored", tasksMonitored) .append("completed", completed) .append("jobRequired", jobRequired).build(); }
Source:
<code>public void testStatsForValuesNodeWithJustNulls() { PlanNodeStatsEstimate nullAStats = PlanNodeStatsEstimate.builder() .setOutputRowCount(1) .addSymbolStatistics( new Symbol("a"), <START> SymbolStatsEstimate.builder() <END> .setLowValue(NaN) .setHighValue(NaN) .setNullsFraction(1.0) .setDistinctValuesCount(0.0) .build()) .build(); tester.assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("3 + null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester.assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester.assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", UNKNOWN)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); }</code><technical_language>empty</technical_language>

Target:
public void testStatsForValuesNodeWithJustNulls() { PlanNodeStatsEstimate nullAStats = PlanNodeStatsEstimate.builder() .setOutputRowCount(1) .addSymbolStatistics(new Symbol("a"), SymbolStatsEstimate.ZERO_STATS) .build(); tester().assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("3 + null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester().assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", BIGINT)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); tester().assertStatsFor(pb -> pb .values(ImmutableList.of(pb.symbol("a", UNKNOWN)), ImmutableList.of( ImmutableList.of(expression("null"))))) .check(outputStats -> outputStats.equalTo(nullAStats)); }
Source:
<code>public boolean isInitialized() { try { <START> keyValueService.getClusterAvailabilityStatus(); <END> return scrubberStore.isInitialized(); } catch (NotInitializedException ex) { return false; } }</code><technical_language>check isInitialized() now, right</technical_language>

Target:
public boolean isInitialized() { return keyValueService.isInitialized() && scrubberStore.isInitialized(); }
Source:
<code>public synchronized void waitForExit() { while (getStatus() <= STOPPING) { try { <START> waitStatus(STOPPING); <END> } catch (InterruptedException e) { throw new Error(); } } }</code><technical_language>do need this change</technical_language>

Target:
public synchronized void waitForExit() { while (getStatus() <= STOPPING) { try { waitStatus(STOPPED); } catch (InterruptedException e) { throw new Error(); } } }
Source:
<code>public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); if (ssrc == null) { return pkts; } AbstractFECReceiver fpt; synchronized (fecReceivers) { fpt = fecReceivers.get(ssrc); if (fpt == null) { try <START> { <END> Constructor ctor = fecReceiverType.getConstructor(long.class, byte.class); fpt = (AbstractFECReceiver)ctor.newInstance(ssrc, incomingPT); fecReceivers.put(ssrc, fpt); } catch (InstantiationException | IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { logger.error("Error creating the FEC receiver " + "implementation (" + fecReceiverType.getName() + "): " + e.toString()); return pkts; } } } return fpt.reverseTransform(pkts); }</code><technical_language>a flag determines ulpfec flexfec. get a situation abundance of FEC implementations choose from, implement a generic solution :)</technical_language>

Target:
public RawPacket[] reverseTransform(RawPacket[] pkts) { if (incomingPT == -1 || pkts == null) return pkts; Long ssrc = findSSRC(pkts); if (ssrc == null) { return pkts; } AbstractFECReceiver fpt; synchronized (fecReceivers) { fpt = fecReceivers.get(ssrc); if (fpt == null) { if (fecType == FecType.ULPFEC) { fpt = new ULPFECReceiver(ssrc, incomingPT); } else { logger.error("Unknown fec type set: " + fecType); } } } return fpt.reverseTransform(pkts); }
Source:
<code>private Collection<KnowledgePackage> compileDrlString(String content, Collection<String> flows) throws RuleBaseException { KnowledgeBuilder builder = getConfiguredBuilder(); builder.add(ResourceFactory.newReaderResource(new StringReader(content)), ResourceType.DRL); if (flows != null) { for (String drf : flows) { <START> if (drf != null) { <END> Resource resource = ResourceFactory.newReaderResource(new StringReader(drf)); builder.add(resource, ResourceType.DRF); } } } if (builder.hasErrors()) { System.out.println(content.toString()); throw new RuleBaseException(builder.getErrors().toString()); } return builder.getKnowledgePackages(); }</code><technical_language>y flows null here? (just curious)</technical_language>

Target:
private Collection<KnowledgePackage> compileDrlString(String content, Collection<String> flows) throws RuleBaseException { KnowledgeBuilder builder = getConfiguredBuilder(); builder.add(ResourceFactory.newReaderResource(new StringReader(content)), ResourceType.DRL); if (flows != null) { for (String drf : flows) { Resource resource = ResourceFactory.newReaderResource(new StringReader(drf)); builder.add(resource, ResourceType.DRF); } } if (builder.hasErrors()) { System.out.println(content.toString()); throw new RuleBaseException(builder.getErrors().toString()); } return builder.getKnowledgePackages(); }
Source:
<code>public void showFilterDialog() { if(fTopInput != null) { List<? extends ITimeGraphEntry> allElements = listAllInputs(fTopInput); fFilterDialog.setInput(fTopInput.toArray(new ITimeGraphEntry[0])); fFilterDialog.setTitle(Messages.TmfTimeFilterDialog_WINDOW_TITLE); fFilterDialog.setMessage(Messages.TmfTimeFilterDialog_MESSAGE); fFilterDialog.setExpandedElements(allElements.toArray()); if (fFilter.getFiltered() != null) { ArrayList<? extends ITimeGraphEntry> nonFilteredElements = new ArrayList<ITimeGraphEntry>(allElements); nonFilteredElements.removeAll(fFilter.getFiltered()); fFilterDialog.setInitialElementSelections(nonFilteredElements); } else { fFilterDialog.setInitialElementSelections(allElements); } fFilterDialog.create(); fFilterDialog.open(); if (fFilterDialog.getResult() != null) { fInhibitTreeSelection = true; if (fFilterDialog.getResult().length != allElements.size()) { ArrayList<? extends ITimeGraphEntry> filteredElements = new ArrayList<ITimeGraphEntry>(allElements); filteredElements.removeAll(Arrays.asList(fFilterDialog.getResult())); <START> fFilter.setFiltered(new ArrayList<Object>(filteredElements)); <END> } else { fFilter.setFiltered(null); } fTreeViewer.refresh(); fTreeViewer.expandAll(); fTimeGraphViewer.refresh(); fInhibitTreeSelection = false; if (fFilterDialog.getResult().length > 0) { setSelection((ITimeGraphEntry) fFilterDialog.getResult()[0]); } } } }</code><technical_language>filteredElements ArrayList<Object> need duplicate another array here. for consistency nonFilteredElements ArrayList<Object> above</technical_language>

Target:
public void showFilterDialog() { if(fTopInput != null) { List<? extends ITimeGraphEntry> allElements = listAllInputs(fTopInput); fFilterDialog.setInput(fTopInput.toArray(new ITimeGraphEntry[0])); fFilterDialog.setTitle(Messages.TmfTimeFilterDialog_WINDOW_TITLE); fFilterDialog.setMessage(Messages.TmfTimeFilterDialog_MESSAGE); fFilterDialog.setExpandedElements(allElements.toArray()); if (fFilter.getFiltered() != null) { ArrayList<? extends ITimeGraphEntry> nonFilteredElements = new ArrayList<ITimeGraphEntry>(allElements); nonFilteredElements.removeAll(fFilter.getFiltered()); fFilterDialog.setInitialElementSelections(nonFilteredElements); } else { fFilterDialog.setInitialElementSelections(allElements); } fFilterDialog.create(); fFilterDialog.open(); if (fFilterDialog.getResult() != null) { fInhibitTreeSelection = true; if (fFilterDialog.getResult().length != allElements.size()) { ArrayList<Object> filteredElements = new ArrayList<Object>(allElements); filteredElements.removeAll(Arrays.asList(fFilterDialog.getResult())); fFilter.setFiltered(filteredElements); } else { fFilter.setFiltered(null); } fTreeViewer.refresh(); fTreeViewer.expandAll(); fTimeGraphViewer.refresh(); fInhibitTreeSelection = false; if (fFilterDialog.getResult().length > 0) { setSelection((ITimeGraphEntry) fFilterDialog.getResult()[0]); } } } }
Source:
<code>private char formatFieldFirstCharacterToFitDroolsCoreStandards(final String fieldName) { <START> if (fieldName.length() > 2 && Character.isLowerCase(fieldName.charAt(0)) && Character.isUpperCase(fieldName.charAt(1))) { <END> return fieldName.charAt(0); } else { return Character.toUpperCase(fieldName.charAt(0)); } }</code><technical_language>I condition needs top start fieldName.length() > 1 instead of fieldName.length() > 2 . I generated code getters/setters rules for fields **aField** **aF**. I wrong</technical_language>

Target:
private char formatFieldFirstCharacterToFitDroolsCoreStandards(final String fieldName) { if (fieldName.length() > 1 && Character.isLowerCase(fieldName.charAt(0)) && Character.isUpperCase(fieldName.charAt(1))) { return fieldName.charAt(0); } else { return Character.toUpperCase(fieldName.charAt(0)); } }
Source:
<code>public <T> T getColumn(String column, GenericType<T> type) { <START> return (T) getColumn(column, (Type) type); <END> }</code><technical_language>Ditto: type.getType()</technical_language>

Target:
public <T> T getColumn(String column, GenericType<T> type) { return (T) getColumn(column, type.getType()); }
Source:
<code>private void deleteNetworkResourceGroup(NetworkDeletionRequest networkDeletionRequest) { try { AzureClient azureClient = azureClientService.getClient(networkDeletionRequest.getCloudCredential()); if (resourceGroupExists(azureClient, networkDeletionRequest)) { azureClient.deleteTemplateDeployment(networkDeletionRequest.getResourceGroup(), networkDeletionRequest.getStackName()); azureClient.deleteResourceGroup(networkDeletionRequest.getResourceGroup()); } <START> } catch (CloudException e) { LOGGER.warn("Deletion error, cloud exception happened: ", e); if (e.body() != null && e.body().details() != null) { String details = e.body().details().stream().map(CloudError::message).collect(Collectors.joining(", ")); throw new CloudConnectorException(String.format("Network deletion failed, status code %s, error message: %s, details: %s", e.body().code(), e.body().message(), details)); } else { throw new CloudConnectorException(String.format("Network deletion failed: '%s', please go to Azure Portal for detailed message", e)); <END> } } }</code><technical_language>This is occurrence of this fragment in this class, others, pls extract this logic</technical_language>

Target:
private void deleteNetworkResourceGroup(NetworkDeletionRequest networkDeletionRequest) { try { LOGGER.debug("Deleting network resource group"); AzureClient azureClient = azureClientService.getClient(networkDeletionRequest.getCloudCredential()); if (resourceGroupExists(azureClient, networkDeletionRequest)) { azureClient.deleteTemplateDeployment(networkDeletionRequest.getResourceGroup(), networkDeletionRequest.getStackName()); azureClient.deleteResourceGroup(networkDeletionRequest.getResourceGroup()); } } catch (CloudException e) { throw azureUtils.convertToCloudConnectorException(e, "Network resource group deletion"); } }
Source:
<code>protected void initPort() { Integer portParam = getInitParameter("port", Integer.class); <START> setPort((portParam == null) ? DEFAULT_PORT : portParam); <END> if (isDebug()) { LOGGER.debug("port: {}", getPort()); } }</code><technical_language>Idem this handled Optional..</technical_language>

Target:
protected void initPort() { setPort(Optional.ofNullable(getInitParameter("port", Integer.class)).orElse(DEFAULT_PORT)); if (isDebug()) { LOGGER.debug("port: {}", getPort()); } }
Source:
<code>public void testDeviceClassification() { String userAgentSample = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0"; DeviceClassification d = new DeviceClassification(); d.classifyUseragent(userAgentSample); assertEquals("Vendor as expected", "HTC" , d.getVendor()); <START> assertEquals("Model as expected" , "A6366", d.getModel()); <END> }</code><technical_language>If settle for 1.13 dtree file, A6366 A6380</technical_language>

Target:
public void testDeviceClassification() { String userAgentSample = "Mozilla/5.0 (Linux; U; Android 2.2; en; HTC Aria A6380 Build/ERE27) AppleWebKit/540.13+ (KHTML, like Gecko) Version/3.1 Mobile Safari/524.15.0"; DeviceClassification d = new DeviceClassification(); d.classifyUseragent(userAgentSample); assertEquals("Vendor as expected", "HTC" , d.getVendor()); assertEquals("Model as expected" , "A6380", d.getModel()); }
Source:
<code>public static boolean initialize(Context context) { if (isCloudNotificationsEnabled(context)) { NotificationSubscriber.subscribeToFirebaseServices(); <START> return true; <END> } NotificationSubscriber.unsubscribeFromFirebaseServices(); return false; }</code><technical_language>i personally exit points possible. save isCloudNotificationsEnabled(context) return in a variable, unsub return variable in end. @robertpainsi do agree matter</technical_language>

Target:
public static boolean initialize(Context context) { boolean isEnabled = isCloudNotificationsEnabled(context); if (isEnabled) { messagingService.subscribe(); } else { messagingService.unsubscribe(); } return isEnabled; }
Source:
<code>private void checkSanity(CompactionDetails details) { List<String> segmentsUnderCompaction = details.getLogSegmentsUnderCompaction(); LogSegment lastSegment = null; for (String segmentName : segmentsUnderCompaction) { lastSegment = srcLog.getSegment(segmentName); if (lastSegment == null) { throw new IllegalArgumentException(segmentName + " does not exist in the log"); } } Offset lastSegmentEndOffset = new Offset(lastSegment.getName(), lastSegment.getEndOffset()); if (lastSegmentEndOffset.compareTo(srcIndex.journal.getFirstOffset()) >= 0) { <START> throw new IllegalArgumentException("Some of the offsets provided for compaction are within the jounral"); <END> } }</code><technical_language>journal - typo</technical_language>

Target:
private void checkSanity(CompactionDetails details) { List<String> segmentsUnderCompaction = details.getLogSegmentsUnderCompaction(); LogSegment lastSegment = null; for (String segmentName : segmentsUnderCompaction) { lastSegment = srcLog.getSegment(segmentName); if (lastSegment == null) { throw new IllegalArgumentException(segmentName + " does not exist in the log"); } } Offset lastSegmentEndOffset = new Offset(lastSegment.getName(), lastSegment.getEndOffset()); if (lastSegmentEndOffset.compareTo(srcIndex.journal.getFirstOffset()) >= 0) { throw new IllegalArgumentException("Some of the offsets provided for compaction are within the journal"); } }
Source:
<code>public SearchResult(SearchResultDto searchResultDto) { name = searchResultDto.getItemReference().getName(); path = searchResultDto.getItemReference().getPath(); project = searchResultDto.getItemReference().getProject(); final List<Link> links = searchResultDto.getItemReference().getLinks(); <START> if (!links.isEmpty() && links.contains(Constants.LINK_REL_GET_CONTENT)) { <END> contentUrl = searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT).getHref(); } final List<SearchOccurrenceDto> dtos = searchResultDto.getSearchOccurrences(); occurrences = new ArrayList<>(dtos.size()); for (SearchOccurrence dto : dtos) { occurrences.add(new SearchOccurrenceImpl(dto)); } }</code><technical_language>check links.contains(Constants.LINK_REL_GET_CONTENT) is correct</technical_language>

Target:
public SearchResult(SearchResultDto searchResultDto) { name = searchResultDto.getItemReference().getName(); path = searchResultDto.getItemReference().getPath(); project = searchResultDto.getItemReference().getProject(); if (searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT) != null) { contentUrl = searchResultDto.getItemReference().getLink(Constants.LINK_REL_GET_CONTENT).getHref(); } final List<SearchOccurrenceDto> dtos = searchResultDto.getSearchOccurrences(); occurrences = new ArrayList<>(dtos.size()); for (SearchOccurrence dto : dtos) { occurrences.add(new SearchOccurrenceImpl(dto)); } }
Source:
<code>public ServiceBuilder<RemoteCacheContainer> build(ServiceTarget target) { Function<RemoteCacheManager, RemoteCacheContainer> mapper = remoteCacheManager -> new ManagedRemoteCacheContainer(this.name, remoteCacheManager); Supplier<RemoteCacheManager> supplier = () -> { Configuration configuration = this.configuration.getValue(); RemoteCacheManager remoteCacheManager = new RemoteCacheManager(configuration); remoteCacheManager.start(); InfinispanLogger.ROOT_LOGGER.debugf("%s remote cache container started", this.name); return remoteCacheManager; }; Consumer<RemoteCacheManager> destroyer = remoteCacheManager -> { remoteCacheManager.stop(); InfinispanLogger.ROOT_LOGGER.debugf("%s remote cache container stopped", this.name); }; Service<RemoteCacheContainer> service = new SuppliedValueService<>(mapper, supplier, destroyer); ServiceBuilder<RemoteCacheContainer> builder = target.addService(this.getServiceName(), service) <START> .setInitialMode(ServiceController.Mode.PASSIVE) <END> ; return this.configuration.register(builder); }</code><technical_language>This ON_DEMAND</technical_language>

Target:
public ServiceBuilder<RemoteCacheContainer> build(ServiceTarget target) { Service<RemoteCacheContainer> service = new SuppliedValueService<>(this, this, this); ServiceBuilder<RemoteCacheContainer> builder = new AsynchronousServiceBuilder<>(this.getServiceName(), service).build(target) .setInitialMode(ServiceController.Mode.ON_DEMAND); return this.configuration.register(builder); }
Source:
<code>boolean parseDescriptor(String descriptor) { if (descriptor != null) { String[] descriptorTokens = descriptor.split(" "); if (descriptorTokens.length >= 1) { String model = descriptorTokens[0]; if (model.equals("iPhone")) { String versionString = descriptorTokens[1]; String[] validVersions = {"X", "XS", "XR"}; if (Arrays.asList(validVersions).contains(versionString)) { return true; } if (versionString.matches("\\d[^\\d]")) { versionString = versionString.substring(0, 1); } else if (versionString.matches("\\d{2}[^\\d]")) { versionString = versionString.substring(0, 2); } try { int version = Integer.parseInt(versionString); <START> return version > 5; <END> } catch (Throwable ignore) { } } else { return (model.equals("iPad")) && descriptorTokens[1].equals("Pro"); } } } return false; }</code><technical_language>Yes, if check is wrong. if hardware string is higher (iPhone9,1+ == iPhone 7). @joachimneumann shed some light this</technical_language>

Target:
boolean parseDescriptor(String descriptor) { if (descriptor != null) { String[] descriptorTokens = descriptor.split(" "); if (descriptorTokens.length >= 1) { String model = descriptorTokens[0]; if (model.equals("iPhone")) { String versionString = descriptorTokens[1]; String[] validVersions = {"X", "XS", "XR"}; if (Arrays.asList(validVersions).contains(versionString)) { return true; } String versionSuffix = ""; if (versionString.matches("\\d[^\\d]")) { versionSuffix = versionString.substring(1); versionString = versionString.substring(0, 1); } else if (versionString.matches("\\d{2}[^\\d]")) { versionSuffix = versionString.substring(2); versionString = versionString.substring(0, 2); } try { int version = Integer.parseInt(versionString); return version > 6 || (version == 6 && versionSuffix.equalsIgnoreCase("s")); } catch (Throwable ignore) { } } else { return (model.equals("iPad")) && descriptorTokens[1].equals("Pro"); } } } return false; }
Source:
<code>private static boolean isSingleLineLambda(DetailAST lambda) { boolean result = false; final DetailAST block = lambda.getLastChild(); if (block.getType() != TokenTypes.SLIST) { result = lambda.getLineNo() == block.getLineNo(); final DetailAST elist = block.getFirstChild().findFirstToken(TokenTypes.ELIST); if (elist != null) { result = result && block.getLineNo() == elist.getLastChild().getLineNo(); final DetailAST expr = elist.findFirstToken(TokenTypes.EXPR); if (expr != null && expr.getLastChild().getChildCount() > 1) { result = result && expr.getLastChild().getLastChild().getLineNo() <START> == expr.getLastChild().getLineNo(); <END> } } } return result; }</code><technical_language>"==" intended right, is level of execution "&&"</technical_language>

Target:
private static boolean isSingleLineLambda(DetailAST lambda) { boolean result = false; final DetailAST block = lambda.getLastChild(); if (block.getType() != TokenTypes.SLIST) { result = lambda.getLineNo() == block.getLineNo(); final DetailAST elist = block.getFirstChild().findFirstToken(TokenTypes.ELIST); if (result && elist != null) { result = block.getLineNo() == elist.getLastChild().getLineNo(); final DetailAST expr = elist.findFirstToken(TokenTypes.EXPR); if (result && expr.getLastChild().getChildCount() > 1) { result = expr.getLastChild().getLastChild().getLineNo() == expr.getLastChild().getLineNo(); } } } return result; }
Source:
<code>private void processCommand(final ISYBindingConfig config, final Command command) { if (!this.insteonClient.isISYReady()) { <START> this.logger.warn("ISY is not ready"); <END> return; } UDNode node = null; try { node = this.insteonClient.getNodes().get(config.getController()); } catch (Exception e) { this.logger.warn("no such device, " + config.getController(), e); } if (node == null) { try { node = this.insteonClient.getGroups().get( config.getController()); } catch (Exception e) { this.logger.warn( "no such group found, " + config.getController(), e); } } if (node != null) { executeCommand(config, node, command); } else { this.logger.warn("No node found for address " + config.getController()); } }</code><technical_language>expand message "ISY is ready; dropping command '{}'", command</technical_language>

Target:
private void processCommand(final ISYBindingConfig config, final Command command) { if (!this.insteonClient.isISYReady()) { this.logger .warn("ISY is not ready; dropping command '{}'", command); return; } UDNode node = null; try { node = this.insteonClient.getNodes().get(config.getController()); } catch (Exception e) { this.logger.warn("no such device: '{}' - ", config.getController(), e); } if (node == null) { try { node = this.insteonClient.getGroups().get( config.getController()); } catch (Exception e) { this.logger.warn("no such group found: '{}' - {}", config.getController(), e); } } if (node != null) { executeCommand(config, node, command); } else { this.logger.warn("No node found for address: '{}' ", config.getController()); } }
Source:
<code>public IPAddress getAllocatedTask(final String appId) { while (true) { try { final List<String> taskList = appTaskListMap.getTaskListForApp(appId); if (taskList == null) { List<String> allTaskList; do { allTaskList = taskStatsMap.getTaskList(); } while (allTaskList.isEmpty()); final String selectedTask = getRandomTask(allTaskList); appTaskListMap.addTaskToApp(appId, selectedTask); return taskAddressInfoMap.getClientToTaskAddress(selectedTask); } else { final String selectedTask = getRandomTask(taskList); final double selectedTaskLoad = taskStatsMap.get(selectedTask).getTaskLoad(); if (selectedTaskLoad > overloadedTaskThreshold) { final List<String> remainingList = taskStatsMap.getTaskList(); remainingList.removeAll(taskList); if (!remainingList.isEmpty()) { final String taskCandidate = getRandomTask(remainingList); if (taskStatsMap.get(taskCandidate).getTaskLoad() < overloadedTaskThreshold) { appTaskListMap.addTaskToApp(appId, taskCandidate); return taskAddressInfoMap.getClientToTaskAddress(taskCandidate); } } } return taskAddressInfoMap.getClientToTaskAddress(selectedTask); } <START> } catch (final Exception e) { <END> e.printStackTrace(); LOG.log(Level.INFO, "Exception thrown! This might be because of synchronization issue... Try again!"); } } }</code><technical_language>this exception occur? good reduce area of try{ ...} clause</technical_language>

Target:
public IPAddress getAllocatedTask(final String appId) { taskInfoRWLock.readLock().lock(); final List<String> taskList = appTaskListMap.getTaskListForApp(appId); if (taskList == null) { final List<String> allTaskList = taskStatsMap.getTaskList(); final String selectedTask = getRandomTask(allTaskList); appTaskListMap.addTaskToApp(appId, selectedTask); final IPAddress result = taskAddressInfoMap.getClientToTaskAddress(selectedTask); taskInfoRWLock.readLock().unlock(); return result; } else { final String selectedTask = getRandomTask(taskList); final double selectedTaskLoad = taskStatsMap.get(selectedTask).getTaskLoad(); if (selectedTaskLoad > overloadedTaskThreshold) { final List<String> remainingList = taskStatsMap.getTaskList(); remainingList.removeAll(taskList); if (!remainingList.isEmpty()) { final String taskCandidate = getRandomTask(remainingList); if (taskStatsMap.get(taskCandidate).getTaskLoad() < overloadedTaskThreshold) { appTaskListMap.addTaskToApp(appId, taskCandidate); final IPAddress result = taskAddressInfoMap.getClientToTaskAddress(taskCandidate); taskInfoRWLock.readLock().unlock(); return result; } } } final IPAddress result = taskAddressInfoMap.getClientToTaskAddress(selectedTask); taskInfoRWLock.readLock().unlock(); return result; } }
Source:
<code>public int compareTo(SwiftResource that) { <START> if (that == null) <END> return 1; if (this == that) return 0; return this.getTransactionId().compareTo(that.getTransactionId()); }</code><technical_language>throw NullPointerException</technical_language>

Target:
public int compareTo(SwiftResource that) { return this.getTransactionId().compareTo(that.getTransactionId()); }
Source:
<code>public void onState(final ProgramAB programab) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { startSessionButton.setEnabled(true); if (programab.getSessions().isEmpty()) { startSessionButton.setText("Start Session"); startSessionButton.setBackground(Color.RED); } else { startSessionButton.setText("Force reload ( kill csv )"); startSessionButton.setBackground(Color.GREEN); } if (programab.loading) { startSessionButton.setText("Loading..."); startSessionButton.setBackground(Color.ORANGE); startSessionButton.setEnabled(false); } if (programab.aimlError) { startSessionButton.setText("AIML error"); startSessionButton.setBackground(Color.RED); startSessionButton.setEnabled(false); } progABPath.setText(new File(programab.getPath()).getAbsolutePath()); userName.setText(programab.getCurrentUserName()); botName.setText(programab.getCurrentBotName()); textAreacontent = "<font face=\"Verdana\" size=-1>"; programab.getConversationHistory().stream().forEach(conversation -> { if (conversation == null) { conversation = "ERROR: NULL"; } textAreacontent = textAreacontent + conversation + "<br>"; }); <START> response.setText(textAreacontent); <END> } }); }</code><technical_language>this reconstruct entire content if a new interaction is made? I expected a more efficient (like adding new lines). ok this if other easy way</technical_language>

Target:
public void onState(final ProgramAB programab) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { String botname = programab.getCurrentBotName(); String username = programab.getCurrentUserName(); startSession.setEnabled(true); if (programab.getSessions().isEmpty() || !programab.isReady()) { startSession.setBackground(Color.RED); } else { startSession.setBackground(Color.GREEN); } progABPath.setText(new File(programab.getPath()).getAbsolutePath()); userName.setText(username); botName.removeAllItems(); Iterator<String> iterator = programab.getBots().iterator(); while (iterator.hasNext()) { botName.addItem(iterator.next()); } if (programab.getCurrentBotName() != null) { botName.setSelectedItem(programab.getCurrentBotName()); } } }); }
Source:
<code>public void testSaveTable() { <START> long waiterId = 2L; <END> getRestTestClientBuilder().setUser("chief"); getRestTestClientBuilder().setPassword("chief"); this.service = getRestTestClientBuilder().build(TablemanagementRestService.class); TableEto table = new TableEtoBuilder().number(NUMBER_TABLE_NEW).waiterId(ID_WAITER).createNew(); assertThat(table.getId()).isNull(); TableEto savedTable = this.service.saveTable(table); assertThat(savedTable).isNotNull(); assertThat(savedTable.getId()).isNotNull(); assertThat(savedTable.getState()).isEqualTo(TableState.FREE); assertThat(savedTable.getNumber()).isEqualTo(NUMBER_TABLE_NEW); assertThat(savedTable.getWaiterId()).isEqualTo(ID_WAITER); }</code><technical_language>aint this a dead leftover removed</technical_language>

Target:
public void testSaveTable() { getRestTestClientBuilder().setUser("chief"); getRestTestClientBuilder().setPassword("chief"); this.service = getRestTestClientBuilder().build(TablemanagementRestService.class); TableEto table = new TableEtoBuilder().createNew(); assertThat(table.getId()).isNull(); TableEto savedTable = this.service.saveTable(table); assertThat(savedTable).isNotNull(); assertThat(savedTable.getId()).isNotNull(); assertThat(savedTable.getState()).isEqualTo(TableState.FREE); assertThat(savedTable.getNumber()).isEqualTo(NUMBER_TABLE_NEW); assertThat(savedTable.getWaiterId()).isEqualTo(ID_WAITER); }