@@ -72,6 +72,8 @@ public class SearchIncludeFragmentTest {
7272
7373 private DatasetFieldType type1 = new DatasetFieldType ();
7474 private DatasetFieldType type2 = new DatasetFieldType ();
75+ private DatasetFieldType type3 = new DatasetFieldType ();
76+ private DatasetFieldType compoundType = new DatasetFieldType ();
7577 private MetadataBlock metaBlock = new MetadataBlock ();
7678
7779 private Dataset dataset = new Dataset ();
@@ -102,17 +104,34 @@ public void setUp() {
102104 this .type1 .setExportToFile (true );
103105 this .type2 .setId (2L );
104106 this .type2 .setTitle ("abc" );
107+ this .type3 .setId (3L );
108+ this .type3 .setTitle ("ghi" );
109+ this .type3 .setExportToFile (true );
110+ this .type3 .setParentDatasetFieldType (this .compoundType );
111+ this .compoundType .setId (4L );
112+ this .compoundType .setTitle ("compound" );
113+ this .compoundType .getChildDatasetFieldTypes ().add (this .type3 );
114+
105115
106116 this .metaBlock .setName ("Block1" );
107- this .metaBlock .setDatasetFieldTypes (asList (this .type1 , this .type2 ));
117+ this .metaBlock .setDatasetFieldTypes (asList (this .type1 , this .type2 , this . compoundType ));
108118 this .type1 .setMetadataBlock (this .metaBlock );
109119 this .type2 .setMetadataBlock (this .metaBlock );
120+ this .type3 .setMetadataBlock (this .metaBlock );
121+ this .compoundType .setMetadataBlock (this .metaBlock );
110122
111123 DatasetVersion dsv = new DatasetVersion ();
112- DatasetField df = new DatasetField ();
113- df .setDatasetFieldType (this .type1 );
114- df .setValue ("one" );
115- dsv .setDatasetFields (asList (df ));
124+ DatasetField df1 = new DatasetField ();
125+ df1 .setDatasetFieldType (this .type1 );
126+ df1 .setValue ("one" );
127+ DatasetField df2 = new DatasetField ();
128+ df2 .setDatasetFieldType (this .type3 );
129+ df2 .setValue ("two" );
130+ DatasetField compoundField = new DatasetField ();
131+ compoundField .setDatasetFieldType (this .compoundType );
132+ compoundField .getChildren ().add (df2 );
133+
134+ dsv .setDatasetFields (asList (df1 , compoundField ));
116135 this .dataset .setVersions (asList (dsv ));
117136 }
118137
@@ -156,8 +175,8 @@ public void searchresultsSavedToCSV_containIntendedData() throws Exception {
156175
157176 List <String > lines = readLines (file .getStream (), "utf-8" );
158177 assertThat (lines .size ()).isEqualTo (2 );
159- assertThat (lines .get (0 )).isEqualTo ("Id,Name,Title,Block1->def" );
160- assertThat (lines .get (1 )).isEqualTo ("id1,name1,title1,one" );
178+ assertThat (lines .get (0 )).isEqualTo ("Id,Name,Title,Block1->def,Block1->compound->ghi " );
179+ assertThat (lines .get (1 )).isEqualTo ("id1,name1,title1,one,two " );
161180 }
162181
163182 @ Test
@@ -168,7 +187,7 @@ public void emptyResultsSavedToCSV_generateFileWithColumnNamesOnly()
168187 any (), anyInt (), anyInt (), anyBoolean ())).thenReturn (responseOf ());
169188 when (this .searchService .search (any (SolrQuery .class ))).thenReturn (asList ());
170189 when (this .datasetFieldTypeRepo .findAll ())
171- .thenReturn (asList (this .type1 , this .type2 ));
190+ .thenReturn (asList (this .type1 , this .type2 , this . type3 ));
172191 when (this .metadataBlockRepo .findSystemMetadataBlocks ())
173192 .thenReturn (asList (this .metaBlock ));
174193
@@ -178,11 +197,11 @@ public void emptyResultsSavedToCSV_generateFileWithColumnNamesOnly()
178197 assertThat (file .getContentEncoding ()).isEqualTo ("utf-8" );
179198 assertThat (file .getContentType ()).isEqualTo ("text/csv" );
180199 assertThat (file .getName ()).isEqualTo ("searchResults.csv" );
181- assertThat (file .getContentLength ()).isEqualTo (27 );
200+ assertThat (file .getContentLength ()).isEqualTo (49 );
182201
183202 List <String > lines = readLines (file .getStream (), "utf-8" );
184203 assertThat (lines .size ()).isEqualTo (1 );
185- assertThat (lines .get (0 )).isEqualTo ("Id,Name,Title,Block1->def" );
204+ assertThat (lines .get (0 )).isEqualTo ("Id,Name,Title,Block1->def,Block1->compound->ghi " );
186205 }
187206
188207 @ Test
0 commit comments