Skip to content

Commit

Permalink
replace some junit pre 4.x artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Mar 14, 2017
1 parent 49127be commit 7dd857e
Show file tree
Hide file tree
Showing 9 changed files with 165 additions and 164 deletions.
7 changes: 5 additions & 2 deletions src/test/java/net/sf/jsqlparser/schema/ServerTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package net.sf.jsqlparser.schema;

import static org.junit.Assert.assertEquals;
import org.junit.Test;

/*
* #%L
* JSQLParser library
Expand All @@ -22,10 +25,10 @@
* #L%
*/

import junit.framework.*;

public class ServerTest extends TestCase {
public class ServerTest {

@Test
public void testServerNameParsing() throws Exception {
final String serverName = "LOCALHOST";

Expand Down
18 changes: 11 additions & 7 deletions src/test/java/net/sf/jsqlparser/test/create/CreateIndexTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@

import java.io.StringReader;

import junit.framework.TestCase;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParserManager;
import net.sf.jsqlparser.statement.create.index.CreateIndex;
import static net.sf.jsqlparser.test.TestUtils.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import org.junit.Test;

/**
* @author Raymond Augé
*/
public class CreateIndexTest extends TestCase {
public class CreateIndexTest {

private CCJSqlParserManager parserManager = new CCJSqlParserManager();

public CreateIndexTest(String arg0) {
super(arg0);
}
private final CCJSqlParserManager parserManager = new CCJSqlParserManager();

@Test
public void testCreateIndex() throws JSQLParserException {
String statement =
"CREATE INDEX myindex ON mytab (mycol, mycol2)";
Expand All @@ -31,6 +30,7 @@ public void testCreateIndex() throws JSQLParserException {
assertEquals(statement, ""+createIndex);
}

@Test
public void testCreateIndex2() throws JSQLParserException {
String statement =
"CREATE mytype INDEX myindex ON mytab (mycol, mycol2)";
Expand All @@ -43,6 +43,7 @@ public void testCreateIndex2() throws JSQLParserException {
assertEquals(statement, ""+createIndex);
}

@Test
public void testCreateIndex3() throws JSQLParserException {
String statement =
"CREATE mytype INDEX myindex ON mytab (mycol ASC, mycol2, mycol3)";
Expand All @@ -54,6 +55,7 @@ public void testCreateIndex3() throws JSQLParserException {
assertEquals("mycol3", createIndex.getIndex().getColumnsNames().get(2));
}

@Test
public void testCreateIndex4() throws JSQLParserException {
String statement =
"CREATE mytype INDEX myindex ON mytab (mycol ASC, mycol2 (75), mycol3)";
Expand All @@ -65,6 +67,7 @@ public void testCreateIndex4() throws JSQLParserException {
assertEquals("mycol3", createIndex.getIndex().getColumnsNames().get(2));
}

@Test
public void testCreateIndex5() throws JSQLParserException {
String statement =
"CREATE mytype INDEX myindex ON mytab (mycol ASC, mycol2 (75), mycol3) mymodifiers";
Expand All @@ -76,6 +79,7 @@ public void testCreateIndex5() throws JSQLParserException {
assertEquals("mycol3", createIndex.getIndex().getColumnsNames().get(2));
}

@Test
public void testCreateIndex6() throws JSQLParserException {
String stmt= "CREATE INDEX myindex ON mytab (mycol, mycol2)";
assertSqlCanBeParsedAndDeparsed(stmt);
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/net/sf/jsqlparser/test/delete/DeleteTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package net.sf.jsqlparser.test.delete;

import static junit.framework.Assert.assertEquals;
import static net.sf.jsqlparser.test.TestUtils.assertSqlCanBeParsedAndDeparsed;

import java.io.StringReader;
Expand All @@ -10,10 +9,11 @@
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParserManager;
import net.sf.jsqlparser.statement.delete.Delete;
import static org.junit.Assert.assertEquals;

public class DeleteTest {

private CCJSqlParserManager parserManager = new CCJSqlParserManager();
private final CCJSqlParserManager parserManager = new CCJSqlParserManager();

@Test
public void testDelete() throws JSQLParserException {
Expand Down
14 changes: 7 additions & 7 deletions src/test/java/net/sf/jsqlparser/test/drop/DropTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,18 @@

import java.io.StringReader;

import junit.framework.TestCase;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParserManager;
import net.sf.jsqlparser.statement.drop.Drop;
import static net.sf.jsqlparser.test.TestUtils.*;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

public class DropTest extends TestCase {
public class DropTest {

private CCJSqlParserManager parserManager = new CCJSqlParserManager();

public DropTest(String arg0) {
super(arg0);
}
private final CCJSqlParserManager parserManager = new CCJSqlParserManager();

@Test
public void testDrop() throws JSQLParserException {
String statement = "DROP TABLE mytab";
Drop drop = (Drop) parserManager.parse(new StringReader(statement));
Expand All @@ -31,12 +29,14 @@ public void testDrop() throws JSQLParserException {
assertEquals(statement, "" + drop);
}

@Test
public void testDrop2() throws JSQLParserException {
Drop drop = (Drop) parserManager.parse(new StringReader("DROP TABLE \"testtable\""));
assertEquals("TABLE", drop.getType());
assertEquals("\"testtable\"", drop.getName().getFullyQualifiedName());
}

@Test
public void testDropIfExists() throws JSQLParserException {
assertSqlCanBeParsedAndDeparsed("DROP TABLE IF EXISTS my_table");
}
Expand Down
7 changes: 5 additions & 2 deletions src/test/java/net/sf/jsqlparser/test/select/HiveTest.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
package net.sf.jsqlparser.test.select;

import junit.framework.*;
import net.sf.jsqlparser.parser.CCJSqlParserUtil;
import net.sf.jsqlparser.schema.Table;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.select.PlainSelect;
import net.sf.jsqlparser.statement.select.Select;

import static net.sf.jsqlparser.test.TestUtils.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;

/**
* Created by nhanitvn on 5/19/16.
*/
public class HiveTest extends TestCase {
public class HiveTest {

@Test
public void testLeftSemiJoin() throws Exception {
String sql;
Statement statement;
Expand Down
11 changes: 4 additions & 7 deletions src/test/java/net/sf/jsqlparser/test/select/SpeedTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,21 @@
import java.util.Iterator;
import java.util.List;

import junit.framework.TestCase;
import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParserManager;
import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.select.Select;
import net.sf.jsqlparser.test.TestException;
import net.sf.jsqlparser.test.simpleparsing.CCJSqlParserManagerTest;
import net.sf.jsqlparser.util.TablesNamesFinder;
import org.junit.Test;

public class SpeedTest extends TestCase {
public class SpeedTest {

private final static int NUM_REPS = 500;
private CCJSqlParserManager parserManager = new CCJSqlParserManager();

public SpeedTest(String arg0) {
super(arg0);
}
private final CCJSqlParserManager parserManager = new CCJSqlParserManager();

@Test
public void testSpeed() throws Exception {
// all the statements in testfiles/simple_parsing.txt
BufferedReader in = new BufferedReader(new InputStreamReader(SpeedTest.class.getResourceAsStream("/simple_parsing.txt")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,15 @@
import java.io.InputStreamReader;
import java.io.StringReader;

import junit.framework.TestCase;

import net.sf.jsqlparser.JSQLParserException;
import net.sf.jsqlparser.parser.CCJSqlParserManager;
import net.sf.jsqlparser.test.TestException;
import net.sf.jsqlparser.test.create.CreateTableTest;
import org.junit.Test;

public class CCJSqlParserManagerTest extends TestCase {

public CCJSqlParserManagerTest(String arg0) {
super(arg0);
}
public class CCJSqlParserManagerTest {

@Test
public void testParse() throws Exception {
CCJSqlParserManager parserManager = new CCJSqlParserManager();
BufferedReader in = new BufferedReader(new InputStreamReader(CreateTableTest.class.getResourceAsStream("/simple_parsing.txt")));
Expand Down
10 changes: 4 additions & 6 deletions src/test/java/net/sf/jsqlparser/test/truncate/TruncateTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@

import java.io.StringReader;

import junit.framework.TestCase;
import net.sf.jsqlparser.parser.CCJSqlParserManager;
import net.sf.jsqlparser.statement.truncate.Truncate;
import static org.junit.Assert.assertEquals;
import org.junit.Test;

public class TruncateTest extends TestCase {
public class TruncateTest {

private CCJSqlParserManager parserManager = new CCJSqlParserManager();

public TruncateTest(String arg0) {
super(arg0);
}

@Test
public void testTruncate() throws Exception {
String statement = "TRUncATE TABLE myschema.mytab";
Truncate truncate = (Truncate) parserManager.parse(new StringReader(statement));
Expand Down
Loading

0 comments on commit 7dd857e

Please sign in to comment.