fix: show the company on login history rows without letting callers set it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
This commit is contained in:
1 parent
bb39e6b805
commit
f0629192f2
2 files changed
+24
-2
No files matched your search
+22
@@ -0,0 +1,22 @@
|
||||
package com.solvway.services.system.model;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/** The company shows in login history, but a caller of the public record endpoint can never set it. */
|
||||
class LoginAuditJsonTest {
|
||||
|
||||
private final ObjectMapper json = new ObjectMapper().findAndRegisterModules();
|
||||
|
||||
@Test
|
||||
void companyIdIsWrittenButNeverRead() throws Exception {
|
||||
LoginAudit a = new LoginAudit();
|
||||
a.setCompanyId(2L);
|
||||
assertThat(json.writeValueAsString(a)).contains("\"companyId\":2");
|
||||
|
||||
LoginAudit in = json.readValue("{\"username\":\"x\",\"companyId\":2}", LoginAudit.class);
|
||||
assertThat(in.getCompanyId()).isNull();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user