Skip to content

Commit

Permalink
Fix behavior and test exception relating to IdentifierNode.ofNames.
Browse files Browse the repository at this point in the history
git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@364 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
julianhyde committed Nov 5, 2010
1 parent 8d179c1 commit 5929226
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/org/olap4j/mdx/NameSegment.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public NameSegment(
this.region = region;
this.name = name;
this.quoting = quoting;
if (name == null) {
throw new NullPointerException();
}
if (!(quoting == Quoting.QUOTED || quoting == Quoting.UNQUOTED)) {
throw new IllegalArgumentException();
}
Expand Down
14 changes: 8 additions & 6 deletions testsrc/org/olap4j/mdx/MdxTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,16 @@ public void testIdentifierOfNames() {
segments.get(2).getQuoting());

assertEquals(
"xxx",
"[string].[with].[a [bracket]] in it]",
identifierNode.toString());

// Empty array is valid. (I don't feel strongly about this.)
identifierNode =
IdentifierNode.ofNames();
assertEquals(0, identifierNode.getSegmentList().size());
assertEquals("", identifierNode.toString());
// Empty array is invalid.
try {
identifierNode = IdentifierNode.ofNames();
fail("expected error, got " + identifierNode);
} catch (IllegalArgumentException e) {
// ok
}

// Array containing null is not valid.
try {
Expand Down

0 comments on commit 5929226

Please sign in to comment.