Skip to content

Commit

Permalink
Tests and style
Browse files Browse the repository at this point in the history
  • Loading branch information
imply-cheddar committed Nov 30, 2022
1 parent f3d3270 commit 851acb8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static MapOfColumnsRowsAndColumns of(String name, Column col, String name
public static MapOfColumnsRowsAndColumns fromMap(Map<String, Column> map)
{
if (map == null || map.isEmpty()) {
throw new ISE("map[%s] cannot be null or empty", map);
throw new ISE("map[%s] cannot be null or empty.", map);
}

final Iterator<Map.Entry<String, Column>> iter = map.entrySet().iterator();
Expand All @@ -55,7 +55,7 @@ public static MapOfColumnsRowsAndColumns fromMap(Map<String, Column> map)
final int newCells = entry.getValue().toAccessor().numCells();
if (numCells != newCells) {
throw new ISE(
"Mismatched numCells, expectedNumCells[%s], actual[%s] from col[%s]",
"Mismatched numCells, expectedNumCells[%s], actual[%s] from col[%s].",
numCells,
newCells,
entry.getKey()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ public Integer accumulate(Integer accumulated, RowsAndColumns in)
yielder = yielder.next(0);
Assert.assertTrue(yielder.isDone());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ public void testSanity()
op.close(true);
op.close(false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ public boolean validateEquivalent(Processor otherProcessor)
return validationResult;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.druid.segment.column.ColumnType;
import org.junit.Assert;

import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -132,7 +133,9 @@ public void validate(RowsAndColumns rac)
public void validate(String name, RowsAndColumns rac)
{
if (fullColumnSet != null) {
Assert.assertEquals(name, fullColumnSet, rac.getColumnNames());
final Collection<String> columnNames = rac.getColumnNames();
Assert.assertEquals(name, fullColumnSet.size(), columnNames.size());
Assert.assertTrue(name, fullColumnSet.containsAll(columnNames));
}

for (Map.Entry<String, ColumnHelper> entry : helpers.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void testExceptionOnMismatchedCells()
);
}
catch (ISE ex) {
Assert.assertEquals("Mismatched numCells, expectedNumCells[1], actual[2] from col[2]", ex.getMessage());
Assert.assertEquals("Mismatched numCells, expectedNumCells[1], actual[2] from col[2].", ex.getMessage());
exceptionThrown = true;
}
Assert.assertTrue(exceptionThrown);
Expand Down

0 comments on commit 851acb8

Please sign in to comment.