Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/test/java/org/apache/ibatis/type/DateOnlyTypeHandlerTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2022 the original author or authors.
* Copyright 2009-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -42,7 +43,9 @@ public void shouldSetParameter() throws Exception {
@Test
public void shouldGetResultFromResultSetByName() throws Exception {
when(rs.getDate("column")).thenReturn(SQL_DATE);
assertEquals(DATE, TYPE_HANDLER.getResult(rs, "column"));
Date actual = TYPE_HANDLER.getResult(rs, "column");
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(rs, never()).wasNull();
}

Expand All @@ -58,7 +61,9 @@ public void shouldGetResultNullFromResultSetByName() throws Exception {
@Test
public void shouldGetResultFromResultSetByPosition() throws Exception {
when(rs.getDate(1)).thenReturn(SQL_DATE);
assertEquals(DATE, TYPE_HANDLER.getResult(rs, 1));
Date actual = TYPE_HANDLER.getResult(rs, 1);
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(rs, never()).wasNull();
}

Expand All @@ -74,7 +79,9 @@ public void shouldGetResultNullFromResultSetByPosition() throws Exception {
@Test
public void shouldGetResultFromCallableStatement() throws Exception {
when(cs.getDate(1)).thenReturn(SQL_DATE);
assertEquals(DATE, TYPE_HANDLER.getResult(cs, 1));
Date actual = TYPE_HANDLER.getResult(cs, 1);
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(cs, never()).wasNull();
}

Expand Down
15 changes: 11 additions & 4 deletions src/test/java/org/apache/ibatis/type/DateTypeHandlerTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2024 the original author or authors.
* Copyright 2009-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -43,7 +44,9 @@ public void shouldSetParameter() throws Exception {
@Test
public void shouldGetResultFromResultSetByName() throws Exception {
when(rs.getTimestamp("column")).thenReturn(TIMESTAMP);
assertEquals(DATE, TYPE_HANDLER.getResult(rs, "column"));
Date actual = TYPE_HANDLER.getResult(rs, "column");
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(rs, never()).wasNull();
}

Expand All @@ -59,7 +62,9 @@ public void shouldGetResultNullFromResultSetByName() throws Exception {
@Test
public void shouldGetResultFromResultSetByPosition() throws Exception {
when(rs.getTimestamp(1)).thenReturn(TIMESTAMP);
assertEquals(DATE, TYPE_HANDLER.getResult(rs, 1));
Date actual = TYPE_HANDLER.getResult(rs, 1);
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(rs, never()).wasNull();
}

Expand All @@ -75,7 +80,9 @@ public void shouldGetResultNullFromResultSetByPosition() throws Exception {
@Test
public void shouldGetResultFromCallableStatement() throws Exception {
when(cs.getTimestamp(1)).thenReturn(TIMESTAMP);
assertEquals(DATE, TYPE_HANDLER.getResult(cs, 1));
Date actual = TYPE_HANDLER.getResult(cs, 1);
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(cs, never()).wasNull();
}

Expand Down
15 changes: 11 additions & 4 deletions src/test/java/org/apache/ibatis/type/TimeOnlyTypeHandlerTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2024 the original author or authors.
* Copyright 2009-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,6 +17,7 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -43,7 +44,9 @@ public void shouldSetParameter() throws Exception {
@Test
public void shouldGetResultFromResultSetByName() throws Exception {
when(rs.getTime("column")).thenReturn(SQL_TIME);
assertEquals(DATE, TYPE_HANDLER.getResult(rs, "column"));
Date actual = TYPE_HANDLER.getResult(rs, "column");
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(rs, never()).wasNull();
}

Expand All @@ -59,7 +62,9 @@ public void shouldGetResultNullFromResultSetByName() throws Exception {
@Test
public void shouldGetResultFromResultSetByPosition() throws Exception {
when(rs.getTime(1)).thenReturn(SQL_TIME);
assertEquals(DATE, TYPE_HANDLER.getResult(rs, 1));
Date actual = TYPE_HANDLER.getResult(rs, 1);
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(rs, never()).wasNull();
}

Expand All @@ -75,7 +80,9 @@ public void shouldGetResultNullFromResultSetByPosition() throws Exception {
@Test
public void shouldGetResultFromCallableStatement() throws Exception {
when(cs.getTime(1)).thenReturn(SQL_TIME);
assertEquals(DATE, TYPE_HANDLER.getResult(cs, 1));
Date actual = TYPE_HANDLER.getResult(cs, 1);
assertEquals(DATE, actual);
assertSame(DATE.getClass(), actual.getClass());
verify(cs, never()).wasNull();
}

Expand Down
Loading