Skip to content

Commit bd9ac4b

Browse files
committed
modify gradle.kts for correct springboot version
1 parent f5e1557 commit bd9ac4b

3 files changed

Lines changed: 11 additions & 9 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version = "1.0-SNAPSHOT"
33
description = "nacha-paymentsystem"
44

55
plugins {
6-
id("org.springframework.boot") version "3.3.4"
6+
id("org.springframework.boot") version "5.3.30"
77
id("io.spring.dependency-management") version "1.1.6"
88
// Java plugin for building Java applications
99
id("java")

src/main/java/org/nacha/paymentsystem/Main.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package org.nacha.paymentsystem;
2-
3-
import org.nacha.paymentsystem.*;
42
import org.nacha.paymentsystem.Welcome.Welcome;
5-
63
import java.util.logging.Logger;
74

85
public class Main {

src/test/java/org/nacha/paymentsystem/integration/SecurityConfigIntegrationTest.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import org.junit.jupiter.api.Test;
44
import org.springframework.beans.factory.annotation.Autowired;
5-
import org.springframework.boot.test.context.SpringBootTest;
65
import org.springframework.boot.test.web.server.LocalServerPort;
76
import org.springframework.http.HttpHeaders;
87
import org.springframework.http.HttpStatus;
@@ -11,7 +10,8 @@
1110
import org.springframework.test.context.ContextConfiguration;
1211
import org.springframework.test.context.TestPropertySource;
1312
import org.springframework.web.client.RestTemplate;
14-
13+
import org.springframework.http.HttpEntity;
14+
import org.springframework.http.HttpMethod.*;
1515
import static org.assertj.core.api.Assertions.assertThat;
1616

1717
@ContextConfiguration()
@@ -55,12 +55,17 @@ void shouldAllowAccessToUnsecuredEndpoint() {
5555
@Test
5656
void shouldGrantAccessToSecuredEndpointWithValidCredentials() {
5757
// Arrange
58-
String securedUrl = "http://localhost:5000" + port + "/api/payments/test";
58+
String securedUrl = "http://localhost:" + port + "/api/payments/test";
5959
HttpHeaders headers = new HttpHeaders();
60-
headers.setBasicAuth("user", "password");
60+
//headers.setBasicAuth("username", "password1234"); // Adjust
61+
// credentials as needed
62+
63+
HttpEntity<Void> requestEntity = new HttpEntity<>(headers);
6164

6265
// Act
63-
ResponseEntity<String> response = restTemplate.getForEntity(securedUrl, String.class);
66+
ResponseEntity<String> response = restTemplate.exchange(
67+
securedUrl, org.springframework.http.HttpMethod.GET, requestEntity, String.class
68+
);
6469

6570
// Assert
6671
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);

0 commit comments

Comments
 (0)