天道酬勤,学无止境

betamax

Betamax with Spring Boot throws Illegal use of nonvirtual function call

问题 我正在尝试使用 Betamax 在 Groovy 中使用 Spock 设置一个简单的测试: class BetaMaxSpockTest extends Specification { @Rule public Recorder recorder = new Recorder() @Betamax(tape = "some_tape") def 'You shall pass'() { expect: true } } 我也在使用 Spring Boot,所以我在 pom.xml 中有 spring-boot-starter-parent 作为我的父级: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.6.RELEASE</version> </parent> 当我运行上面的测试时,我收到了这个错误: java.lang.VerifyError: (class: co/freeside/betamax/proxy/jetty/BetamaxProxy, method: super$3$getBean signature: (Ljava/lang/Class;)Ljava/lang

2022-04-22 17:53:34    分类:技术分享    groovy   spring-boot   spock   betamax

Betamax with Spring Boot throws Illegal use of nonvirtual function call

I'm trying to setup a simple test in Groovy with Spock using Betamax: class BetaMaxSpockTest extends Specification { @Rule public Recorder recorder = new Recorder() @Betamax(tape = "some_tape") def 'You shall pass'() { expect: true } } I'm also using Spring Boot so I have spring-boot-starter-parent as my parent in pom.xml: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.2.6.RELEASE</version> </parent> When I run above test I'm getting this error: java.lang.VerifyError: (class: co/freeside/betamax/proxy/jetty/BetamaxProxy

2022-04-16 21:24:28    分类:问答    groovy   spring-boot   spock   betamax

Betamax 无法记录 HTTPS 流量(Betamax fails to record HTTPS traffic)

问题 我的问题与 Betamax 库有关。 我在记录 HTTPS 流量时遇到问题。 我正在使用 Betamax 1.1.2、JDK 1.6、Groovy 2.2.2 和 jUnit 4.11。 我的测试代码: @Rule public Recorder recorder = new Recorder(); @Before public void setup() { recorder.setSslSupport(true); } @Betamax(tape = "my_tape") @Test public void test1() throws Exception { MyConnector connector = new Connector(); String response = connector.getResponse(); assertThat(response, is("response")); } 我得到的回应是: 2014-04-01 08:34:16 DEBUG log:70 - REQUEST *:443 on org.eclipse.jetty.server.nio.SelectChannelConnector$2@10eaa67 2014-04-01 08:34:16 DEBUG CustomConnectHandler:70 - CONNECT

2021-11-11 23:08:18    分类:技术分享    java   ssl   betamax

Betamax fails to record HTTPS traffic

My question is connected with Betamax library. I have problem with recording HTTPS traffic. I am using Betamax 1.1.2, JDK 1.6, Groovy 2.2.2 and jUnit 4.11. My test code: @Rule public Recorder recorder = new Recorder(); @Before public void setup() { recorder.setSslSupport(true); } @Betamax(tape = "my_tape") @Test public void test1() throws Exception { MyConnector connector = new Connector(); String response = connector.getResponse(); assertThat(response, is("response")); } Response that I get is: 2014-04-01 08:34:16 DEBUG log:70 - REQUEST *:443 on org.eclipse.jetty.server.nio

2021-11-10 16:00:08    分类:问答    java   ssl   betamax

在 Groovy 中读取 YAML 文件(Read a YAML file in Groovy)

问题 我正在尝试在我的 Groovy 项目中加载一个现有的 YAML 文件(它使用 snakeYaml 库)。 我有一个名为 YamlTape.groovy 的类,它包含使用以下代码加载 YAML 文件的方法。 static YamlTape readFrom(Reader reader) { try { println "YamlTape : inside readFrom reader.size() = "+reader+" YamlTape: "+YamlTape yaml.loadAs(reader, YamlTape) println "YamlTape : after readfrom" } catch (YAMLException e) { println "YamlTape : inside catch block" throw new TapeLoadException('Invalid tape', e) } } 并尝试从另一个 groovy 类调用此方法。 代码: YamlTape loadTape(String name) { println "YamlTapeLoader : inside loadTape" def file = fileFor(name) println "YamlTapeLoader : inside loadTape

2021-07-28 08:47:35    分类:技术分享    groovy   yaml   betamax

Read a YAML file in Groovy

I am trying to load an existing YAML file (which uses snakeYaml library) in my Groovy project. I have a class called YamlTape.groovy which contains method to load the YAML file using the following code. static YamlTape readFrom(Reader reader) { try { println "YamlTape : inside readFrom reader.size() = "+reader+" YamlTape: "+YamlTape yaml.loadAs(reader, YamlTape) println "YamlTape : after readfrom" } catch (YAMLException e) { println "YamlTape : inside catch block" throw new TapeLoadException('Invalid tape', e) } } and trying to call this method from another groovy class. Code: YamlTape

2021-06-25 01:54:01    分类:问答    groovy   yaml   betamax