2929import java .util .List ;
3030import java .util .TimeZone ;
3131
32+ import org .apache .doris .common .FeConstants ;
33+ import org .easymock .EasyMock ;
3234import org .junit .Assert ;
3335import org .junit .BeforeClass ;
3436import org .junit .Test ;
35-
37+ import org .junit .runner .RunWith ;
38+ import org .powermock .api .easymock .PowerMock ;
39+ import org .powermock .core .classloader .annotations .PowerMockIgnore ;
40+ import org .powermock .core .classloader .annotations .PrepareForTest ;
41+ import org .powermock .modules .junit4 .PowerMockRunner ;
42+
43+ @ RunWith (PowerMockRunner .class )
44+ @ PowerMockIgnore ({ "org.apache.log4j.*" , "javax.management.*" })
45+ @ PrepareForTest (Catalog .class )
3646public class PartitionKeyTest {
3747
3848 private static List <Column > allColumns ;
@@ -43,6 +53,8 @@ public class PartitionKeyTest {
4353 private static Column largeInt ;
4454 private static Column date ;
4555 private static Column datetime ;
56+
57+ private Catalog catalog ;
4658
4759 @ BeforeClass
4860 public static void setUp () {
@@ -143,6 +155,12 @@ public void compareTest() throws AnalysisException {
143155
144156 @ Test
145157 public void testSerialization () throws Exception {
158+ catalog = EasyMock .createMock (Catalog .class );
159+ PowerMock .mockStatic (Catalog .class );
160+ EasyMock .expect (Catalog .getInstance ()).andReturn (catalog ).anyTimes ();
161+ EasyMock .expect (Catalog .getCurrentCatalogJournalVersion ()).andReturn (FeConstants .meta_version ).anyTimes ();
162+ PowerMock .replay (Catalog .class );
163+
146164 // 1. Write objects to file
147165 File file = new File ("./keyRangePartition" );
148166 file .createNewFile ();
0 commit comments