Skip to content

Commit

Permalink
Upgrade dependencies (SB 3.4) and fix breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ystxn committed Nov 29, 2024
1 parent 40919dd commit 4b68d11
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 18 deletions.
21 changes: 15 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
plugins {
id "com.github.ben-manes.versions" version "0.51.0"
id "org.springframework.boot" version "3.3.5"
id "org.springframework.boot" version "3.4.0"
id "io.spring.dependency-management" version "1.1.6"
id "io.freefair.lombok" version "8.10.2"
id "io.freefair.lombok" version "8.11"
id "org.graalvm.buildtools.native" version "0.10.3"
id "java"
id "jacoco"
Expand All @@ -22,7 +22,9 @@ tasks.withType(JavaCompile).configureEach {
options.compilerArgs.add("-parameters")
}

def testContainersVersion = "1.20.3"
def testContainersVersion = "1.20.4"

configurations { mockitoAgent }

dependencies {
implementation "org.springframework.boot:spring-boot-starter-web"
Expand All @@ -38,19 +40,23 @@ dependencies {
}
implementation "org.apache.poi:poi:5.3.0"
developmentOnly "org.springframework.boot:spring-boot-devtools"

testRuntimeOnly "org.mockito:mockito-inline:+"
testRuntimeOnly "org.junit.platform:junit-platform-launcher:1.11.3"
testImplementation "org.junit.jupiter:junit-jupiter:5.11.3"
testImplementation "org.springframework.boot:spring-boot-starter-test"
testImplementation "org.springframework.security:spring-security-test"
testImplementation "org.testcontainers:testcontainers:$testContainersVersion"
testImplementation "org.testcontainers:junit-jupiter:$testContainersVersion"
testImplementation "org.testcontainers:mongodb:$testContainersVersion"
runtimeOnly "io.projectreactor:reactor-core:3.7.0" // remove when spring boot updated
mockitoAgent 'org.mockito:mockito-core'
}

tasks.named("jar") { enabled = false }
tasks.withType(Test).configureEach {
useJUnitPlatform()
jvmArgs("-javaagent:${configurations.mockitoAgent.first()}")
}

tasks.withType(Test).configureEach { useJUnitPlatform() }
test {
testLogging {
events "failed"
Expand All @@ -62,6 +68,7 @@ test {
}
finalizedBy jacocoTestReport
}

jacocoTestReport {
dependsOn test
afterEvaluate {
Expand All @@ -80,6 +87,8 @@ jacocoTestReport {
}
}

tasks.named("jar") { enabled = false }

bootBuildImage {
imageName = System.getenv("IMAGE_NAME") ?: "sledger-backend"
publish = System.getenv("DOCKER_PASS") != null
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ public class TransactionEndpoints {
private final TransactionService txService;

@PostMapping
public <T extends Transaction> List<T> addTransactions(
public List<Transaction> addTransactions(
Authentication auth,
@RequestBody List<T> transactions
@RequestBody List<Transaction> transactions
) {
bulkAuthorise(auth, transactions);
return txService.add(transactions);
Expand Down
10 changes: 5 additions & 5 deletions src/test/java/tech/sledger/EmailTests.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package tech.sledger;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import com.resend.services.emails.model.CreateEmailOptions;
import com.resend.services.emails.model.CreateEmailResponse;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.aot.DisabledInAotMode;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import tech.sledger.service.EmailService;
import tech.sledger.service.ResendService;
import java.util.Map;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when;

@DisabledInAotMode
@SpringBootTest
Expand All @@ -29,7 +29,7 @@ public class EmailTests {
@Autowired
private EmailService emailService;

@MockBean
@MockitoBean
private ResendService resendService;

@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/tech/sledger/UserBaseTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import com.mongodb.assertions.Assertions;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.aot.DisabledInAotMode;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import tech.sledger.model.user.Registration;
import tech.sledger.model.user.User;
import tech.sledger.service.EmailService;
Expand All @@ -23,7 +23,7 @@
public class UserBaseTest extends BaseTest {
@Autowired
public PasswordEncoder passwordEncoder;
@MockBean
@MockitoBean
private EmailService emailService;

@Test
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/tech/sledger/UserTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import com.auth0.jwt.interfaces.DecodedJWT;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.test.context.support.WithUserDetails;
import org.springframework.test.context.aot.DisabledInAotMode;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.web.server.ResponseStatusException;
import tech.sledger.model.user.Registration;
import tech.sledger.model.user.TokenResponse;
Expand All @@ -28,7 +28,7 @@

@DisabledInAotMode
public class UserTests extends BaseTest {
@MockBean
@MockitoBean
private EmailService emailService;
@Autowired
private JwtService jwtService;
Expand Down

0 comments on commit 4b68d11

Please sign in to comment.