-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* #54: Improved `MERGE` and its documentation.
- Loading branch information
1 parent
5c263c4
commit 036c532
Showing
15 changed files
with
270 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/test/java/com/exasol/sql/dml/merge/MatchedClauseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.exasol.sql.dml.merge; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.sameInstance; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class MatchedClauseTest { | ||
private MatchedClause matched; | ||
|
||
@BeforeEach | ||
void beforeEach() { | ||
this.matched = new MatchedClause(null); | ||
} | ||
|
||
@Test | ||
void testHasUpdateFalseByDefault() { | ||
assertThat(this.matched.hasUpdate(), equalTo(false)); | ||
} | ||
|
||
@Test | ||
void testHasUpdateTrue() { | ||
this.matched.thenUpdate(); | ||
assertThat(this.matched.hasUpdate(), equalTo(true)); | ||
} | ||
|
||
@Test | ||
void testGetUpdate() { | ||
final MergeUpdateClause update = this.matched.thenUpdate(); | ||
assertThat(this.matched.getUpdate(), sameInstance(update)); | ||
} | ||
|
||
@Test | ||
void testHasDeleteFalseByDefault() { | ||
assertThat(this.matched.hasDelete(), equalTo(false)); | ||
} | ||
|
||
@Test | ||
void testHasDeleteTrue() { | ||
this.matched.thenDelete(); | ||
assertThat(this.matched.hasDelete(), equalTo(true)); | ||
} | ||
|
||
@Test | ||
void testGetDelete() { | ||
final MergeDeleteClause delete = this.matched.thenDelete(); | ||
assertThat(this.matched.getDelete(), sameInstance(delete)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.exasol.sql.dml.merge; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class MergeTest { | ||
private Merge merge; | ||
|
||
@BeforeEach | ||
void beforeEach() { | ||
this.merge = new Merge("dst").using("src"); | ||
} | ||
|
||
@Test | ||
void testHasMatchedFalseByDefault() { | ||
assertThat(this.merge.hasMatched(), equalTo(false)); | ||
} | ||
|
||
@Test | ||
void testHasMatchedTrue() { | ||
this.merge.whenMatched(); | ||
assertThat(this.merge.hasMatched(), equalTo(true)); | ||
} | ||
|
||
@Test | ||
void testHasNotMatchedFalseByDefault() { | ||
assertThat(this.merge.hasNotMatched(), equalTo(false)); | ||
} | ||
|
||
@Test | ||
void testHasNotMatchedTrue() { | ||
this.merge.whenNotMatched(); | ||
assertThat(this.merge.hasNotMatched(), equalTo(true)); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
src/test/java/com/exasol/sql/dml/merge/NotMatchedClauseTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.exasol.sql.dml.merge; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.hamcrest.Matchers.sameInstance; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class NotMatchedClauseTest { | ||
private NotMatchedClause notMatched; | ||
|
||
@BeforeEach | ||
void beforeEach() { | ||
this.notMatched = new NotMatchedClause(null); | ||
} | ||
|
||
@Test | ||
void testHasInsertFalseByDefault() { | ||
assertThat(this.notMatched.hasInsert(), equalTo(false)); | ||
} | ||
|
||
@Test | ||
void testHasInsertTrue() { | ||
this.notMatched.thenInsert(); | ||
assertThat(this.notMatched.hasInsert(), equalTo(true)); | ||
} | ||
|
||
@Test | ||
void testGetInsert() { | ||
final MergeInsertClause insert = this.notMatched.thenInsert(); | ||
assertThat(this.notMatched.getInsert(), sameInstance(insert)); | ||
} | ||
} |
Oops, something went wrong.