java sqlmap_Java SqlMapClient.update方法代码示例

这篇博客展示了如何在Java中使用SqlMapClient的update方法进行数据更新操作。通过测试用例,详细解释了如何执行update方法,包括传入不同参数的场景,并通过断言检查确保方法调用及参数传递的正确性。
摘要由CSDN通过智能技术生成

import com.ibatis.sqlmap.client.SqlMapClient; //导入方法依赖的package包/类

@Test

public void updateShouldBeTraced() throws Exception {

// Given

SqlMapClient sqlMapClient = new SqlMapClientImpl(this.mockSqlMapExecutorDelegate);

// When

sqlMapClient.update("updateId");

sqlMapClient.update("updateId", new Object());

// Then

final List spanEvents = getCurrentSpanEvents();

assertThat(spanEvents.size(), is(2));

// Check Method

final SpanEventBo updateWith1ArgSpanEvent = spanEvents.get(0);

final SpanEventBo updateWith2ArgSpanEvent = spanEvents.get(1);

assertThat(updateWith1ArgSpanEvent.getApiId(), not(0));

assertThat(updateWith2ArgSpanEvent.getApiId(), not(0));

assertThat(updateWith1ArgSpanEvent.getApiId(), not(updateWith2ArgSpanEvent.getApiId()));

// Check Parameter

final List updateWith1ArgAnnotations = updateWith1ArgSpanEvent.getAnnotationBoList();

assertThat(updateWith1ArgAnnotations.size(), is(1));

final AnnotationBo updateWith1ArgParameterAnnotation = updateWith1ArgAnnotations.get(0);

assertThat(updateWith1ArgParameterAnnotation.getKey(), is(AnnotationKey.CACHE_ARGS0.getCode()));

final List updateWith2ArgAnnotations = updateWith2ArgSpanEvent.getAnnotationBoList();

assertThat(updateWith2ArgAnnotations.size(), is(1));

final AnnotationBo updateWith2ArgAnnotation = updateWith2ArgAnnotations.get(0);

assertThat(updateWith2ArgAnnotation.getKey(), is(AnnotationKey.CACHE_ARGS0.getCode()));

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值