-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5528 from mP1/feature/SpreadsheetMetadataEnvironm…
…entContext-ignores-wrapped-EnvironmentContext-values SpreadsheetMetadataEnvironmentContext ignores wrapped EnvironmentCont…
- Loading branch information
Showing
3 changed files
with
60 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,23 +23,54 @@ | |
import walkingkooka.environment.EnvironmentContextTesting2; | ||
import walkingkooka.environment.EnvironmentContexts; | ||
import walkingkooka.environment.EnvironmentValueName; | ||
import walkingkooka.net.email.EmailAddress; | ||
import walkingkooka.spreadsheet.SpreadsheetId; | ||
import walkingkooka.spreadsheet.SpreadsheetName; | ||
|
||
import java.math.RoundingMode; | ||
import java.time.LocalDateTime; | ||
import java.util.Locale; | ||
import java.util.Optional; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public final class SpreadsheetMetadataEnvironmentContextTest implements EnvironmentContextTesting2<SpreadsheetMetadataEnvironmentContext>, | ||
ToStringTesting<SpreadsheetMetadataEnvironmentContext> { | ||
|
||
private final static LocalDateTime NOW = LocalDateTime.of( | ||
1999, | ||
12, | ||
31, | ||
12, | ||
58 | ||
); | ||
|
||
private final static EmailAddress USER = EmailAddress.parse("[email protected]"); | ||
|
||
private final static EnvironmentContext CONTEXT = EnvironmentContexts.empty( | ||
() -> NOW, | ||
Optional.of(USER) | ||
); | ||
|
||
@Test | ||
public void testWithNullFails() { | ||
public void testWithNullMetadataFails() { | ||
assertThrows( | ||
NullPointerException.class, | ||
() -> SpreadsheetMetadataEnvironmentContext.with(null) | ||
() -> SpreadsheetMetadataEnvironmentContext.with( | ||
null, | ||
CONTEXT | ||
) | ||
); | ||
} | ||
|
||
@Test | ||
public void testWithNullEnvironmentContextFails() { | ||
assertThrows( | ||
NullPointerException.class, | ||
() -> SpreadsheetMetadataEnvironmentContext.with( | ||
SpreadsheetMetadata.EMPTY, | ||
null | ||
) | ||
); | ||
} | ||
|
||
|
@@ -97,13 +128,22 @@ public void testEnvironmentValueNames() { | |
|
||
@Override | ||
public void testUser() { | ||
throw new UnsupportedOperationException(); | ||
this.userAndCheck(USER); | ||
} | ||
|
||
@Test | ||
public void testNow() { | ||
this.checkEquals( | ||
this.createContext().now(), | ||
NOW | ||
); | ||
} | ||
|
||
@Override | ||
public SpreadsheetMetadataEnvironmentContext createContext() { | ||
return SpreadsheetMetadataEnvironmentContext.with( | ||
SpreadsheetMetadataTesting.METADATA_EN_AU | ||
SpreadsheetMetadataTesting.METADATA_EN_AU, | ||
CONTEXT | ||
); | ||
} | ||
|
||
|