diff options
author | James Ahlborn <jtahlborn@yahoo.com> | 2011-06-17 03:06:16 +0000 |
---|---|---|
committer | James Ahlborn <jtahlborn@yahoo.com> | 2011-06-17 03:06:16 +0000 |
commit | 82caf7c825cb6eb6aa97131534e2214cad12c8ba (patch) | |
tree | 725f9b59c6f7bde52214cce0b968508b360256a2 /test | |
parent | 69f4ea2454423c631c69444018d850428cfc09d0 (diff) | |
download | jackcess-82caf7c825cb6eb6aa97131534e2214cad12c8ba.tar.gz jackcess-82caf7c825cb6eb6aa97131534e2214cad12c8ba.zip |
add a few util methods related to indexes and joins
git-svn-id: https://svn.code.sf.net/p/jackcess/code/jackcess/trunk@566 f203690c-595d-4dc9-a70b-905162fa7fd2
Diffstat (limited to 'test')
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/IndexTest.java | 6 | ||||
-rw-r--r-- | test/src/java/com/healthmarketscience/jackcess/JoinerTest.java | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java index 21e4fd9..8f078f6 100644 --- a/test/src/java/com/healthmarketscience/jackcess/IndexTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/IndexTest.java @@ -88,14 +88,20 @@ public class IndexTest extends TestCase { for (final TestDB testDB : SUPPORTED_DBS_TEST_FOR_READ) { Table table = open(testDB).getTable("Table1"); Map<String, Boolean> foundPKs = new HashMap<String, Boolean>(); + Index pkIndex = null; for(Index index : table.getIndexes()) { foundPKs.put(index.getColumns().iterator().next().getName(), index.isPrimaryKey()); + if(index.isPrimaryKey()) { + pkIndex= index; + + } } Map<String, Boolean> expectedPKs = new HashMap<String, Boolean>(); expectedPKs.put("A", Boolean.TRUE); expectedPKs.put("B", Boolean.FALSE); assertEquals(expectedPKs, foundPKs); + assertSame(pkIndex, table.getPrimaryKeyIndex()); } } diff --git a/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java b/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java index 1f2961c..87f70fd 100644 --- a/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java +++ b/test/src/java/com/healthmarketscience/jackcess/JoinerTest.java @@ -83,7 +83,8 @@ public class JoinerTest extends TestCase { { final Set<String> colNames = new HashSet<String>( Arrays.asList("id", "data")); - + + Joiner revJoin = join.createReverse(); for(Map<String,Object> row : join.getFromTable()) { Integer id = (Integer)row.get("id"); @@ -98,6 +99,8 @@ public class JoinerTest extends TestCase { if(!expectedRows.isEmpty()) { assertEquals(expectedRows.get(0), join.findFirstRow(row)); + + assertEquals(row, revJoin.findFirstRow(expectedRows.get(0))); } else { assertNull(join.findFirstRow(row)); } |