Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1156,20 +1156,28 @@ public void testSingleRowMultipleFamily() throws Exception {
}

@Test
public void testNull() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());

public void testNullTableName() {
// Null table name (should NOT work)
try {
TEST_UTIL.createTable((TableName)null, FAMILY);
fail("Creating a table with null name passed, should have failed");
} catch(Exception e) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have split the method, we can use the @test(expected = XXXException.class) so we do not need to catch the exception any more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. Makes perfect sense.

}

@Test
public void testNullFamilyName() {
final TableName tableName = TableName.valueOf(name.getMethodName());

// Null family (should NOT work)
try {
TEST_UTIL.createTable(tableName, new byte[][]{null});
fail("Creating a table with a null family passed, should fail");
} catch(Exception e) {}
}

@Test
public void testNullRowAndQualifier() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());

try (Table ht = TEST_UTIL.createTable(tableName, FAMILY)) {

Expand Down Expand Up @@ -1201,9 +1209,13 @@ public void testNull() throws Exception {
assertEmptyResult(result);
}
}
}

// Use a new table
try (Table ht = TEST_UTIL.createTable(TableName.valueOf(name.getMethodName() + "2"), FAMILY)) {
@Test
public void testNullEmptyQualifier() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());

try (Table ht = TEST_UTIL.createTable(tableName, FAMILY)) {

// Empty qualifier, byte[0] instead of null (should work)
try {
Expand Down Expand Up @@ -1234,7 +1246,14 @@ public void testNull() throws Exception {
} catch (Exception e) {
throw new IOException("Using a row with null qualifier threw exception, should ");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not your fault but since this is a refactoring, let's fix the message?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, fixed.

}
}
}

@Test
public void testNullValue() throws IOException {
final TableName tableName = TableName.valueOf(name.getMethodName());

try (Table ht = TEST_UTIL.createTable(tableName, FAMILY)) {
// Null value
try {
Put put = new Put(ROW);
Expand Down Expand Up @@ -1550,6 +1569,7 @@ public void testVersions() throws Exception {
}

@Test
@SuppressWarnings("checkstyle:MethodLength")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in the future we will also split these methods so let's do not suppress the warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to do so. But it seems to me that these tests are doing a sequence of operations which cannot be broken without doing a lot of redundant initialisation logic. I believe that the gain of making these tests smaller doesn't overcome the hit on the efficiency.

To be honest, checkstyle rule for maximizing the size of integration tests doesn't make sense to me.

public void testVersionLimits() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
byte [][] FAMILIES = makeNAscii(FAMILY, 3);
Expand Down Expand Up @@ -5965,6 +5985,7 @@ public void testNullWithReverseScan() throws Exception {
}

@Test
@SuppressWarnings("checkstyle:MethodLength")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

public void testDeletesWithReverseScan() throws Exception {
final TableName tableName = TableName.valueOf(name.getMethodName());
byte[][] ROWS = makeNAscii(ROW, 6);
Expand Down