-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix deprecation warnings in WikipediaInfo (and fixes infinite loop)
- Loading branch information
Showing
5 changed files
with
98 additions
and
56 deletions.
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
58 changes: 58 additions & 0 deletions
58
dkpro-jwpl-api/src/test/java/org/dkpro/jwpl/api/WikipediaInfoTest.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,58 @@ | ||
/* | ||
* Licensed to the Technische Universität Darmstadt under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The Technische Universität Darmstadt | ||
* licenses this file to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.dkpro.jwpl.api; | ||
|
||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
public class WikipediaInfoTest | ||
extends BaseJWPLTest | ||
{ | ||
|
||
private static WikipediaInfo wikipediaInfo; | ||
|
||
/** | ||
* Made this static so that following tests don't run if assumption fails. (With AT_Before, | ||
* tests also would not be executed but marked as passed) This could be changed back as soon as | ||
* JUnit ignored tests after failed assumptions | ||
*/ | ||
@BeforeAll | ||
public static void setupWikipedia() | ||
{ | ||
DatabaseConfiguration db = obtainHSDLDBConfiguration(); | ||
try { | ||
wikipediaInfo = new WikipediaInfo(new Wikipedia(db)); | ||
} | ||
catch (Exception e) { | ||
fail("WikipediaInfo could not be initialized: " + e.getLocalizedMessage()); | ||
} | ||
} | ||
|
||
@Test | ||
public void testGetAverageFanOut() { | ||
double average = wikipediaInfo.getAverageFanOut(); | ||
assertTrue(average > 0); | ||
assertEquals(1.1176470588235294d, average); | ||
//call it twice | ||
average = wikipediaInfo.getAverageFanOut(); | ||
assertEquals(1.1176470588235294d, average); | ||
} | ||
|
||
} |
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