From 7d12c5d574b99be2796aab10910f1dea8443c203 Mon Sep 17 00:00:00 2001 From: Fredrik Mile Date: Mon, 25 Mar 2024 18:59:28 +0100 Subject: [PATCH] fix invalid code in pact tests snippets --- content/posts/2024-03-24-java-pact-testing.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/posts/2024-03-24-java-pact-testing.md b/content/posts/2024-03-24-java-pact-testing.md index 79d60e8..d2e87be 100644 --- a/content/posts/2024-03-24-java-pact-testing.md +++ b/content/posts/2024-03-24-java-pact-testing.md @@ -36,22 +36,22 @@ public class ProviderTest { @State("feature1_state1") void feature1_state1(){ - when(feature1.something()).thenReturn(feature1Data()) + when(feature1Service.something()).thenReturn(feature1Data()) } @State("feature1_state2") void feature1_state2(){ - when(feature1.somethingElse()).thenReturn(feature1Data()) + when(feature1Service.somethingElse()).thenReturn(feature1Data()) } @State("fearture2_state1") void feature2_state1(){ - when(feature2.something()).thenReturn(feature2Data()) + when(feature2Service.something()).thenReturn(feature2Data()) } @State("feature2_state2") void feature2_state2(){ - when(feature2.somethingElse()).thenReturn(feature2Data()) + when(feature2Service.somethingElse()).thenReturn(feature2Data()) } } @@ -73,12 +73,12 @@ interface Feature1ProviderTest { @State("feature1_state1") default void feature1_state1(){ - when(feature1.something()).thenReturn(feature1Data()); + when(feature1Mock().something()).thenReturn(feature1Data()); } @State("feature1_state2") default void feature1_state2(){ - when(feature1.somethingElse()).thenReturn(feature1Data()) + when(feature1Mock().somethingElse()).thenReturn(feature1Data()) } } @@ -117,4 +117,4 @@ public class ProviderTest implements Feature1ProviderTest, Feature2ProviderTeest ``` -By doing this refactoring, you get a much cleaner provider class, and the code is separated by feature. \ No newline at end of file +By doing this refactoring, you get a much cleaner provider class, and the code is separated by feature.