Add agent for VS Code

This commit is contained in:
Stephane Nicoll
2018-02-21 16:18:49 +01:00
parent 2cb997cd24
commit afd4cd6a59
2 changed files with 11 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -75,6 +75,8 @@ public class Agent {
NETBEANS("netbeans", "NetBeans"), NETBEANS("netbeans", "NetBeans"),
VSCODE("vscode", "vscode"),
BROWSER("browser", "Browser"); BROWSER("browser", "Browser");
final String id; final String id;

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2017 the original author or authors. * Copyright 2012-2018 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -79,6 +79,13 @@ public class AgentTests {
assertThat(agent.getVersion(), is("0.1")); assertThat(agent.getVersion(), is("0.1"));
} }
@Test
public void checkVsCode() {
Agent agent = Agent.fromUserAgent("vscode/0.2.0");
assertThat(agent.getId(), equalTo(Agent.AgentId.VSCODE));
assertThat(agent.getVersion(), is("0.2.0"));
}
@Test @Test
public void checkGenericBrowser() { public void checkGenericBrowser() {
Agent agent = Agent.fromUserAgent( Agent agent = Agent.fromUserAgent(