### Question:
SeverityService { public String getDefaultSeverityCode(List<SeverityDTO> severities) { return severities.stream() .filter(SeverityDTO::isDefaultOnMissing) .findFirst() .map(SeverityDTO::getCode) .orElse(null); }  List<SeverityDTO> getSeveritiesWithAll(long projectId); String getDefaultSeverityCode(List<SeverityDTO> severities); SeverityDTO create(long projectId, SeverityDTO dtoToCreate); UpsertResultDTO<SeverityDTO> createOrUpdate(long projectId, SeverityDTO dtoToCreateOrUpdate); @Transactional(readOnly = true) List<SeverityDTO> findAll(long projectId); void delete(long projectId, String code);  }### Answer:
@Test public void getDefaultSeverityCode_ShouldReturnTheDefaultOne_WhenOneIsDefinedAsDefault() { List<SeverityDTO> severities = Arrays.asList( new SeverityDTO().withCode("a"), new SeverityDTO().withCode("b").withDefaultOnMissing(true)); final String defaultSeverityCode = cut.getDefaultSeverityCode(severities); assertThat(defaultSeverityCode).isEqualTo("b"); }
@Test public void getDefaultSeverityCode_ShouldReturnNull_WhenNoSeverityIsDefinedAsDefault() { List<SeverityDTO> severities = Arrays.asList( new SeverityDTO().withCode("a"), new SeverityDTO().withCode("b")); final String defaultSeverityCode = cut.getDefaultSeverityCode(severities); assertThat(defaultSeverityCode).isNull(); }