소스 검색

new: AMap#getOptional
update: pom.xml jacoco

Mariusz Sieroń 6 년 전
부모
커밋
b5a2e0c0d4

+ 4 - 9
assira/pom.xml

@@ -24,12 +24,11 @@
                     <plugin>
                         <groupId>org.jacoco</groupId>
                         <artifactId>jacoco-maven-plugin</artifactId>
-                        <version>0.7.5.201505241946</version>
                         <configuration>
                             <includes>
                                 <include>net/ranides/assira/annotations/Meta*</include>
                                 <include>net/ranides/assira/annotations/javac/**</include>
-                                
+
                                 <include>net/ranides/assira/awt/ImageLoader*</include>
                                 <include>net/ranides/assira/awt/AWTInvoker*</include>
 
@@ -48,13 +47,13 @@
                                 <include>net/ranides/assira/credentials/PWDBStore*</include>
 
                                 <include>net/ranides/assira/events/EventObserver*</include>
-                                
+
                                 <!-- <include>net/ranides/assira/io/PathUtils*</include>-->
 
                                 <include>net/ranides/assira/lexer/**</include>
-                                
+
                                 <include>net/ranides/assira/math/Bitwise*</include>
-                                
+
                                 <include>net/ranides/assira/text/LexicalCast*</include>
 
                                 <include>net/ranides/assira/xml/XMLQuery*</include>
@@ -74,15 +73,11 @@
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
                     <excludedGroups>net.ranides.assira.junit.JCategories$Slow,net.ranides.assira.junit.JCategories$Unstable</excludedGroups>
-                    <systemPropertyVariables>
-                        <assiraVersion>${project.version}</assiraVersion>
-                    </systemPropertyVariables>
                 </configuration>
             </plugin>
             <plugin>
                 <groupId>org.jacoco</groupId>
                 <artifactId>jacoco-maven-plugin</artifactId>
-                <version>0.7.5.201505241946</version>
                 <configuration>
                     <excludes>
                         <exclude>net/ranides/assira/test/**</exclude>

+ 6 - 4
assira/src/main/java/net/ranides/assira/collection/maps/AMap.java

@@ -6,13 +6,11 @@
  */
 package net.ranides.assira.collection.maps;
 
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
 import net.ranides.assira.collection.ACollection;
 import net.ranides.assira.collection.sets.ASet;
 
+import java.util.*;
+
 /**
  * An abstract class providing basic methods for maps implementing a
  * type-specific interface.
@@ -273,4 +271,8 @@ public abstract class AMap<K, V> implements Map<K, V>, java.io.Serializable {
         entrySet().clear();
     }
 
+    public Optional<V> getOptional(Object key) {
+        return Optional.ofNullable(get(key));
+    }
+
 }

+ 1 - 1
assira/src/test/java/net/ranides/assira/ContractTesters.java

@@ -23,7 +23,7 @@ public final class ContractTesters {
 
     private ContractTesters() { }
 
-    public static final String VERSION = RuntimeUtils.getProperty("assiraVersion");
+    public static final String VERSION = RuntimeUtils.getProperty("assira.version");
 
     public static final File JAR_TEST = new File("../assira.test/target/assira.test-"+VERSION+".jar");
     

+ 15 - 18
assira/src/test/java/net/ranides/assira/collection/suite/sets/SetTester.java

@@ -450,17 +450,16 @@ public class SetTester<T> {
         }
     }
     
-    @Ignore
     public static <V> void assertTail(TCollection<V> generator, SortedSet<V> target, V[] content) {
         assertTail(true, generator, target, content);
     }
-    
+
     private static <V> void assertTail(boolean nested, TCollection<V> generator, SortedSet<V> target, V[] content) {
         int n = content.length;
         assertEquals(n, target.tailSet(generator.item(0).value()).size());
         assertEquals(0, target.tailSet(generator.item(1000).value()).size());
         assertRange(target, content);
-        
+
         for(int i=0; i<n; i++) {
             V entry = content[i];
             V[] exp = ArrayUtils.tail(content, entry, generator.comparator());
@@ -473,16 +472,15 @@ public class SetTester<T> {
             }
         }
     }
-    
-    @Ignore
+
     public static <V> void assertSub(TCollection<V> generator, SortedSet<V> target, V[] content) {
         checkSub(true, generator, target, content);
     }
-    
+
     private static <V> void checkSub(boolean nested, TCollection<V> generator, SortedSet<V> target, V[] content) {
         assertSub(nested, generator, target, 3, 1000, content);
         assertSub(nested, generator, target, 5, 1000, content);
-            
+
         assertSub(nested, generator, target, 3, 7, content);
         assertSub(nested, generator, target, 3, 6, content);
         assertSub(nested, generator, target, 4, 6, content);
@@ -490,12 +488,12 @@ public class SetTester<T> {
 
         assertSub(nested, generator, target, 6, 7, content);
         assertSub(nested, generator, target, 6, 6, content);
-        
+
         assertSub(nested, generator, target, 0, 3, content);
         assertSub(nested, generator, target, 0, 5, content);
         assertSub(nested, generator, target, 0, 1000, content);
     }
-    
+
     private static <V> void assertSub(boolean nested, TCollection<V> generator, SortedSet<V> target, int ibegin, int iend, V[] content) {
         V begin = generator.item(ibegin).value();
         V end = generator.item(iend).value();
@@ -503,15 +501,14 @@ public class SetTester<T> {
         SortedSet<V> map = target.subSet(begin, end);
         assertEquals(exp.length, map.size());
         assertRange(map, exp);
-       
+
         if(nested) {
             assertHead(false, generator, map, exp);
             assertTail(false, generator, map, exp);
             checkSub(false, generator, map, exp);
         }
     }
-    
-    @Ignore
+
     public static <V> void assertRange(SortedSet<V> target, V[] content) {
         if(content.length > 0) {
             assertEquals(content[0], target.first());
@@ -521,29 +518,29 @@ public class SetTester<T> {
             assertThrows(NoSuchElementException.class, ()->target.last());
         }
     }
-    
+
     private void assertRemove(Set<T> target, TItem<T> item) {
         int size = target.size();
         assertTrue(target.remove(item.value()));
         assertEquals(size-1, target.size());
     }
-    
+
     private void assertNotRemove(Set<T> target, TItem<T> item) {
         int size = target.size();
         assertFalse(target.remove(item.value()));
         assertEquals(size, target.size());
     }
-    
+
     private void assertContains(Set<T> target, TItem<T> item) {
 		assertTrue(target.contains(item.value()));
     }
-    
+
     private void assertNotContains(Set<T> target, TItem<T> item) {
         assertFalse(target.contains(item.value()));
     }
-    
+
     private static <Q> void assertContentEquals(Collection<Q> a, Collection<Q> b) {
         assertTrue("assertContentEquals", a.containsAll(b) && b.containsAll(a));
     }
-    
+
 }

+ 1 - 1
assira/src/test/java/net/ranides/assira/math/RandomUtilsTest.java

@@ -11,9 +11,9 @@ import java.util.Random;
 
 import static org.junit.Assert.*;
 
+@Ignore("manual slow")
 public class RandomUtilsTest {
 
-    @Ignore("manual slow")
     @Test
     public void testStreamPerformance() {
         Random random = new SecureRandom();

+ 1 - 1
assira/src/test/java/net/ranides/assira/reflection/impl/RConstructorTest.java

@@ -158,7 +158,7 @@ public class RConstructorTest {
         assertEquals("Rome", city1.getLongName());
     }
 
-    @Ignore
+    @Ignore("very bad")
     @Test
     public void testMatchGeneric() {
         // @todo (assira #6) reflective: generics: match

+ 4 - 3
pom.xml

@@ -131,16 +131,16 @@
             <plugin>
                 <groupId>org.jacoco</groupId>
                 <artifactId>jacoco-maven-plugin</artifactId>
-                <version>0.7.5.201505241946</version>
+                <version>0.8.4</version>
                 <executions>
                     <execution>
+                        <id>default-prepare-agent</id>
                         <goals>
                             <goal>prepare-agent</goal>
                         </goals>
                     </execution>
                     <execution>
-                        <id>report</id>
-                        <phase>prepare-package</phase>
+                        <id>default-report</id>
                         <goals>
                             <goal>report</goal>
                         </goals>
@@ -154,6 +154,7 @@
                 <configuration>
                     <systemPropertyVariables>
                         <assira.junit.debug>${assira.junit.debug}</assira.junit.debug>
+                        <assira.version>${project.version}</assira.version>
                     </systemPropertyVariables>
                     <testFailureIgnore>false</testFailureIgnore>
                     <skip>false</skip>