Skip to content

Commit

Permalink
fix invalid code in pact tests snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
mile95 committed Mar 25, 2024
1 parent 1dfc3ca commit 7d12c5d
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions content/posts/2024-03-24-java-pact-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand All @@ -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())
}
}

Expand Down Expand Up @@ -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.
By doing this refactoring, you get a much cleaner provider class, and the code is separated by feature.

0 comments on commit 7d12c5d

Please sign in to comment.