-
Notifications
You must be signed in to change notification settings - Fork 16
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
- Loading branch information
Ivan Senic
authored
Mar 9, 2023
1 parent
665ce63
commit e3a4f54
Showing
12 changed files
with
1,963 additions
and
1,347 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
47 changes: 47 additions & 0 deletions
47
src/test/java/io/stargate/sgv2/jsonapi/api/model/command/impl/UpdateManyCommandTest.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,47 @@ | ||
package io.stargate.sgv2.jsonapi.api.model.command.impl; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
import io.stargate.sgv2.common.testprofiles.NoGlobalResourcesTestProfile; | ||
import java.util.Set; | ||
import javax.inject.Inject; | ||
import javax.validation.ConstraintViolation; | ||
import javax.validation.Validator; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@QuarkusTest | ||
@TestProfile(NoGlobalResourcesTestProfile.Impl.class) | ||
class UpdateManyCommandTest { | ||
|
||
@Inject ObjectMapper objectMapper; | ||
|
||
@Inject Validator validator; | ||
|
||
@Nested | ||
class Validation { | ||
|
||
@Test | ||
public void noUpdateClause() throws Exception { | ||
String json = | ||
""" | ||
{ | ||
"updateMany": { | ||
"filter": {"name": "Aaron"} | ||
} | ||
} | ||
"""; | ||
|
||
UpdateManyCommand command = objectMapper.readValue(json, UpdateManyCommand.class); | ||
Set<ConstraintViolation<UpdateManyCommand>> result = validator.validate(command); | ||
|
||
assertThat(result) | ||
.isNotEmpty() | ||
.extracting(ConstraintViolation::getMessage) | ||
.contains("must not be null"); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/test/java/io/stargate/sgv2/jsonapi/api/model/command/impl/UpdateOneCommandTest.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,47 @@ | ||
package io.stargate.sgv2.jsonapi.api.model.command.impl; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import io.quarkus.test.junit.QuarkusTest; | ||
import io.quarkus.test.junit.TestProfile; | ||
import io.stargate.sgv2.common.testprofiles.NoGlobalResourcesTestProfile; | ||
import java.util.Set; | ||
import javax.inject.Inject; | ||
import javax.validation.ConstraintViolation; | ||
import javax.validation.Validator; | ||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@QuarkusTest | ||
@TestProfile(NoGlobalResourcesTestProfile.Impl.class) | ||
class UpdateOneCommandTest { | ||
|
||
@Inject ObjectMapper objectMapper; | ||
|
||
@Inject Validator validator; | ||
|
||
@Nested | ||
class Validation { | ||
|
||
@Test | ||
public void noUpdateClause() throws Exception { | ||
String json = | ||
""" | ||
{ | ||
"updateOne": { | ||
"filter": {"name": "Aaron"} | ||
} | ||
} | ||
"""; | ||
|
||
UpdateOneCommand command = objectMapper.readValue(json, UpdateOneCommand.class); | ||
Set<ConstraintViolation<UpdateOneCommand>> result = validator.validate(command); | ||
|
||
assertThat(result) | ||
.isNotEmpty() | ||
.extracting(ConstraintViolation::getMessage) | ||
.contains("must not be null"); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.