make GsaVersion non-public for now
diff --git a/src/com/google/enterprise/adaptor/GsaVersion.java b/src/com/google/enterprise/adaptor/GsaVersion.java
index 3a9024e..78587c4 100644
--- a/src/com/google/enterprise/adaptor/GsaVersion.java
+++ b/src/com/google/enterprise/adaptor/GsaVersion.java
@@ -24,8 +24,8 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-/** Acquires and provides GSA's version . */
-public final class GsaVersion {
+/** Acquires and provides GSA's version. */
+final class GsaVersion {
private static final Charset charset = Charset.forName("UTF-8");
private String ver; // example: 7.2.1-1
@@ -48,7 +48,7 @@
}
/* Requsts entire detailed version string and returns it. */
- public static GsaVersion get(String host) throws IOException {
+ static GsaVersion get(String host) throws IOException {
URL url = new URL("http", host, "sw_version.txt");
URLConnection conn = url.openConnection();
InputStream in = conn.getInputStream();
@@ -57,11 +57,12 @@
}
/** Provides entire version string gotten from GSA, eg. 7.2.1-1 */
+ @Override
public String toString() {
return ver;
}
- public boolean atLeast(String minimum) {
+ public boolean isAtLeast(String minimum) {
GsaVersion min = new GsaVersion(minimum);
for (int i = 0; i < parts.length; i++) {
if (parts[i] < min.parts[i]) {
diff --git a/test/com/google/enterprise/adaptor/GsaVersionTest.java b/test/com/google/enterprise/adaptor/GsaVersionTest.java
index 65401a9..7e24e3f 100644
--- a/test/com/google/enterprise/adaptor/GsaVersionTest.java
+++ b/test/com/google/enterprise/adaptor/GsaVersionTest.java
@@ -46,16 +46,22 @@
@Test
public void testAtLeastWithBigger() {
- assertFalse(base.atLeast("7.4.0-1"));
+ assertFalse(base.isAtLeast("7.4.0-1"));
}
@Test
public void testAtLeastWithSmaller() {
- assertTrue(base.atLeast("6.14.36-155"));
+ assertTrue(base.isAtLeast("6.14.36-155"));
}
@Test
public void testAtLeastWithEqual() {
- assertTrue(base.atLeast("7.2.1-1"));
+ assertTrue(base.isAtLeast("7.2.1-1"));
+ }
+
+ @Test
+ public void testAtLeastWithWrongArgument() {
+ thrown.expect(IllegalArgumentException.class);
+ assertTrue(base.isAtLeast("6.p.36-155"));
}
}