Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Rename Delimiter:parse(char c) to Delimiter.of(char c) #3433

Merged
merged 3 commits into from
Sep 27, 2019
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -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