Skip to content

Commit

Permalink
Fix of Category creation from Word dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
berk76 committed Apr 14, 2019
1 parent fa67826 commit 411fc8d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
2 changes: 0 additions & 2 deletions src/main/java/cz/webstones/words/Dictionary.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,8 +480,6 @@ public void addCategory(String category) throws DictionaryException {

subjectState = DictionaryStateEnum.stateCategoryListChanged;
notifyAllObservers();

setCategory(category);
}

public void deleteCurrentCategory() throws DictionaryException {
Expand Down
1 change: 1 addition & 0 deletions src/main/java/cz/webstones/words/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public void run() {
private void addCategory(String category) {
try {
dict.addCategory(category);
dict.setCategory(category);
} catch (DictionaryException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cz/webstones/words/mp3/Mp3Creator.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
public class Mp3Creator {

/* https://soundoftext.com/docs */
private static String endpoint = " https://api.soundoftext.com";
private static String endpoint = "https://api.soundoftext.com";
private static boolean trustedInstalled = false;


Expand Down
12 changes: 6 additions & 6 deletions src/test/java/cz/webstones/words/DictionaryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ public void testWords() throws IOException, DictionaryException {
d.addCategory("TestCat3");

assertEquals("Observer getNoChange:", 0, o.getNoChange());
assertEquals("Observer getCurWordChanged:", 3, o.getCurWordChanged());
assertEquals("Observer getCurWordChanged:", 0, o.getCurWordChanged());
assertEquals("Observer getCurWordDeleted:", 0, o.getCurWordDeleted());
assertEquals("Observer getCurCategoryChanged:", 3, o.getCurCategoryChanged());
assertEquals("Observer getCurCategoryChanged:", 0, o.getCurCategoryChanged());
assertEquals("Observer getCategoryListChanged:", 3, o.getCategoryListChanged());
assertEquals("Observer getWordAdded:", 0, o.getWordAdded());
assertEquals("Observer getUnknown:", 0, o.getUnknown());
Expand All @@ -57,10 +57,10 @@ public void testWords() throws IOException, DictionaryException {
assertEquals("Observer getWordAdded:", 3, o.getWordAdded());
assertEquals("Observer getUnknown:", 0, o.getUnknown());

assertEquals("Fil dictionary size:", 0, d.size());
assertEquals("Fil dictionary size:", 3, d.size());
assertEquals("All dictionary size:", 3, d.sizeOfAll());
assertEquals("Category list size:", 3, d.getCategoryList().size());
assertEquals("Curr cat:", "TestCat3", d.getCurrentCategory());
assertEquals("Curr cat:",Dictionary.allCategoryName , d.getCurrentCategory());

/* Filter category */
o.reset();
Expand Down Expand Up @@ -149,9 +149,9 @@ public void testCategories() throws DictionaryException {
d.addCategory("TestCat3");

assertEquals("Observer getNoChange:", 0, o.getNoChange());
assertEquals("Observer getCurWordChanged:", 3, o.getCurWordChanged());
assertEquals("Observer getCurWordChanged:", 0, o.getCurWordChanged());
assertEquals("Observer getCurWordDeleted:", 0, o.getCurWordDeleted());
assertEquals("Observer getCurCategoryChanged:", 3, o.getCurCategoryChanged());
assertEquals("Observer getCurCategoryChanged:", 0, o.getCurCategoryChanged());
assertEquals("Observer getCategoryListChanged:", 3, o.getCategoryListChanged());
assertEquals("Observer getWordAdded:", 0, o.getWordAdded());
assertEquals("Observer getUnknown:", 0, o.getUnknown());
Expand Down

0 comments on commit 411fc8d

Please sign in to comment.