@Test(timeout=2000) public void testBooleanSplitter() throws Exception{ BooleanSplitter splitter = new BooleanSplitter(); ResultSet result = mock(ResultSet.class); when(result.getString(1)).thenReturn("result1"); List<InputSplit> splits=splitter.split(configuration, result, "column"); assertSplits(new String[] {"column = FALSE column = FALSE", "column IS NULL column IS NULL"}, splits); when(result.getString(1)).thenReturn("result1"); when(result.getString(2)).thenReturn("result2"); when(result.getBoolean(1)).thenReturn(true); when(result.getBoolean(2)).thenReturn(false); splits=splitter.split(configuration, result, "column"); assertEquals(0, splits.size()); when(result.getString(1)).thenReturn("result1"); when(result.getString(2)).thenReturn("result2"); when(result.getBoolean(1)).thenReturn(false); when(result.getBoolean(2)).thenReturn(true); splits = splitter.split(configuration, result, "column"); assertSplits(new String[] { "column = FALSE column = FALSE", ".*column = TRUE"}, splits); }
return new BooleanSplitter();
return new BooleanSplitter();