diff --git a/guava-jdk8-HashMap-testfix.patch b/guava-jdk8-HashMap-testfix.patch
new file mode 100644
index 0000000..d4f2f9d
--- /dev/null
+++ b/guava-jdk8-HashMap-testfix.patch
@@ -0,0 +1,33 @@
+diff -ur guava-18.0.vanilla/guava/src/com/google/common/collect/Maps.java guava-18.0/guava/src/com/google/common/collect/Maps.java
+--- guava-18.0.vanilla/guava/src/com/google/common/collect/Maps.java 2014-08-25 18:39:22.000000000 +0000
++++ guava-18.0/guava/src/com/google/common/collect/Maps.java 2015-06-03 21:02:12.498000000 +0000
+@@ -206,11 +206,15 @@
+ return expectedSize + 1;
+ }
+ if (expectedSize < Ints.MAX_POWER_OF_TWO) {
+- return expectedSize + expectedSize / 3;
++ // This is the calculation used in JDK8 to resize when a putAll
++ // happens; it seems to be the most conservative calculation we
++ // can make. 0.75 is the default load factor.
++ return (int) ((float) expectedSize / 0.75F + 1.0F);
+ }
+ return Integer.MAX_VALUE; // any large value
+ }
+
++
+ /**
+ * Creates a mutable {@code HashMap} instance with the same mappings as
+ * the specified map.
+diff -ur guava-18.0.vanilla/guava-tests/test/com/google/common/collect/MapsTest.java guava-18.0/guava-tests/test/com/google/common/collect/MapsTest.java
+--- guava-18.0.vanilla/guava-tests/test/com/google/common/collect/MapsTest.java 2014-08-25 18:39:22.000000000 +0000
++++ guava-18.0/guava-tests/test/com/google/common/collect/MapsTest.java 2015-06-03 21:04:15.463000000 +0000
+@@ -156,7 +156,8 @@
+ Field tableField = HashMap.class.getDeclaredField("table");
+ tableField.setAccessible(true);
+ Object[] table = (Object[]) tableField.get(hashMap);
+- return table.length;
++ // In JDK8, table is set lazily, so it may be null.
++ return table == null ? 0 : table.length;
+ }
+
+ public void testCapacityForLargeSizes() {
diff --git a/guava.spec b/guava.spec
index 0b99fca..b7b513d 100644
--- a/guava.spec
+++ b/guava.spec
@@ -1,19 +1,23 @@
Name: guava
Version: 18.0
-Release: 4%{?dist}
+Release: 5%{?dist}
Summary: Google Core Libraries for Java
License: ASL 2.0
URL: https://github.com/google/guava
Source0: https://github.com/google/guava/archive/v%{version}.tar.gz
Patch0: %{name}-java8.patch
+Patch1: guava-jdk8-HashMap-testfix.patch
BuildRequires: java-devel >= 0:1.7.0
BuildRequires: maven-local
+BuildRequires: truth
BuildRequires: mvn(com.google.code.findbugs:jsr305) >= 0-0.6.20090319svn
BuildRequires: ant
BuildRequires: apache-ivy
+BuildRequires: easymock
+BuildRequires: mockito
BuildArch: noarch
@@ -34,20 +38,28 @@ Summary: Javadoc for %{name}
%description javadoc
API documentation for %{name}.
+%package testlib
+Summary: The guava-testlib subartefact
+
+%description testlib
+guava-testlib provides additional functionality for conveinent unit testing
+
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
find . -name '*.jar' -delete
%pom_disable_module guava-gwt
-%pom_disable_module guava-testlib
-%pom_disable_module guava-tests
-%pom_remove_plugin :animal-sniffer-maven-plugin guava
+%pom_remove_plugin -r :animal-sniffer-maven-plugin
%pom_remove_plugin :maven-gpg-plugin
%pom_remove_dep jdk:srczip guava
+%pom_remove_dep :caliper guava-tests
+%mvn_package :guava-parent guava
+%mvn_package :guava-tests __noinstall
-# javadoc generation fails due to strict doclint in JDK 8
-%pom_remove_plugin :maven-javadoc-plugin guava
+# javadoc generation fails due to strict doclint in JDK 1.8.0_45
+%pom_remove_plugin -r :maven-javadoc-plugin
%pom_xpath_inject /pom:project/pom:build/pom:plugins/pom:plugin/pom:configuration/pom:instructions "<_nouses>true" guava/pom.xml
@@ -55,19 +67,26 @@ find . -name '*.jar' -delete
%mvn_file :%{name} %{name}
%mvn_alias :%{name} com.google.collections:google-collections com.google.guava:guava-jdk5
-%mvn_build
+%mvn_build -s
%install
%mvn_install
-%files -f .mfiles
+%files -f .mfiles-guava
%doc AUTHORS CONTRIBUTORS README*
%license COPYING
%files javadoc -f .mfiles-javadoc
%license COPYING
+%files testlib -f .mfiles-guava-testlib
+
%changelog
+* Wed Jun 22 2015 Noa Resare - 18.0-5
+- enable module guava-testlib
+- enable tests in guava-testlib
+- backport fix to HashMap related test from 19.0-SNAPSHOT
+
* Wed Jun 17 2015 Fedora Release Engineering - 18.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild