-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
158 additions
and
22 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
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
65 changes: 65 additions & 0 deletions
65
pmml-evaluator/src/test/java/org/jpmml/evaluator/FieldValueMapTest.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,65 @@ | ||
/* | ||
* Copyright (c) 2021 Villu Ruusmann | ||
* | ||
* This file is part of JPMML-Evaluator | ||
* | ||
* JPMML-Evaluator is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* JPMML-Evaluator is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with JPMML-Evaluator. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package org.jpmml.evaluator; | ||
|
||
import java.util.Map; | ||
|
||
import org.dmg.pmml.FieldName; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.junit.Assert.fail; | ||
|
||
public class FieldValueMapTest { | ||
|
||
@Test | ||
public void jdk8() throws Exception { | ||
// Assume that unit tests are never run in non-JDK8 compatible environment | ||
assertTrue(FieldValueMap.JDK8_API); | ||
|
||
assertNotNull(Map.class.getMethod("getOrDefault", Object.class, Object.class)); | ||
|
||
try { | ||
Map.class.getMethod("getOrDefault", Object.class, FieldValue.class); | ||
|
||
fail(); | ||
} catch(ReflectiveOperationException roe){ | ||
// Ignored | ||
} // End try | ||
|
||
try { | ||
Map.class.getMethod("getOrDefault", FieldName.class, FieldValue.class); | ||
|
||
fail(); | ||
} catch(ReflectiveOperationException roe){ | ||
// Ignored | ||
} | ||
|
||
assertNotNull(Map.class.getMethod("putIfAbsent", Object.class, Object.class)); | ||
|
||
try { | ||
Map.class.getMethod("putIfAbsent", FieldName.class, FieldValue.class); | ||
|
||
fail(); | ||
} catch(ReflectiveOperationException roe){ | ||
// Ignored | ||
} | ||
} | ||
} |
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