我有一个域对象,为了这个问题的目的,我将使用以下私有变量调用Person:
String name
int age
Run Code Online (Sandbox Code Playgroud)
每个人都有吸气剂和二传手.现在我还有Map<String, String>以下条目:
name, phil
age, 35
Run Code Online (Sandbox Code Playgroud)
我想在Person类中填充所有setter方法的列表,然后循环遍历此列表并使用map中的值调用每个方法.
这是否可能,因为我在网上看不到任何接近这个的例子.非常感谢例子.
我目前正在研究将Mockito和JUnit集成到我的Wicket/Spring/Hibernate项目中,并找到了如何使用注释来完成此操作的教程.
麻烦是我对@Autowired不熟悉,在浏览谷歌后我发现很难看出这个注释和@SpringBean注释之间的区别.
它们是同一个还是我应该注意的差异?
我的代码为这个问题提供了一些上下文:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
@TransactionConfiguration(transactionManager = "txManager", defaultRollback = false)
public class TestHome
{
private WicketTester tester;
@Autowired
private ApplicationContext ctx;
@Autowired
private WebApplication webApplication;
@Before
public void setUp() {
tester = new WicketTester(webApplication);
}
@Test
@Transactional
@Rollback(true)
public void testRenderHomePage() {
tester.startPage(Home.class);
tester.assertRenderedPage(Home.class);
tester.assertComponent("home", Home.class);
}
}
Run Code Online (Sandbox Code Playgroud) 我有以下标记/代码
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Demo</title>
<script src="directory for jquery script">
$(document).ready(function () {
$("button").on('click', 'test', function() {
var webserUrl = "http://wsf.cdyne.com/WeatherWS/Weather.asmx";
var soapRequest = '<ns1:GetWeatherInformation xmlns:ns1=\'http://ws.cdyne.com/WeatherWS/\' />';
$.ajax({
type: "POST",
url: webserUrl,
contentType: "text/xml",
dataType: "xml",
data: soapRequest,
success: SuccessOccur,
error: ErrorOccur
});
});
});
function SuccessOccur(data, status, req) {
if (status == "success")
alert(req.responseText);
}
function ErrorOccur(data, status, req) {
alert(req.responseText + " " + status);
}
</script>
</head>
<body>
<button id="test">Test</button>
Run Code Online (Sandbox Code Playgroud)
点击测试按钮我希望发送肥皂请求,但由于某种原因,当我点击按钮没有任何反应时,我可以确认它正在点击jquery.js(2.1.1).
我确信这是一个愚蠢的错误,但我没有看到它,我有的代码(这是一个返工版本)工作正常,但这段代码没有.
大大收到任何帮助来挑选问题.