Skip to content

Commit

Permalink
fix: Rename Delimiter:parse(char c) to Delimiter.of(char c) (#3433)
Browse files Browse the repository at this point in the history
  • Loading branch information
purplefox committed Sep 27, 2019
1 parent 6aa4cc3 commit 8716c41
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public final class Delimiter {

private final char delimiter;

public static Delimiter parse(final char ch) {
return new Delimiter(ch);
}

private Delimiter(final char delimiter) {
this.delimiter = delimiter;
}

public static Delimiter of(final char ch) {
return new Delimiter(ch);
}

public static Delimiter parse(final String str) {
if (str == null) {
throw new NullPointerException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public void shouldThrowNPEs() {
public void shouldImplementEquals() {
new EqualsTester()
.addEqualityGroup(
FormatInfo.of(Format.DELIMITED, Optional.empty(), Optional.of(Delimiter.parse('x'))),
FormatInfo.of(Format.DELIMITED, Optional.empty(), Optional.of(Delimiter.parse('x')))
FormatInfo.of(Format.DELIMITED, Optional.empty(), Optional.of(Delimiter.of('x'))),
FormatInfo.of(Format.DELIMITED, Optional.empty(), Optional.of(Delimiter.of('x')))
)
.addEqualityGroup(
FormatInfo.of(Format.AVRO, Optional.of("something"), Optional.empty()),
Expand Down Expand Up @@ -130,7 +130,7 @@ public void shouldThrowWhenAttemptingToUseValueDelimeterWithAvroFormat() {
expectedException.expectMessage("Delimeter only supported with DELIMITED format");

// When:
FormatInfo.of(Format.AVRO, Optional.of("something"), Optional.of(Delimiter.parse('x')));
FormatInfo.of(Format.AVRO, Optional.of("something"), Optional.of(Delimiter.of('x')));
}

@Test
Expand All @@ -140,6 +140,6 @@ public void shouldThrowWhenAttemptingToUseValueDelimeterWithJsonFormat() {
expectedException.expectMessage("Delimeter only supported with DELIMITED format");

// When:
FormatInfo.of(Format.JSON, Optional.empty(), Optional.of(Delimiter.parse('x')));
FormatInfo.of(Format.JSON, Optional.empty(), Optional.of(Delimiter.of('x')));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@Immutable
public class KsqlDelimitedSerdeFactory implements KsqlSerdeFactory {

private static final Delimiter DEFAULT_DELIMITER = Delimiter.parse(',');
private static final Delimiter DEFAULT_DELIMITER = Delimiter.of(',');

private final CSVFormat csvFormat;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class KsqlDelimitedSerdeFactoryTest {

@Before
public void setUp() {
factory = new KsqlDelimitedSerdeFactory(Optional.of(Delimiter.parse(',')));
factory = new KsqlDelimitedSerdeFactory(Optional.of(Delimiter.of(',')));
}

@Test
Expand Down

0 comments on commit 8716c41

Please sign in to comment.