Gyeongtae Park created ZEPPELIN-6281:
----------------------------------------

             Summary: Add Unit Tests for LivyVersion Class
                 Key: ZEPPELIN-6281
                 URL: https://issues.apache.org/jira/browse/ZEPPELIN-6281
             Project: Zeppelin
          Issue Type: Test
            Reporter: Gyeongtae Park
            Assignee: yeonkyung Ryu
             Fix For: 1.0.0, 0.12.1, 0.13.0


The {{LivyVersion}} class in 
{{zeppelin/livy/src/main/java/org/apache/zeppelin/livy/LivyVersion.java}} is 
responsible for parsing and comparing Livy version strings.
Currently, there are no dedicated unit tests to validate its parsing logic, 
comparison methods, and feature support checks.

Adding tests will help ensure that:
 * Version string parsing works for normal, pre-release, and invalid formats.

 * Comparison methods ({{{}newerThan{}}}, {{{}olderThan{}}}, etc.) behave 
correctly for various version combinations.

 * Feature flag methods ({{{}isCancelSupported{}}}, {{{}isSharedSupported{}}}, 
etc.) return correct values.

 * Invalid or unexpected version strings are handled gracefully (e.g., fallback 
to {{{}99999{}}}).

*Example Test Cases*
{code:java}
@Test
public void testVersionParsing() {
    LivyVersion v = new LivyVersion("1.6.2");
    assertEquals(10602, v.toNumber());
    assertEquals("1.6.2", v.toString());
}

@Test
public void testComparisonLogic() {
    LivyVersion v1 = new LivyVersion("0.5.0");
    LivyVersion v2 = new LivyVersion("0.4.0");
    assertTrue(v1.newerThan(v2));
    assertTrue(v2.olderThan(v1));
}

@Test
public void testInvalidVersionString() {
    LivyVersion v = new LivyVersion("invalid");
    assertEquals(99999, v.toNumber());
}
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to