my bad, just forgot to add
.withBasicAuth("sina", "abc123")
Fixed Test:
@Test
@DirtiesContext
void shouldCreateANewCashCard() {
var cashcard = new CashCard(null, 6985.9, "sina");
ResponseEntity<Void> response = restTemplate
.withBasicAuth("sina", "abc123")
.postForEntity("/cashcards", cashcard, Void.class);
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.CREATED);
URI locationOfNewCashCard = response.getHeaders().getLocation();
ResponseEntity<String> response1 = restTemplate
.withBasicAuth("sina", "abc123") // here ;)
.getForEntity(locationOfNewCashCard, String.class);
assertThat(response1.getStatusCode()).isEqualTo(HttpStatus.OK);
}