Skip to content

Commit

Permalink
MaturityModel API implementation update (hygieia#113)
Browse files Browse the repository at this point in the history
* auth header str format check

* maturity models api json mapping exception fix

* revert auth token space check

* removed unused import
  • Loading branch information
nameisaravind authored Mar 17, 2020
1 parent f234eb7 commit 471c4e0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</parent>

<properties>
<com.capitalone.dashboard.core.version>3.5.7</com.capitalone.dashboard.core.version>
<com.capitalone.dashboard.core.version>3.5.8</com.capitalone.dashboard.core.version>
<apache.rat.plugin.version>0.13</apache.rat.plugin.version>
<coveralls.maven.plugin.version>4.3.0</coveralls.maven.plugin.version>
<guava.version>18.0</guava.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,4 @@ protected void unsuccessfulAuthentication(HttpServletRequest request, HttpServle
response.sendError(HttpServletResponse.SC_UNAUTHORIZED, "ApiToken Authentication Failed");
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

@Service
public class MaturityModelServiceImpl implements MaturityModelService {
Expand All @@ -25,8 +28,8 @@ public MaturityModel getMaturityModel(String profile) {

@Override
public List<String> getProfiles() {
return maturityModelRepository.getAllProfiles();

List<MaturityModel> maturityModels = Optional.ofNullable(maturityModelRepository.getAllProfiles()).orElse(Collections.emptyList());
return maturityModels.stream().map(MaturityModel::getProfile).collect(Collectors.toList());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public void getProfileAndRules() {

@Test
public void getAllProfiles() {
when(maturityModelRepository.getAllProfiles()).thenReturn(new ArrayList<String>());
when(maturityModelRepository.getAllProfiles()).thenReturn(new ArrayList<>());
assertNotNull(service.getProfiles());
}

Expand Down

0 comments on commit 471c4e0

Please sign in to comment.