Source:
<code>public void testSegmentMetadataHolderNumRows() { Map<DataSegment, SegmentMetadataHolder> segmentsMetadata = schema.getSegmentMetadata(); Set<DataSegment> segments = segmentsMetadata.keySet(); <START> Assert.assertEquals(segments.size(), 3); <END> DataSegment existingSegment = segments.stream().findFirst().orElse(null); Assert.assertFalse(existingSegment == null); SegmentMetadataHolder existingHolder = segmentsMetadata.get(existingSegment); SegmentMetadataHolder updatedHolder = SegmentMetadataHolder.from(existingHolder).withNumRows(5).build(); schema.setSegmentMetadataHolder(existingSegment, updatedHolder); ImmutableDruidServer server = null; for (ImmutableDruidServer druidServer : druidServers) { for (DataSegment segment : druidServer.getSegments()) { if (segment == existingSegment) { server = druidServer; } } } Assert.assertFalse(server == null); final DruidServerMetadata druidServerMetadata = server.getMetadata(); schema.addSegment(druidServerMetadata, existingSegment); segmentsMetadata = schema.getSegmentMetadata(); existingSegment = segments.stream().findFirst().orElse(null); final SegmentMetadataHolder currentHolder = segmentsMetadata.get(existingSegment); Assert.assertEquals(updatedHolder.getNumRows(), currentHolder.getNumRows()); }</code><technical_language>arguments order. expected argument</technical_language>

Target:
public void testSegmentMetadataHolderNumRows() { Map<DataSegment, SegmentMetadataHolder> segmentsMetadata = schema.getSegmentMetadata(); final Set<DataSegment> segments = segmentsMetadata.keySet(); Assert.assertEquals(3, segments.size()); final DataSegment existingSegment = segments.stream() .filter(segment -> segment.getDataSource().equals("foo2")) .findFirst() .orElse(null); Assert.assertNotNull(existingSegment); final SegmentMetadataHolder existingHolder = segmentsMetadata.get(existingSegment); SegmentMetadataHolder updatedHolder = SegmentMetadataHolder.from(existingHolder).withNumRows(5).build(); schema.setSegmentMetadataHolder(existingSegment, updatedHolder); final Pair<ImmutableDruidServer, DataSegment> pair = druidServers.stream() .flatMap(druidServer -> druidServer.getSegments() .stream() .filter(segment -> segment .equals( existingSegment)) .map(segment -> Pair .of( druidServer, segment ))) .findAny() .orElse(null); Assert.assertNotNull(pair); final ImmutableDruidServer server = pair.lhs; Assert.assertNotNull(server); final DruidServerMetadata druidServerMetadata = server.getMetadata(); schema.addSegment(druidServerMetadata, existingSegment); segmentsMetadata = schema.getSegmentMetadata(); final DataSegment currentSegment = segments.stream() .filter(segment -> segment.getDataSource().equals("foo2")) .findFirst() .orElse(null); final SegmentMetadataHolder currentHolder = segmentsMetadata.get(currentSegment); Assert.assertEquals(updatedHolder.getSegmentId(), currentHolder.getSegmentId()); Assert.assertEquals(updatedHolder.getNumRows(), currentHolder.getNumRows()); Assert.assertEquals(updatedHolder.getNumReplicas(), currentHolder.getNumReplicas()); Assert.assertEquals(updatedHolder.isAvailable(), currentHolder.isAvailable()); Assert.assertEquals(updatedHolder.isPublished(), currentHolder.isPublished()); }