Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package hello; | ||
|
||
import org.anystub.AnyStubId; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
@RunWith(SpringRunner.class) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
@SpringBootTest | ||
public class ApplicationTest { | ||
|
||
@Test | ||
@AnyStubId | ||
public void test() { | ||
|
||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package hello; | ||
|
||
|
||
import org.anystub.jdbc.StubDataSource; | ||
import org.h2.jdbcx.JdbcDataSource; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import javax.sql.DataSource; | ||
|
||
@Configuration | ||
public class TestConfiguration { | ||
This comment has been minimized.
Sorry, something went wrong.
feech
Author
|
||
|
||
@Bean | ||
public DataSource dataSource() { | ||
|
||
JdbcDataSource ds = new JdbcDataSource(); | ||
ds.setURL("jdbc:h2:./test"); | ||
This comment has been minimized.
Sorry, something went wrong.
feech
Author
|
||
return new StubDataSource(ds); | ||
This comment was marked as resolved.
Sorry, something went wrong. |
||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
request0: | ||
This comment has been minimized.
Sorry, something went wrong.
feech
Author
|
||
exception: [] | ||
keys: DROP TABLE customers IF EXISTS | ||
values: 'false' | ||
request1: | ||
exception: [] | ||
keys: CREATE TABLE customers(id SERIAL, first_name VARCHAR(255), last_name VARCHAR(255)) | ||
values: 'false' | ||
request2: | ||
exception: [] | ||
keys: DatabaseMetaData:supportsBatchUpdates | ||
values: 'true' | ||
request3: | ||
exception: [] | ||
keys: ['INSERT INTO customers(first_name, last_name) VALUES (?,?)', '1', John, '2', | ||
Woo, '1', Jeff, '2', Dean, '1', Josh, '2', Bloch, '1', Josh, '2', Long] | ||
values: ['1', '1', '1', '1'] | ||
request4: | ||
exception: [] | ||
keys: ['SELECT id, first_name, last_name FROM customers WHERE first_name = ?', '1', | ||
Josh] | ||
values: ['3', ID, INTEGER, '4', '10', '0', FIRST_NAME, VARCHAR, '12', '255', '0', | ||
LAST_NAME, VARCHAR, '12', '255', '0'] | ||
request5: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', next] | ||
values: 'true' | ||
request6: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', getLong, id] | ||
values: '3' | ||
request7: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', getString, first_name] | ||
values: Josh | ||
request8: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', getString, last_name] | ||
values: Bloch | ||
request9: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', next, '#1'] | ||
values: 'true' | ||
request10: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', getLong, id, '#1'] | ||
values: '4' | ||
request11: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', getString, first_name, '#1'] | ||
values: Josh | ||
request12: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', getString, last_name, '#1'] | ||
values: Long | ||
request13: | ||
exception: [] | ||
keys: [resultSet, 'SELECT id, first_name, last_name FROM customers WHERE first_name | ||
= ?', next, '#2'] | ||
values: 'false' |
1 comment
on commit 1724f93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually the example doesn't test anything, It only creates a stub for run() method in main class.
it's because of the application doesn't include any of class to test.
you can check some examples here jdbc-IT test to see how it could work.
add libraries