Skip to content

Commit

Permalink
tip
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Turrell-Croft committed Aug 8, 2023
1 parent 10520e3 commit f338850
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1687,8 +1687,6 @@ void whenSigningStatementThenSignatureIsValid()

}



@Test
void whenBuildingStatementWithAgentObjectWithoutObjectTypeThenStatementObjectObjectTypeIsNotNull() {

Expand Down Expand Up @@ -1726,8 +1724,6 @@ void whenBuildingStatementWithAgentObjectWithObjectTypeThenStatementObjectObject

.build();

System.out.print(((Agent) statement.getObject()).getObjectType());

// Then Statement Object ObjectType Is Not Null
assertThat(((Agent) statement.getObject()).getObjectType(), is(notNullValue()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.junit.jupiter.api.Assertions.assertThrows;

import com.fasterxml.jackson.databind.ObjectMapper;
import dev.learning.xapi.model.Agent.AgentObjectType;
import java.io.IOException;
import java.net.URI;
import java.time.Instant;
Expand Down Expand Up @@ -368,4 +370,47 @@ void whenCallingToStringThenResultIsExpected() throws IOException {

}

@Test
void whenBuildingSubStatementWithAgentObjectWithoutObjectTypeThenSubStatementObjectObjectTypeIsNotNull() {

final Agent agent = Agent.builder().name("A N Other").objectType(null).build();

// When Building SubStatement With Agent Object Without ObjectType
final var subStatement = SubStatement.builder()

.agentActor(a -> a.name("A N Other"))

.verb(Verb.PASSED)

.object(agent)

.build();

// Then SubStatement Object ObjectType Is Not Null
assertThat(((Agent) subStatement.getObject()).getObjectType(), is(notNullValue()));

}

@Test
void whenBuildingSubStatementWithAgentObjectWithObjectTypeThenSubStatementObjectObjectTypeIsNotNull() {

final Agent agent = Agent.builder().name("A N Other").objectType(AgentObjectType.AGENT).build();

// When Building SubStatement With Agent Object With ObjectType
final var subStatement = SubStatement.builder()

.agentActor(a -> a.name("A N Other"))

.verb(Verb.PASSED)

.object(agent)

.build();

// Then SubStatement Object ObjectType Is Not Null
assertThat(((Agent) subStatement.getObject()).getObjectType(), is(notNullValue()));

}


}

0 comments on commit f338850

Please sign in to comment.