Package org.apache.crunch.CombineFn

Examples of org.apache.crunch.CombineFn.StringConcatAggregator


  @Test
  public void testConcatenation() {
    String[] arrayNull = new String[] { null, "" };
    assertEquals(ImmutableList.of("foofoobarbar"), applyAggregator(
        new StringConcatAggregator("", true), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("foo/foobar/bar"), applyAggregator(
        new StringConcatAggregator("/", false), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("  "), applyAggregator(
        new StringConcatAggregator(" ", true), ImmutableList.of(" ", "")));
    assertEquals(ImmutableList.of(""), applyAggregator(
        new StringConcatAggregator(" ", true), Arrays.asList(arrayNull)));
    assertEquals(ImmutableList.of("foo bar"), applyAggregator(
        new StringConcatAggregator(" ", true, 20, 3), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("foo foobar"), applyAggregator(
        new StringConcatAggregator(" ", true, 10, 6), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("foo bar"), applyAggregator(
        new StringConcatAggregator(" ", true, 9, 6), ImmutableList.of("foo", "foobar", "bar")));
  }
View Full Code Here


        new StringConcatAggregator(" ", true, 9, 6), ImmutableList.of("foo", "foobar", "bar")));
  }

  @Test
  public void testConcatenationReset() {
    StringConcatAggregator a = new StringConcatAggregator(" ", true, 10, 6);

    assertEquals(ImmutableList.of("foo foobar"), applyAggregator(a, ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("foo foobar"), applyAggregator(a, ImmutableList.of("foo", "foobar", "bar")));
  }
View Full Code Here

  @Test(expected = NullPointerException.class)
  public void testConcatenationNullException() {
    String[] arrayNull = new String[] { null, "" };
    assertEquals(ImmutableList.of(""), applyAggregator(
        new StringConcatAggregator(" ", false), Arrays.asList(arrayNull)));
  }
View Full Code Here

  @Test
  public void testConcatenation() {
    String[] arrayNull = new String[] { null, "" };
    assertEquals(ImmutableList.of("foofoobarbar"), applyAggregator(
        new StringConcatAggregator("", true), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("foo/foobar/bar"), applyAggregator(
        new StringConcatAggregator("/", false), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("  "), applyAggregator(
        new StringConcatAggregator(" ", true), ImmutableList.of(" ", "")));
    assertEquals(ImmutableList.of(""), applyAggregator(
        new StringConcatAggregator(" ", true), Arrays.asList(arrayNull)));
    assertEquals(ImmutableList.of("foo bar"), applyAggregator(
        new StringConcatAggregator(" ", true, 20, 3), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("foo foobar"), applyAggregator(
        new StringConcatAggregator(" ", true, 10, 6), ImmutableList.of("foo", "foobar", "bar")));
    assertEquals(ImmutableList.of("foo bar"), applyAggregator(
        new StringConcatAggregator(" ", true, 9, 6), ImmutableList.of("foo", "foobar", "bar")));
  }
View Full Code Here

  @Test(expected = NullPointerException.class)
  public void testConcatenationNullException() {
    String[] arrayNull = new String[] { null, "" };
    assertEquals(ImmutableList.of(""), applyAggregator(
        new StringConcatAggregator(" ", false), Arrays.asList(arrayNull)));
  }
View Full Code Here

TOP

Related Classes of org.apache.crunch.CombineFn.StringConcatAggregator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.