GUACAMOLE-422: Correct toString() for GuacamoleProtocolVersion (must be manually implemented after migrating away from enum). Add unit test for verifying toString().

This commit is contained in:
Michael Jumper
2019-06-08 13:37:28 -07:00
parent 84bbbc4fa0
commit 1e676559a5
2 changed files with 16 additions and 0 deletions

View File

@@ -202,5 +202,10 @@ public class GuacamoleProtocolVersion {
&& this.patch == otherVersion.getPatch(); && this.patch == otherVersion.getPatch();
} }
@Override
public String toString() {
return "VERSION_" + getMajor() + "_" + getMinor() + "_" + getPatch();
}
} }

View File

@@ -137,4 +137,15 @@ public class GuacamoleProtocolVersionTest {
} }
/**
* Verifies that versions can be converted to their Guacamole protocol
* representation through calling toString().
*/
@Test
public void testToString() {
Assert.assertEquals("VERSION_1_0_0", GuacamoleProtocolVersion.VERSION_1_0_0.toString());
Assert.assertEquals("VERSION_1_1_0", GuacamoleProtocolVersion.VERSION_1_1_0.toString());
Assert.assertEquals("VERSION_12_103_398", new GuacamoleProtocolVersion(12, 103, 398).toString());
}
} }