我正在为我的项目的DAO类编写测试。但是,当我使用Mockito的verify()
方法时,它会抛出NullPointerException
,因为createQuery()
方法会返回null
。我该如何解决?
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private EntityManager entityManagerMock;
@InjectMocks
private TaksitPlanSatiriDao taksitPlanSatiriDao = new TaksitPlanSatiriDaoJpa();
@Before
public void setUp() {
taksitPlanSatiriEntity = new TaksitPlanSatiriEntity();
}
@Test
public void shouldUpdateWhenGuncelleCalledWithTaksitPlanSatiriEntity() {
taksitPlanSatiriDao.guncelle(taksitPlanSatiriEntity);
Mockito.verify(entityManagerMock).createQuery(ArgumentMatchers.anyString()).executeUpdate();
}
答案 0 :(得分:0)
尝试:
ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.OpenCSVSerde'
WITH SERDEPROPERTIES (
'field.delim'=',',
'line.delim'='\n',
'serialization.format'=',',
'serialization.encoding'='UTF-8')
STORED AS INPUTFORMAT
'org.apache.hadoop.mapred.TextInputFormat'
OUTPUTFORMAT
'org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat'
TBLPROPERTIES("skip.header.line.count"="1")
这是基于“深层存根”文档的: