Skip to content

Commit

Permalink
fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
Yingjian Wu committed Mar 8, 2024
1 parent 33fe167 commit d1f3036
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import org.springframework.jdbc.datasource.DriverManagerDataSource
import spock.lang.Shared
import spock.lang.Specification

class MySqlLookupServiceUnitTest extends Specification{
class MySqlLookupServiceSpec extends Specification{
private MySqlLookupService mySqlLookupService;
private JdbcTemplate jdbcTemplate;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.sql.Statement;
import java.sql.Types;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -205,7 +206,6 @@ private Lookup findOrCreateLookupByName(final String name, final boolean include
lookup = new Lookup();
lookup.setName(name);
lookup.setId(lookupId);
lookup.setValues(Collections.EMPTY_SET);
}
return lookup;
}
Expand All @@ -225,7 +225,11 @@ public Lookup addValues(final String name, final Set<String> values, final boole
insertLookupValuesIfNotExist(lookup.getId(), values);
}
if (includeValues) {
lookup.getValues().addAll(values);
if (lookup.getValues() == null || lookup.getValues().isEmpty()) {
lookup.setValues(values);
} else {
lookup.getValues().addAll(values);
}
}
return lookup;
} catch (Exception e) {
Expand Down

0 comments on commit d1f3036

Please sign in to comment.