AsahSegmentsEntryProvider implements SegmentsEntryProvider { @Override public long[] getSegmentsEntryClassPKs( long segmentsEntryId, int start, int end) throws PortalException { List<SegmentsEntryRel> segmentsEntryRels = _segmentsEntryRelLocalService.getSegmentsEntryRels( segmentsEntryId, start, end, null); Stream<SegmentsEntryRel> stream = segmentsEntryRels.stream(); return stream.mapToLong( SegmentsEntryRel::getClassPK ).toArray(); }  @Override long[] getSegmentsEntryClassPKs(
			long segmentsEntryId, int start, int end); @Override int getSegmentsEntryClassPKsCount(long segmentsEntryId); @Override long[] getSegmentsEntryIds(
		long groupId, String className, long classPK, Context context);  }
@Test public void testGetSegmentsEntryClassPKs() throws PortalException { long[] segmentsEntryRelIds = { RandomTestUtil.randomLong(), RandomTestUtil.randomLong(), RandomTestUtil.randomLong(), RandomTestUtil.randomLong() }; List<SegmentsEntryRel> segmentsEntryRels = new ArrayList<>(); LongStream longStream = Arrays.stream(segmentsEntryRelIds); longStream.forEach( segmentsEntryRelId -> segmentsEntryRels.add( _createSegmentsEntryRel(segmentsEntryRelId))); long segmentsEntryId = RandomTestUtil.randomLong(); Mockito.when( _segmentsEntryRelLocalService.getSegmentsEntryRels( segmentsEntryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null) ).thenReturn( segmentsEntryRels ); Assert.assertArrayEquals( segmentsEntryRelIds, _asahSegmentsEntryProvider.getSegmentsEntryClassPKs( segmentsEntryId, QueryUtil.ALL_POS, QueryUtil.ALL_POS)); }