@@ -27,6 +27,84 @@ public class SemanticVersionTest {
2727 @ Rule
2828 public ExpectedException thrown = ExpectedException .none ();
2929
30+
31+ @ Test
32+ public void semanticVersionInvalidOnlyDash () throws Exception {
33+ thrown .expect (Exception .class );
34+ SemanticVersion semanticVersion = new SemanticVersion ("-" );
35+ semanticVersion .splitSemanticVersion ();
36+ }
37+
38+ @ Test
39+ public void semanticVersionInvalidOnlyDot () throws Exception {
40+ thrown .expect (Exception .class );
41+ SemanticVersion semanticVersion = new SemanticVersion ("." );
42+ semanticVersion .splitSemanticVersion ();
43+ }
44+
45+ @ Test
46+ public void semanticVersionInvalidDoubleDot () throws Exception {
47+ thrown .expect (Exception .class );
48+ SemanticVersion semanticVersion = new SemanticVersion (".." );
49+ semanticVersion .splitSemanticVersion ();
50+ }
51+
52+ @ Test
53+ public void semanticVersionInvalidPlus () throws Exception {
54+ thrown .expect (Exception .class );
55+ SemanticVersion semanticVersion = new SemanticVersion ("+" );
56+ semanticVersion .splitSemanticVersion ();
57+ }
58+
59+ @ Test
60+ public void semanticVersionInvalidPlusTest () throws Exception {
61+ thrown .expect (Exception .class );
62+ SemanticVersion semanticVersion = new SemanticVersion ("+test" );
63+ semanticVersion .splitSemanticVersion ();
64+ }
65+
66+ @ Test
67+ public void semanticVersionInvalidOnlySpace () throws Exception {
68+ thrown .expect (Exception .class );
69+ SemanticVersion semanticVersion = new SemanticVersion (" " );
70+ semanticVersion .splitSemanticVersion ();
71+ }
72+
73+ @ Test
74+ public void semanticVersionInvalidSpaces () throws Exception {
75+ thrown .expect (Exception .class );
76+ SemanticVersion semanticVersion = new SemanticVersion ("2 .3. 0" );
77+ semanticVersion .splitSemanticVersion ();
78+ }
79+
80+ @ Test
81+ public void semanticVersionInvalidDotButNoMinorVersion () throws Exception {
82+ thrown .expect (Exception .class );
83+ SemanticVersion semanticVersion = new SemanticVersion ("2." );
84+ semanticVersion .splitSemanticVersion ();
85+ }
86+
87+ @ Test
88+ public void semanticVersionInvalidDotButNoMajorVersion () throws Exception {
89+ thrown .expect (Exception .class );
90+ SemanticVersion semanticVersion = new SemanticVersion (".2.1" );
91+ semanticVersion .splitSemanticVersion ();
92+ }
93+
94+ @ Test
95+ public void semanticVersionInvalidComma () throws Exception {
96+ thrown .expect (Exception .class );
97+ SemanticVersion semanticVersion = new SemanticVersion ("," );
98+ semanticVersion .splitSemanticVersion ();
99+ }
100+
101+ @ Test
102+ public void semanticVersionInvalidMissingMajorMinorPatch () throws Exception {
103+ thrown .expect (Exception .class );
104+ SemanticVersion semanticVersion = new SemanticVersion ("+build-prerelease" );
105+ semanticVersion .splitSemanticVersion ();
106+ }
107+
30108 @ Test
31109 public void semanticVersionInvalidMajorShouldBeNumberOnly () throws Exception {
32110 thrown .expect (Exception .class );
0 commit comments