-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Added JUnit Testcases to the languagetool repo #9648
Open
pawsitive-pc
wants to merge
3
commits into
languagetool-org:master
Choose a base branch
from
pawsitive-pc:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
languagetool-core/src/test/java/org/languagetool/GlobalConfigTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package org.languagetool; | ||
|
||
import org.junit.Test; | ||
import java.io.File; | ||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotEquals ; | ||
|
||
public class GlobalConfigTest { | ||
|
||
/* This tests the equals method */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment isn't really necessary |
||
@Test | ||
public void testEquals() { | ||
//Initialise the objects | ||
GlobalConfig config1 = new GlobalConfig(); | ||
GlobalConfig config2 = new GlobalConfig(); | ||
|
||
// Both objects are initially empty and should be equal | ||
assertEquals(config1, config2); | ||
|
||
config1.setGrammalecteServer("server1"); | ||
config2.setGrammalecteServer("server2"); | ||
|
||
//Check if they are different servers | ||
assertNotEquals(config1, config2); | ||
|
||
//Set config1 to the same server | ||
config1.setGrammalecteServer("server2"); | ||
|
||
//Check for same server | ||
assertEquals(config1, config2); | ||
|
||
config1.setBeolingusFile(new File("file1")); | ||
assertNotEquals(config1, config2); | ||
} | ||
|
||
/* This tests the hashCode method */ | ||
@Test | ||
public void testHashCode() { | ||
GlobalConfig config1 = new GlobalConfig(); | ||
GlobalConfig config2 = new GlobalConfig(); | ||
|
||
// Initially, both objects are empty, so their hash codes should be equal. | ||
assertEquals(config1.hashCode(), config2.hashCode()); | ||
|
||
config1.setGrammalecteServer("server1"); | ||
config2.setGrammalecteServer("server2"); | ||
|
||
// After setting different servers, their hash codes should not be equal. | ||
assertNotEquals(config1.hashCode(), config2.hashCode()); | ||
|
||
config1.setGrammalecteServer("server2"); | ||
|
||
// When both objects have the same server, their hash codes should be equal again. | ||
assertEquals(config1.hashCode(), config2.hashCode()); | ||
|
||
config1.setBeolingusFile(new File("file1")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you use a different property? beoLingus isn't used anymore and might soon be removed |
||
|
||
// After setting different Beolingus files, their hash codes should not be equal. | ||
assertNotEquals(config1.hashCode(), config2.hashCode()); | ||
} | ||
|
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add the standard license header we use? (With your name as the copyright holder?)