Skip to content

Commit

Permalink
Removed SidMapperMock and replace by mockito mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
Skaar, Bjørn-Andre committed Aug 31, 2023
1 parent 19d25ec commit adba241
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/main/java/no/ssb/dapla/dlp/pseudo/func/map/MapFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ public class MapFunc extends AbstractPseudoFunc {
public MapFunc(PseudoFuncConfig genericConfig) {
super(genericConfig.getFuncDecl());
this.config = mapFuncConfigService.resolve(genericConfig);
this.mapper = loadMapper();
this.mapper.setConfig(genericConfig.asMap());
}

public static Mapper loadMapper() {
// TODO: Filter Service Implementation by some annotation (to choose the implementation that is used)
this.mapper = ServiceLoader.load(Mapper.class)
return ServiceLoader.load(Mapper.class)
.findFirst()
.orElseThrow(() -> new IllegalStateException(getClass().getSimpleName() + " requires a " + Mapper.class.getName() + " implementation to be present on the classpath"));
this.mapper.setConfig(genericConfig.asMap());
.orElseThrow(() -> new IllegalStateException(MapFunc.class.getSimpleName() + " requires a " +
Mapper.class.getName() + " implementation to be present on the classpath"));
}

@Override
Expand Down

0 comments on commit adba241

Please sign in to comment.