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

Formatter #210

Merged
merged 6 commits into from Feb 10, 2017
Merged

Formatter #210

merged 6 commits into from Feb 10, 2017

Conversation

marimbMax
Copy link
Collaborator

No description provided.

* Test inputs that are not percentages
*/
@Test(expected = InvalidPercentageException.class)
public void testPercenteageFormat() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

try {
result = Integer.parseInt(port);
} catch (NumberFormatException e) {
throw new InvalidPortException(port, "contains non-digits");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Schöner wäre ein Regex. So hat man halt exceptions im normalen Ablauf

@@ -3,31 +3,80 @@
/**
* This class provides static methods to check input formats.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* @param tried The value that was tried to parse
* @param reason The reason for the failture
*
* @param reason The reason for the failure
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum Leerzeile?

/**
* JUnit test class for FormatChecker.java
* @author Maximilian Schwarzmann
*
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


input = "20b10";
result = FormatChecker.checkPort(input);
assertEquals(20000, result);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Das Assert brauchst du nicht (wenn doch, bitte Zahl anpassen)

* Test negative percentage
*/
@Test(expected = InvalidPercentageException.class)
public void testPercenteageRange() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

* Test valid port
*/
@Test
public void testHostPort() {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port? Da wird ein Hostname getestet

input = "&/(&";
FormatChecker.checkHost(input);
}
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline

if (host == null) {
throw new InvalidHostException(host, "is null");
}
String hostnamePattern = "[0-9a-zA-Z\\-_.]+";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Musst mal schauen, ob man den Punkt auch escapen muss

@ByteHamster
Copy link
Owner

\ sollte nicht erkannt werden

@ByteHamster ByteHamster merged commit d231982 into master Feb 10, 2017
@ByteHamster ByteHamster deleted the formatter branch February 10, 2017 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants