@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); if (getSegmentsCount() > 0) { hash = (37 * hash) + SEGMENTS_FIELD_NUMBER; hash = (53 * hash) + getSegmentsList().hashCode(); } hash = (37 * hash) + DELEGATIONTOKEN_FIELD_NUMBER; hash = (53 * hash) + getDelegationToken().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
.putAllFrom(from1).putAllTo(to1).build(), result1); Assert.assertEquals(2, result1.get().getSegmentsCount()); .putAllFrom(from2).putAllTo(to2).build(), result2); Assert.assertEquals(2, result2.get().getSegmentsCount()); .putAllFrom(from3).putAllTo(to3).build(), result3); Assert.assertEquals(2, result3.get().getSegmentsCount());
@Test public void testStreamCutRequestAndResponse() { List<SegmentId> segments = Collections.singletonList(SegmentId.newBuilder().setStreamInfo(Controller.StreamInfo.newBuilder(). setScope("testScope").setStream("testStream")).build()); AssertExtensions.assertThrows("invalid scope and stream", () -> ModelHelper.createStreamCutRangeResponse("scope", "stream", segments, ""), e -> e instanceof IllegalArgumentException); Controller.StreamCutRangeResponse response = ModelHelper.createStreamCutRangeResponse("testScope", "testStream", segments, ""); Assert.assertEquals(1, response.getSegmentsCount()); final SegmentId resultSegmentID = response.getSegments(0); assertEquals("testScope", resultSegmentID.getStreamInfo().getScope()); assertEquals("testStream", resultSegmentID.getStreamInfo().getStream()); assertEquals(0L, resultSegmentID.getSegmentId()); }