DataRecordCollectionUtil { public static DataRecordCollection toDataRecordCollection( DDLRecordSet ddlRecordSet) { if (ddlRecordSet == null) { return new DataRecordCollection(); } return new DataRecordCollection() { { dataDefinitionId = ddlRecordSet.getDDMStructureId(); dataRecordCollectionKey = ddlRecordSet.getRecordSetKey(); description = LocalizedValueUtil.toStringObjectMap( ddlRecordSet.getDescriptionMap()); id = ddlRecordSet.getRecordSetId(); name = LocalizedValueUtil.toStringObjectMap( ddlRecordSet.getNameMap()); siteId = ddlRecordSet.getGroupId(); } }; }  static DataRecordCollection toDataRecordCollection(
		DDLRecordSet ddlRecordSet);  }
@Test public void testToDataRecordCollectionEquals() throws Exception { when( _ddlRecordSet.getDDMStructureId() ).thenReturn( 123L ); when( _ddlRecordSet.getDescriptionMap() ).thenReturn( HashMapBuilder.put( LocaleUtil.BRAZIL, "Descrição" ).put( LocaleUtil.US, "Description" ).build() ); when( _ddlRecordSet.getGroupId() ).thenReturn( 789L ); when( _ddlRecordSet.getNameMap() ).thenReturn( HashMapBuilder.put( LocaleUtil.BRAZIL, "Nome" ).put( LocaleUtil.US, "Name" ).build() ); when( _ddlRecordSet.getRecordSetId() ).thenReturn( 456L ); when( _ddlRecordSet.getRecordSetKey() ).thenReturn( "RecordSetId" ); Assert.assertEquals( new DataRecordCollection() { { setDataDefinitionId(123L); setDataRecordCollectionKey("RecordSetId"); setDescription( HashMapBuilder.<String, Object>put( "en_US", "Description" ).put( "pt_BR", "Descrição" ).build()); setId(456L); setName( HashMapBuilder.<String, Object>put( "en_US", "Name" ).put( "pt_BR", "Nome" ).build()); setSiteId(789L); } }, DataRecordCollectionUtil.toDataRecordCollection(_ddlRecordSet)); }
@Test public void testToDataRecordCollectionNotEquals() throws Exception { when( _ddlRecordSet.getDDMStructureId() ).thenReturn( 124L ); when( _ddlRecordSet.getDescriptionMap() ).thenReturn( HashMapBuilder.put( LocaleUtil.BRAZIL, "Descrição1" ).put( LocaleUtil.US, "Description1" ).build() ); when( _ddlRecordSet.getGroupId() ).thenReturn( 788L ); when( _ddlRecordSet.getNameMap() ).thenReturn( HashMapBuilder.put( LocaleUtil.BRAZIL, "Nome1" ).put( LocaleUtil.US, "Name1" ).build() ); when( _ddlRecordSet.getRecordSetId() ).thenReturn( 457L ); when( _ddlRecordSet.getRecordSetKey() ).thenReturn( "RecordSetId1" ); Assert.assertNotEquals( new DataRecordCollection() { { setDataDefinitionId(123L); setDataRecordCollectionKey("RecordSetId"); setDescription( HashMapBuilder.<String, Object>put( "en_US", "Description" ).put( "pt_BR", "Descrição" ).build()); setId(456L); setName( HashMapBuilder.<String, Object>put( "en_US", "Name" ).put( "pt_BR", "Nome" ).build()); setSiteId(789L); } }, DataRecordCollectionUtil.toDataRecordCollection(_ddlRecordSet)); }
@Test public void testToDataRecordCollectionNullDDLRecordSet() { Assert.assertEquals( new DataRecordCollection(), DataRecordCollectionUtil.toDataRecordCollection(null)); }