DXPVariantUtil { public static DXPVariant toDXPVariant( Locale locale, SegmentsExperimentRel segmentsExperimentRel) throws PortalException { DXPVariant dxpVariant = new DXPVariant(); dxpVariant.setChanges(0); dxpVariant.setControl(segmentsExperimentRel.isControl()); dxpVariant.setDXPVariantId( segmentsExperimentRel.getSegmentsExperienceKey()); dxpVariant.setDXPVariantName(segmentsExperimentRel.getName(locale)); dxpVariant.setTrafficSplit(segmentsExperimentRel.getSplit() * 100); return dxpVariant; } private  DXPVariantUtil(); static DXPVariant toDXPVariant(
			Locale locale, SegmentsExperimentRel segmentsExperimentRel); static List<DXPVariant> toDXPVariantList(
			Locale locale, List<SegmentsExperimentRel> segmentsExperimentRels); static DXPVariants toDXPVariants(
			Locale locale, List<SegmentsExperimentRel> segmentsExperimentRels);  }
@Test public void testToDXPVariant() throws PortalException { Boolean control = RandomTestUtil.randomBoolean(); Locale locale = LocaleUtil.ENGLISH; String segmentsExperienceKey = RandomTestUtil.randomString(); String segmentsExperienceName = RandomTestUtil.randomString(); double split = RandomTestUtil.randomDouble(); SegmentsExperimentRel segmentsExperimentRel = _createSegmentsExperimentRel( control, locale, segmentsExperienceKey, segmentsExperienceName, split); DXPVariant dxpVariant = DXPVariantUtil.toDXPVariant( locale, segmentsExperimentRel); Assert.assertEquals(Integer.valueOf(0), dxpVariant.getChanges()); Assert.assertEquals( segmentsExperimentRel.isControl(), dxpVariant.isControl()); Assert.assertEquals( segmentsExperimentRel.getSegmentsExperienceKey(), dxpVariant.getDXPVariantId()); Assert.assertEquals( segmentsExperimentRel.getName(locale), dxpVariant.getDXPVariantName()); Assert.assertEquals( segmentsExperimentRel.getSplit(), dxpVariant.getTrafficSplit() / 100, 0.001); }