File tree Expand file tree Collapse file tree 2 files changed +17
-13
lines changed
main/java/datastax/astra/migrate/properties
test/java/datastax/astra/migrate/properties Expand file tree Collapse file tree 2 files changed +17
-13
lines changed Original file line number Diff line number Diff line change @@ -181,24 +181,28 @@ public List<MigrateDataType> getMigrationTypeList(String propertyName) {
181
181
}
182
182
183
183
public String getAsString (String propertyName ) {
184
+ String rtn ;
184
185
if (null == propertyName )
185
186
return null ;
186
187
Object propertyValue = get (propertyName , getType (propertyName ));
187
188
if (null == propertyValue )
188
- return null ;
189
+ return "" ;
189
190
switch (getType (propertyName )) {
190
191
case STRING :
191
- return (String ) propertyValue ;
192
+ rtn = (String ) propertyValue ;
193
+ break ;
192
194
case STRING_LIST :
193
195
case NUMBER_LIST :
194
196
case MIGRATION_TYPE_LIST :
195
- return StringUtils .join ((List <?>) propertyValue , "," );
197
+ rtn = StringUtils .join ((List <?>) propertyValue , "," );
198
+ break ;
196
199
case NUMBER :
197
200
case BOOLEAN :
198
201
case MIGRATION_TYPE :
199
202
default :
200
- return propertyValue .toString ();
203
+ rtn = propertyValue .toString ();
201
204
}
205
+ return (null == rtn ) ? "" : rtn ;
202
206
}
203
207
204
208
protected void loadSparkConf () {
Original file line number Diff line number Diff line change @@ -459,15 +459,15 @@ public void getAsString_MigrateDataTypeList() {
459
459
assertEquals ("0,5%0%1" , helper .getAsString (KnownProperties .TEST_MIGRATE_TYPE_LIST ));
460
460
}
461
461
462
- // @Test
463
- // public void getAsString_valueNotSet_withDefault () {
464
- // assertEquals(KnownProperties.getDefaultAsString(KnownProperties.TEST_STRING) ,helper.getAsString(KnownProperties.TEST_STRING ));
465
- // }
466
- //
467
- // @Test
468
- // public void getAsString_valueNotSet_noDefault () {
469
- // assertNull( helper.getAsString(KnownProperties.TEST_STRING_NO_DEFAULT ));
470
- // }
462
+ @ Test
463
+ public void getAsString_valueNotSet_string () {
464
+ assertEquals ("" ,helper .getAsString (KnownProperties .TEST_STRING_NO_DEFAULT ));
465
+ }
466
+
467
+ @ Test
468
+ public void getAsString_valueNotSet_list () {
469
+ assertEquals ( "" , helper .getAsString (KnownProperties .TEST_MIGRATE_TYPE_LIST ));
470
+ }
471
471
472
472
@ Test
473
473
public void getAsString_nullArgument () {
You can’t perform that action at this time.
0 commit comments