Skip to content

Instantly share code, notes, and snippets.

Avatar
🏝️
Working remotely

Philip Riecks rieckpil

🏝️
Working remotely
View GitHub Profile
@rieckpil
rieckpil / info.txt
Created July 31, 2023 10:24
Testing Livetemplates for IntelliJ IDEA
View info.txt
# mockMvcGet
org.springframework.test.web.servlet.MvcResult result = this.mockMvc
.perform(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get($url$)
.header(org.springframework.http.HttpHeaders.ACCEPT, org.springframework.http.MediaType.APPLICATION_JSON))
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.status().is(200))
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.content().contentType(org.springframework.http.MediaType.APPLICATION_JSON))
.andExpect(org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath("$.size()", org.hamcrest.Matchers.is(0)))
.andDo(org.springframework.test.web.servlet.result.MockMvcResultHandlers.print())
.andReturn();
@rieckpil
rieckpil / pom.xml
Created March 19, 2022 10:01
Selenide Maven Pom Include
View pom.xml
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>selenide</artifactId>
<version>5.22.0</version>
<scope>test</scope>
</dependency>
@rieckpil
rieckpil / SpringBootIT.java
Created March 19, 2022 09:59
Sample Spring Boot Testcontainers Integration Test
View SpringBootIT.java
@Testcontainers
class SpringBootIT {
@Container
static PostgreSQLContainer<?> postgreSQLContainer =
new PostgreSQLContainer<>(DockerImageName.parse("postgres:13"))
.withPassword("inmemory")
.withUsername("inmemory");
}
@rieckpil
rieckpil / pom.xml
Created March 19, 2022 09:57
Spring Boot Starter Test Maven Include
View pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
@rieckpil
rieckpil / create.sh
Last active March 30, 2023 09:14
Create Spring Boot Project Skeleton
View create.sh
curl https://start.spring.io/starter.zip \
-d dependencies=web,actuator,data-jpa,h2 \
-d javaVersion=17 \
-d name=spring-boot-testing-primer \
-d artifactId=spring-boot-testing-primer \
-d groupId=de.rieckpil.blog \
-d packageName=de.rieckpil.blog \
-d type=maven-project \
-o spring-boot-testing-primer.zip
@rieckpil
rieckpil / idea-live-template-examples.md
Last active April 30, 2022 15:33
Intellij IDEA Live Template Examples
View idea-live-template-examples.md

Live Template Examples for Testing Java Applications

Create new Live Templates within your IDEA's Preferences -> Editor -> Live Templates

mockMvcGET: Peform a MockMvc HTTP GET request.

org.springframework.test.web.servlet.MvcResult result = this.mockMvc
  .perform(org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get($url$)
  .header(org.springframework.http.HttpHeaders.ACCEPT, org.springframework.http.MediaType.APPLICATION_JSON))
@rieckpil
rieckpil / rieckpil.css
Last active October 14, 2021 18:52
Custom Crayon Theme (Inspired by the IntelliJ IDEA Light Theme)
View rieckpil.css
.crayon-theme-rieckpil {
border-width: 0px !important;
border-color: #999 !important;
border-style: solid !important;
text-shadow: none !important;
background: #fdfdfd !important;
}
.crayon-theme-rieckpil-inline {
border-width: 1px !important;
border-color: #ddd !important;
@rieckpil
rieckpil / sendowl.js
Created December 30, 2020 20:37
Trigger Cart Abandonment when Email is pre-filled on SendOwl's Checkout Page
View sendowl.js
<script>
Page.checkoutCallback = function () {
var email = document.getElementById("order_buyer_email").value;
if (email) {
$("#order_buyer_email").blur();
}
}
</script>
@rieckpil
rieckpil / application.yml
Created April 15, 2020 17:16
Debugging Hibernate - Settings for Spring application
View application.yml
spring:
jpa:
show-sql: false
hibernate:
ddl-auto: none
properties:
hibernate.generate_statistics: true
logging:
level:
@rieckpil
rieckpil / WpClient.java
Created October 3, 2019 18:02
WP API get all posts
View WpClient.java
@ApplicationScoped
public class WpClient {
public void getListOfBlogPosts(@Observes @Initialized(ApplicationScoped.class) Object object) {
Client client = ClientBuilder.newBuilder().build();
WebTarget webTarget = client.target("https://rieckpil.de/wp-json/wp/v2/posts");
JsonArray result = webTarget
.queryParam("per_page", 100)