Skip to content

Commit

Permalink
formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vchudnov-g committed Feb 2, 2024
1 parent 3afee59 commit bf40815
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@
public abstract class ConverterApp {
private final ConverterWriter writer;

private final Set<String> allowed_commands = new HashSet<>(Arrays.asList(
"--discovery_doc_path",
"--previous_proto_file_path",
"--output_file_path",
"--service_ignorelist",
"--message_ignorelist",
"--relative_link_prefix",
"--enums_as_strings",
"--output_comments"));
private final Set<String> allowed_commands =
new HashSet<>(
Arrays.asList(
"--discovery_doc_path",
"--previous_proto_file_path",
"--output_file_path",
"--service_ignorelist",
"--message_ignorelist",
"--relative_link_prefix",
"--enums_as_strings",
"--output_comments"));

protected ConverterApp(ConverterWriter writer) {
this.writer = writer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,29 @@
*/
package com.google.cloud.discotoproto3converter;

import java.util.Arrays;
import java.util.Map;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;

import java.util.Map;
import org.junit.Test;

public class ConverterAppTest {

@Test
public void parseArgsFull() {
DiscoToProto3ConverterApp app = new DiscoToProto3ConverterApp();
Map<String, String> parsedArgs = app.parseArgs(new String[] {
"--discovery_doc_path=alpha",
"--previous_proto_file_path=beta",
"--output_file_path=gamma",
"--service_ignorelist=delta",
"--message_ignorelist=epsilon",
"--relative_link_prefix=zeta",
"--enums_as_strings=eta",
"--output_comments=theta"});
Map<String, String> parsedArgs =
app.parseArgs(
new String[] {
"--discovery_doc_path=alpha",
"--previous_proto_file_path=beta",
"--output_file_path=gamma",
"--service_ignorelist=delta",
"--message_ignorelist=epsilon",
"--relative_link_prefix=zeta",
"--enums_as_strings=eta",
"--output_comments=theta"
});

assertEquals("alpha", parsedArgs.get("--discovery_doc_path"));
assertEquals("beta", parsedArgs.get("--previous_proto_file_path"));
Expand All @@ -51,11 +52,14 @@ public void parseArgsFull() {
@Test
public void parseArgsDefault() {
DiscoToProto3ConverterApp app = new DiscoToProto3ConverterApp();
Map<String, String> parsedArgs = app.parseArgs(new String[] {
"--discovery_doc_path=alpha",
"--previous_proto_file_path=beta",
"--output_file_path=gamma",
"--relative_link_prefix=zeta"});
Map<String, String> parsedArgs =
app.parseArgs(
new String[] {
"--discovery_doc_path=alpha",
"--previous_proto_file_path=beta",
"--output_file_path=gamma",
"--relative_link_prefix=zeta"
});

assertEquals("alpha", parsedArgs.get("--discovery_doc_path"));
assertEquals("beta", parsedArgs.get("--previous_proto_file_path"));
Expand All @@ -72,12 +76,14 @@ public void parseArgsUnrecognized() {
DiscoToProto3ConverterApp app = new DiscoToProto3ConverterApp();
assertThrows(
java.lang.IllegalArgumentException.class,
() -> app.parseArgs(new String[] {
"--discovery_doc_path=alpha",
"--unsupported_arg=omega",
"--previous_proto_file_path=beta",
"--output_file_path=gamma",
"--relative_link_prefix=zeta"}));
() ->
app.parseArgs(
new String[] {
"--discovery_doc_path=alpha",
"--unsupported_arg=omega",
"--previous_proto_file_path=beta",
"--output_file_path=gamma",
"--relative_link_prefix=zeta"
}));
}

}

0 comments on commit bf40815

Please sign in to comment.