小编Jus*_*ber的帖子

创建批处理脚本以解压缩文件而无需其他zip工具

我正在尝试为Windows 7 x64创建一个.bat脚本来创建一个文件夹,将文件解压缩到该文件夹​​中,而不必使用其他插件,如7zip或解压缩.一直在搜索,似乎Windows没有内置设备允许在命令中轻松解压缩.我可以在没有附加插件的情况下解压/扩展文件吗?

windows batch-file

31
推荐指数
4
解决办法
11万
查看次数

无法计算构建计划:插件org.apache.maven.plugins:maven-jar-plugin:2.3.2或其中一个依赖项无法解析

当我尝试在eclipse中创建Maven项目时,我收到以下错误消息.许多人在settings.xml文件中发布了代理,并刷新.m2文件夹,强制它下载新的代码.这些都不适合我.我在工作,互联网选项中的代理设置处于活动状态.

错误消息:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: 
Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: 
Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.5
Run Code Online (Sandbox Code Playgroud)

pom.xml中:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.blahhhhhhhhhhhhhhhhh</groupId>
  <artifactId>HelloRESTEasy</artifactId>
  <version>0.0.1-SNAPSHOT</version>
</project>
Run Code Online (Sandbox Code Playgroud)



settings.xml中:

  <proxies>
    <proxy>
      <id>optional</id>
      <active>true</active>
      <protocol>http</protocol>
      <username>proxyuser</username>
      <password>proxypass</password>
      <host>proxyserver.company.com</host>
      <port>8080</port>
      <nonProxyHosts>local.net|some.host.com</nonProxyHosts>
    </proxy>
  </proxies>
Run Code Online (Sandbox Code Playgroud)

eclipse-plugin maven

17
推荐指数
4
解决办法
20万
查看次数

Mockito模拟返回值并验证它

我有这个类,并希望创建一个模拟返回并验证返回值"50":
QAService.java:

@Path("/QAService")
public class QAService {
@GET()
//@Path("/")
@Produces("text/plain")
public String getServiceInfo() {
    return "50";
}
Run Code Online (Sandbox Code Playgroud)

我对定义模拟的理解是我可以创建一个实现类的假对象和模拟函数,但是我可以测试接口.

我仍然在创建这个测试来测试没有接口的模拟.我该如何验证呢?:
QAServiceTest.java:

public class QAServiceTest {

    @Test
    public void getserviceTest () {

    QAService qasmock = mock(QAService.class);
    when(qasmock.getServiceInfo()).thenReturn("50");
    String expected = "50";
    assertEquals(expected, qasmock.getServiceInfo());
    }
}
Run Code Online (Sandbox Code Playgroud)

java unit-testing mocking mockito

10
推荐指数
2
解决办法
4万
查看次数

jUnit assertEquals字符串返回"50"预期"50",但没有返回任何测试

尝试使用jUnit和REST Web服务.写了下面的类和测试类并进行了测试.要么我错误地写了测试,要么写错了服务.

我相信它应该 是return "50"; OR
它应该返回Path还有50?那我怎么写那个测试呢?

班级:

@Path("/QAService")
public class QAService {
    @GET()
    //@Path("/")
    @Produces("text/plain")
    public String getServiceInfo() {
        return "50";
    }
Run Code Online (Sandbox Code Playgroud)

班级考试:

public class QAServiceTest {
    @Test
    public void testgetServiceInfo() {

        String expected = "50";   

        //create static variable to call non-static variable. assertEquals.
        QAService qas = new QAService();
        qas.getServiceInfo();
        assertEquals(expected, qas);
    }
Run Code Online (Sandbox Code Playgroud)

但得到了测试结果:

expected:<50> but was:<com.hey.BLA.zurich.QAService@52bb855b>
java.lang.AssertionError
    at org.junit.Assert.fail(Assert.java:93)
    at org.junit.Assert.failNotEquals(Assert.java:647)
    at org.junit.Assert.assertEquals(Assert.java:128)
    at org.junit.Assert.assertEquals(Assert.java:147)
    at com.hey.BLA.zurich.QAServiceTest.testgetServiceInfo(QAServiceTest.java:25)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at …
Run Code Online (Sandbox Code Playgroud)

java junit

1
推荐指数
1
解决办法
281
查看次数

如果Artifactory中缺少,则自动下载缺失的工件

我正在使用Jfrog Artifactory来包含工件.我正在和Maven一起建设.有没有办法配置Maven自动下载缺少的工件,这些工件不在Artifactory仓库中.

示例:
org.maven.framework-2.5.0从Artifactory下载,因为它存在于Artifactory中.artifacotry中不存在org.maven.anotherframework-2.2.2.如何设置maven从互联网上获取?

以这种方式使用Artifactory是否常见?

artifactory maven

0
推荐指数
1
解决办法
4535
查看次数