Skip to content

Commit

Permalink
added junit 5 test base
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamhead committed Oct 8, 2023
1 parent 40756fa commit a789095
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.github.dreamhead.moco.junit5;

import com.github.dreamhead.moco.helper.MocoTestHelper;

public class AbstractMocoJunit5Test {
protected MocoTestHelper helper = new MocoTestHelper();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.dreamhead.moco.junit5;

import com.github.dreamhead.moco.AbstractMocoStandaloneTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

Expand All @@ -12,7 +11,7 @@

@ExtendWith(MocoExtension.class)
@MocoHttpServer(classpath = "foo.json", port=12306)
public class MocoJunitClasspathJsonHttpRunnerTest extends AbstractMocoStandaloneTest {
public class MocoJunitClasspathJsonHttpRunnerTest extends AbstractMocoJunit5Test {
@Test
public void should_return_expected_message() throws IOException {
assertThat(helper.get(root()), is("foo"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.dreamhead.moco.junit5;

import com.github.dreamhead.moco.AbstractMocoStandaloneTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

Expand All @@ -13,7 +12,7 @@
@ExtendWith(MocoExtension.class)
@MocoHttpServer(filepath = "src/test/resources/foo.json", port=12306)
@MocoCertificate(classpath = "certificate/cert.jks", keyStorePassword = "mocohttps", certPassword = "mocohttps")
public class MocoJunitClasspathJsonHttpsRunnerTest extends AbstractMocoStandaloneTest {
public class MocoJunitClasspathJsonHttpsRunnerTest extends AbstractMocoJunit5Test {
@Test
public void should_return_expected_message() throws IOException {
assertThat(helper.get(httpsRoot()), is("foo"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.dreamhead.moco.junit5;

import com.github.dreamhead.moco.AbstractMocoStandaloneTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

Expand All @@ -12,7 +11,7 @@

@ExtendWith(MocoExtension.class)
@MocoHttpServer(filepath = "src/test/resources/foo.json", port=12306)
public class MocoJunitFilepathJsonHttpRunnerTest extends AbstractMocoStandaloneTest {
public class MocoJunitFilepathJsonHttpRunnerTest extends AbstractMocoJunit5Test {
@Test
public void should_return_expected_message() throws IOException {
assertThat(helper.get(root()), is("foo"));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
package com.github.dreamhead.moco.junit5;

import com.github.dreamhead.moco.AbstractMocoStandaloneTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;

import java.io.IOException;

import static com.github.dreamhead.moco.helper.RemoteTestUtils.httpsRoot;
import static com.github.dreamhead.moco.helper.RemoteTestUtils.root;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;

@ExtendWith(MocoExtension.class)
@MocoHttpServer(filepath = "src/test/resources/foo.json", port=12306)
@MocoCertificate(filepath = "src/test/resources/certificate/cert.jks", keyStorePassword = "mocohttps", certPassword = "mocohttps")
public class MocoJunitFilepathJsonHttpsRunnerTest extends AbstractMocoStandaloneTest {
public class MocoJunitFilepathJsonHttpsRunnerTest extends AbstractMocoJunit5Test {
@Test
public void should_return_expected_message() throws IOException {
assertThat(helper.get(httpsRoot()), is("foo"));
Expand Down

0 comments on commit a789095

Please sign in to comment.