Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/frontend-app-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history to ensure all commits are accessible
- uses: rwjblue/setup-volta@v1
- uses: H1D/actions-ember-testing@8ca8da615c2db5889b7fbd3834e4093706754435
- name: Install dependencies
Expand All @@ -31,11 +33,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history to ensure all commits are accessible
- uses: rwjblue/setup-volta@v1
- uses: H1D/actions-ember-testing@8ca8da615c2db5889b7fbd3834e4093706754435
- name: Install dependencies
working-directory: ./frontend
run: yarn install
run: |
for i in {1..3}; do
yarn install && break || sleep 5;
done
- uses: mydea/ember-cli-code-coverage-action@e4130abc6c57d272d9d123870c26b8c284128adc
with:
working-directory: ./frontend
Expand Down
1 change: 0 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ dependencies {

testImplementation("org.springframework.boot:spring-boot-starter-webflux")
testImplementation("org.springframework.cloud:spring-cloud-contract-wiremock:$springCloudContractWiremockVersion")
testImplementation("org.amshove.kluent:kluent:1.68") // should be deleted after kotest move all of it
testImplementation("org.jetbrains.kotlin:kotlin-test:1.3.72") // should be deleted after kotest move all of it
testImplementation("io.kotest:kotest-assertions-core:$kotestAssertionsVersion")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.epam.brn.model.Contact
import com.epam.brn.model.Contributor
import com.epam.brn.model.GitHubUser
import com.epam.brn.repo.ContributorRepository
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.transaction.annotation.Transactional

Expand Down Expand Up @@ -43,8 +44,8 @@ class ContributorServiceImpl(
): ContributorResponse {
val contributor =
contributorRepository
.findById(id)
.orElseThrow { EntityNotFoundException("Contributor with id=$id was not found") }
.findByIdOrNull(id)
?: throw EntityNotFoundException("Contributor with id=$id was not found")
contributor.name = contributorRequest.name
contributor.nameEn = contributorRequest.nameEn
contributor.description = contributorRequest.description
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/epam/brn/service/ResourceService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ResourceService(
.orElse(null)

fun save(resource: Resource): Resource = resourceRepository.save(resource)

val resource = resourceRepository
fun findAll(): List<Resource> = resourceRepository
.findAll()
.iterator()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.epam.brn.exception.EntityNotFoundException
import com.epam.brn.model.Role
import com.epam.brn.repo.RoleRepository
import com.epam.brn.service.RoleService
import org.springframework.data.repository.findByIdOrNull
import org.springframework.stereotype.Service
import org.springframework.web.context.request.RequestContextHolder
import org.springframework.web.context.request.ServletRequestAttributes
Expand All @@ -15,9 +16,8 @@ class RoleServiceImpl(
private val roleRepository: RoleRepository,
) : RoleService {
override fun findById(id: Long): Role = roleRepository
.findById(id)
.orElseThrow { EntityNotFoundException("Role with id = $id is not found") }

.findByIdOrNull(id)
?: throw EntityNotFoundException("Role with id = $id is not found")
override fun findByName(name: String): Role = roleRepository
.findByName(name)
?: throw EntityNotFoundException("Role with name = $name is not found")
Expand Down
3 changes: 2 additions & 1 deletion src/test/kotlin/com/epam/brn/integration/BaseIT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import com.epam.brn.repo.SubGroupRepository
import com.epam.brn.repo.TaskRepository
import com.epam.brn.repo.UserAccountRepository
import com.fasterxml.jackson.databind.ObjectMapper
import org.amshove.kluent.internal.platformClassName
import org.junit.jupiter.api.Tag
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc
Expand Down Expand Up @@ -67,6 +66,8 @@ abstract class BaseIT {

protected val dateFormat = DateTimeFormatter.ISO_DATE_TIME

fun platformClassName(): String = this::class.simpleName ?: "Unknown"

/**
* Should delete data from repositories.
* Deleting order is matter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ internal class ResourceServiceTest {
}

// THEN
expectedErrorMessage shouldBe exception.message
exception.message shouldBe expectedErrorMessage

// Verifica que el repositorio haya sido llamado una sola vez
verify(exactly = 1) { resourceRepositoryMock.findByIdOrNull(id) }
}
}