Bael 1854 (#4954)
* Fix a division method mistake * Maven integration testing * Move Maven integration tests to the maven module * Remove Maven integration tests in the old module
This commit is contained in:
committed by
Predrag Maric
parent
955e78a306
commit
c467a4e7d6
@@ -0,0 +1,4 @@
|
||||
package com.baeldung.maven.it;
|
||||
|
||||
public interface Integration {
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.baeldung.maven.it;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class RestIT {
|
||||
@Test
|
||||
public void whenSendingGet_thenMessageIsReturned() throws IOException {
|
||||
String url = "http://localhost:8999";
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
try (InputStream response = connection.getInputStream();
|
||||
Scanner scanner = new Scanner(response)) {
|
||||
String responseBody = scanner.nextLine();
|
||||
assertEquals("Welcome to Baeldung!", responseBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.baeldung.maven.it;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class RestIntegrationTest {
|
||||
@Test
|
||||
public void whenSendingGet_thenMessageIsReturned() throws IOException {
|
||||
String url = "http://localhost:8999";
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
try (InputStream response = connection.getInputStream();
|
||||
Scanner scanner = new Scanner(response)) {
|
||||
String responseBody = scanner.nextLine();
|
||||
assertEquals("Welcome to Baeldung!", responseBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.baeldung.maven.it;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.categories.Category;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Scanner;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
@Category(Integration.class)
|
||||
public class RestJUnitTest {
|
||||
@Test
|
||||
public void whenSendingGet_thenMessageIsReturned() throws IOException {
|
||||
String url = "http://localhost:8999";
|
||||
URLConnection connection = new URL(url).openConnection();
|
||||
try (InputStream response = connection.getInputStream();
|
||||
Scanner scanner = new Scanner(response)) {
|
||||
String responseBody = scanner.nextLine();
|
||||
assertEquals("Welcome to Baeldung!", responseBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user